Merge branch 'black_mirror' into 'newinfra'

Define mirror.adm.crans.org if unknown

See merge request nounous/ansible!102
certbot_on_virtu
_pollion 2020-11-28 16:03:07 +01:00
commit 884b06e0ca
4 changed files with 26 additions and 3 deletions

View File

@ -42,7 +42,9 @@ adm_subnet: 10.231.136.0/24
# #
# # global server definitions # # global server definitions
glob_smtp: smtp.adm.crans.org glob_smtp: smtp.adm.crans.org
glob_mirror: mirror.adm.crans.org glob_mirror:
name: mirror.adm.crans.org
ip: 172.16.10.30
glob_ldap: glob_ldap:
servers: servers:

View File

@ -4,6 +4,6 @@
- hosts: certbot - hosts: certbot
vars: vars:
certbot: '{{ glob_certbot | default({}) | combine(loc_certbot | default({})) }}' certbot: '{{ glob_certbot | default({}) | combine(loc_certbot | default({})) }}'
mirror: '{{ glob_mirror }}' mirror: '{{ glob_mirror.name }}'
roles: roles:
- certbot - certbot

View File

@ -5,7 +5,7 @@
vars: vars:
certbot: '{{ glob_certbot | default({}) | combine(loc_certbot | default({})) }}' certbot: '{{ glob_certbot | default({}) | combine(loc_certbot | default({})) }}'
freeradius: '{{ glob_freeradius | default({}) | combine(loc_freeradius | default({})) }}' freeradius: '{{ glob_freeradius | default({}) | combine(loc_freeradius | default({})) }}'
mirror: '{{ glob_mirror }}' mirror: '{{ glob_mirror.name }}'
roles: roles:
- certbot - certbot
- freeradius - freeradius

View File

@ -1,6 +1,27 @@
#!/usr/bin/env ansible-playbook #!/usr/bin/env ansible-playbook
--- ---
# root is the first playbook to launch (as root) whe initiation a new server # root is the first playbook to launch (as root) whe initiation a new server
- hosts: server
tasks:
- name: Check if mirror.adm is defined in /etc/hosts
lineinfile:
state: absent
path: /etc/hosts
regexp: '^{{ glob_mirror.ip }}'
check_mode: True
changed_when: False
register: check_mirror
- name: Define mirror.adm.crans.org if it doesn't exist.
lineinfile:
path: /etc/hosts
line: '{{ glob_mirror.ip }} {{ glob_mirror.name }}'
insertafter: '127.0.0.1 localhost'
when: check_mirror.found == 0
- hosts: tealc.adm.crans.org - hosts: tealc.adm.crans.org
roles: roles:
- baie - baie