Kapitel 06: Roles
This commit is contained in:
parent
5c4d0c47be
commit
1ad0071333
9
.gitmodules
vendored
Normal file
9
.gitmodules
vendored
Normal file
|
@ -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
|
7
06/_epel.yml
Normal file
7
06/_epel.yml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
---
|
||||||
|
- hosts: all
|
||||||
|
|
||||||
|
roles:
|
||||||
|
|
||||||
|
- role: epel
|
||||||
|
|
6
06/_ssh.yml
Normal file
6
06/_ssh.yml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
- hosts: all
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- ssh-keyonly
|
||||||
|
|
31
06/ansible.cfg
Normal file
31
06/ansible.cfg
Normal file
|
@ -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
|
||||||
|
|
6
06/dep-steps.yml
Normal file
6
06/dep-steps.yml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- dep-step3
|
||||||
|
|
6
06/git-urls.txt
Normal file
6
06/git-urls.txt
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
git clone https://git.velt.biz/Ansible/cleanup-hosts.git
|
||||||
|
|
||||||
|
git clone https://git.velt.biz/Ansible/role.ssh-keyonly.git
|
||||||
|
|
||||||
|
git clone https://git.velt.biz/Ansible/epel-simplified.git
|
||||||
|
|
12
06/hosts_ssh_epel.yml
Normal file
12
06/hosts_ssh_epel.yml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
---
|
||||||
|
- hosts: all
|
||||||
|
|
||||||
|
roles:
|
||||||
|
|
||||||
|
- cleanup-hosts
|
||||||
|
|
||||||
|
- { role: ssh-keyonly }
|
||||||
|
|
||||||
|
- role: epel
|
||||||
|
when: ansible_os_family == "RedHat" and ansible_distribution != "Fedora"
|
||||||
|
|
6
06/ntp-role.yml
Normal file
6
06/ntp-role.yml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
- hosts: all
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- ntp
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
04/ansible.cfg
|
06/ansible.cfg
|
3
group_vars/all/ssh.yml
Normal file
3
group_vars/all/ssh.yml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
ssh_service_name: sshd
|
||||||
|
|
3
group_vars/apt/ssh.yml
Normal file
3
group_vars/apt/ssh.yml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
ssh_service_name: ssh
|
||||||
|
|
11
helper/06_gitmodules.sh
Executable file
11
helper/06_gitmodules.sh
Executable file
|
@ -0,0 +1,11 @@
|
||||||
|
#!/bin/bash -ex
|
||||||
|
|
||||||
|
mkdir -p roles.extern
|
||||||
|
|
||||||
|
git submodule add https://git.velt.biz/Ansible/cleanup-hosts.git roles.extern/cleanup-hosts
|
||||||
|
git submodule add https://git.velt.biz/Ansible/role.ssh-keyonly.git roles.extern/ssh-keyonly
|
||||||
|
git submodule add https://git.velt.biz/Ansible/epel-simplified roles.extern/epel-simplified
|
||||||
|
|
||||||
|
ln -s cleanup-hosts roles.extern/hosts
|
||||||
|
ln -s epel-simplified roles.extern/epel
|
||||||
|
|
3
host_vars/tn00-oracle7.yml
Normal file
3
host_vars/tn00-oracle7.yml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
epel_baseurl: http://archives.fedoraproject.org/pub/archive/epel/
|
||||||
|
|
1
roles.extern/cleanup-hosts
Submodule
1
roles.extern/cleanup-hosts
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 526b7e4bb5b81630f9f7b25bbc1035b42a454358
|
1
roles.extern/epel
Symbolic link
1
roles.extern/epel
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
epel-simplified
|
1
roles.extern/epel-simplified
Submodule
1
roles.extern/epel-simplified
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 55ad5aff48a6cbd07407614f835da5175e8e72cc
|
1
roles.extern/hosts
Symbolic link
1
roles.extern/hosts
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
cleanup-hosts
|
1
roles.extern/ssh-keyonly
Submodule
1
roles.extern/ssh-keyonly
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit c55557f733bd798f5c30396dca5e3c83effe173e
|
5
roles/dep-step1/tasks/main.yml
Normal file
5
roles/dep-step1/tasks/main.yml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
- name: Ausgabe
|
||||||
|
debug:
|
||||||
|
msg: Das ist Schritt 1
|
||||||
|
|
4
roles/dep-step2/meta/main.yml
Normal file
4
roles/dep-step2/meta/main.yml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
dependencies:
|
||||||
|
- dep-step1
|
||||||
|
|
6
roles/dep-step2/tasks/main.yml
Normal file
6
roles/dep-step2/tasks/main.yml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
- name: Ausgabe
|
||||||
|
debug:
|
||||||
|
msg: Das ist Schritt 2
|
||||||
|
|
||||||
|
|
5
roles/dep-step3/meta/main.yml
Normal file
5
roles/dep-step3/meta/main.yml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
dependencies:
|
||||||
|
- dep-step2
|
||||||
|
|
||||||
|
|
6
roles/dep-step3/tasks/main.yml
Normal file
6
roles/dep-step3/tasks/main.yml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
- name: Ausgabe
|
||||||
|
debug:
|
||||||
|
msg: Das ist Schritt 3
|
||||||
|
|
||||||
|
|
7
roles/ntp/defaults/main.yml
Normal file
7
roles/ntp/defaults/main.yml
Normal file
|
@ -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
|
||||||
|
|
16
roles/ntp/tasks/main.yml
Normal file
16
roles/ntp/tasks/main.yml
Normal file
|
@ -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"
|
||||||
|
|
1
roles/ntp/templates/chrony.conf.j2
Symbolic link
1
roles/ntp/templates/chrony.conf.j2
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../../../05/chrony.conf.j2
|
Loading…
Reference in a new issue