diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..085e293 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,9 @@ +[submodule "roles.extern/cleanup-hosts"] + path = roles.extern/cleanup-hosts + url = https://git.velt.biz/Ansible/cleanup-hosts.git +[submodule "roles.extern/ssh-keyonly"] + path = roles.extern/ssh-keyonly + url = https://git.velt.biz/Ansible/role.ssh-keyonly.git +[submodule "roles.extern/epel-simplified"] + path = roles.extern/epel-simplified + url = https://git.velt.biz/Ansible/epel-simplified diff --git a/06/_epel.yml b/06/_epel.yml new file mode 100644 index 0000000..3966a6a --- /dev/null +++ b/06/_epel.yml @@ -0,0 +1,7 @@ +--- +- hosts: all + + roles: + + - role: epel + diff --git a/06/_ssh.yml b/06/_ssh.yml new file mode 100644 index 0000000..158f519 --- /dev/null +++ b/06/_ssh.yml @@ -0,0 +1,6 @@ +--- +- hosts: all + + roles: + - ssh-keyonly + diff --git a/06/ansible.cfg b/06/ansible.cfg new file mode 100644 index 0000000..ba2b872 --- /dev/null +++ b/06/ansible.cfg @@ -0,0 +1,31 @@ +[defaults] + +# Inventory +inventory = ./hosts.ini + +# Roles paths +roles_path = ./roles:./roles.extern:/etc/ansible/roles + +# Interpreter Discovery - Ohne Warnings +interpreter_python = auto_silent + +# SSH +remote_user = root +#host_key_checking = False + +# Retry files +retry_files_enabled = yes +retry_files_save_path = ./.cache/Retry/ + +# Log files +#log_path = ./log/ansible.log + +# Farben ausschalten +#nocolor = 1 + +[colors] +# Für dunklen Hintergrund in der Console +verbose = bright blue +debug = bright gray +error = bright red + diff --git a/06/git-urls.txt b/06/git-urls.txt new file mode 100644 index 0000000..7d7b4e0 --- /dev/null +++ b/06/git-urls.txt @@ -0,0 +1,6 @@ +git clone https://git.velt.biz/Ansible/cleanup-hosts.git + +git clone https://git.velt.biz/Ansible/ssh-keyonly.git + +git clone https://git.velt.biz/Ansible/epel-simplified.git + diff --git a/06/hosts_ssh_epel.yml b/06/hosts_ssh_epel.yml new file mode 100644 index 0000000..5f4976a --- /dev/null +++ b/06/hosts_ssh_epel.yml @@ -0,0 +1,12 @@ +--- +- hosts: all + + roles: + + - cleanup-hosts + + - { role: ssh-keyonly } + + - role: epel + when: ansible_os_family == "RedHat" and ansible_distribution != "Fedora" + diff --git a/06/ntp-role.yml b/06/ntp-role.yml new file mode 100644 index 0000000..743f533 --- /dev/null +++ b/06/ntp-role.yml @@ -0,0 +1,6 @@ +--- +- hosts: all + + roles: + - ntp + diff --git a/group_vars/all/ssh.yml b/group_vars/all/ssh.yml new file mode 100644 index 0000000..6f6d9cf --- /dev/null +++ b/group_vars/all/ssh.yml @@ -0,0 +1,3 @@ +--- +ssh_service_name: sshd + diff --git a/group_vars/apt/ssh.yml b/group_vars/apt/ssh.yml new file mode 100644 index 0000000..9d3811f --- /dev/null +++ b/group_vars/apt/ssh.yml @@ -0,0 +1,3 @@ +--- +ssh_service_name: ssh + diff --git a/group_vars/ubuntu/chrony.yml b/group_vars/ubuntu/chrony.yml new file mode 100644 index 0000000..ee5e403 --- /dev/null +++ b/group_vars/ubuntu/chrony.yml @@ -0,0 +1,7 @@ +--- +chrony_pools: + - 0.ubuntu.pool.ntp.org + - 1.ubuntu.pool.ntp.org + - 2.ubuntu.pool.ntp.org + - 3.ubuntu.pool.ntp.org + diff --git a/roles.extern/cleanup-hosts b/roles.extern/cleanup-hosts new file mode 160000 index 0000000..526b7e4 --- /dev/null +++ b/roles.extern/cleanup-hosts @@ -0,0 +1 @@ +Subproject commit 526b7e4bb5b81630f9f7b25bbc1035b42a454358 diff --git a/roles.extern/epel b/roles.extern/epel new file mode 120000 index 0000000..2154609 --- /dev/null +++ b/roles.extern/epel @@ -0,0 +1 @@ +epel-simplified \ No newline at end of file diff --git a/roles.extern/epel-simplified b/roles.extern/epel-simplified new file mode 160000 index 0000000..55ad5af --- /dev/null +++ b/roles.extern/epel-simplified @@ -0,0 +1 @@ +Subproject commit 55ad5aff48a6cbd07407614f835da5175e8e72cc diff --git a/roles.extern/hosts b/roles.extern/hosts new file mode 120000 index 0000000..7b9fd07 --- /dev/null +++ b/roles.extern/hosts @@ -0,0 +1 @@ +cleanup-hosts \ No newline at end of file diff --git a/roles.extern/ssh-keyonly b/roles.extern/ssh-keyonly new file mode 160000 index 0000000..c55557f --- /dev/null +++ b/roles.extern/ssh-keyonly @@ -0,0 +1 @@ +Subproject commit c55557f733bd798f5c30396dca5e3c83effe173e diff --git a/roles/ntp/defaults/main.yml b/roles/ntp/defaults/main.yml new file mode 100644 index 0000000..84e77fb --- /dev/null +++ b/roles/ntp/defaults/main.yml @@ -0,0 +1,7 @@ +--- +chrony_pools: + - 0.de.pool.ntp.org + - 1.de.pool.ntp.org + - 2.de.pool.ntp.org + - 3.de.pool.ntp.org + diff --git a/roles/ntp/tasks/main.yml b/roles/ntp/tasks/main.yml new file mode 100644 index 0000000..134cae2 --- /dev/null +++ b/roles/ntp/tasks/main.yml @@ -0,0 +1,16 @@ +--- +- name: Install Chrony + package: name=chrony state=latest + +- name: Show pools + debug: var=chrony_pools + +- name: Template config file + template: "src=chrony.conf.j2 dest='{{ chrony_config_path }}' mode=0644 owner=root group=root backup=yes" + +- name: Restart Chrony with new config + service: "name='{{ chrony_service_name }}' state=restarted" + +- name: Enable Chrony at boot + service: "name={{ chrony_service_name }} state=started enabled=yes" + diff --git a/roles/ntp/templates/chrony.conf.j2 b/roles/ntp/templates/chrony.conf.j2 new file mode 120000 index 0000000..3516a48 --- /dev/null +++ b/roles/ntp/templates/chrony.conf.j2 @@ -0,0 +1 @@ +../../../05/chrony.conf.j2 \ No newline at end of file