Define mirror.adm.crans.org if unknown

certbot_on_virtu
_pollion 2020-11-28 15:53:35 +01:00
parent c4e0173c35
commit 40fbcd076f
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
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:
servers:

View File

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

View File

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

View File

@ -1,6 +1,27 @@
#!/usr/bin/env ansible-playbook
---
# 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
roles:
- baie