Merge branch 'black_mirror' into 'newinfra'
Define mirror.adm.crans.org if unknown See merge request nounous/ansible!102certbot_on_virtu
						commit
						884b06e0ca
					
				| 
						 | 
				
			
			@ -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:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,6 +4,6 @@
 | 
			
		|||
- hosts: certbot
 | 
			
		||||
  vars:
 | 
			
		||||
    certbot: '{{ glob_certbot | default({}) | combine(loc_certbot | default({})) }}'
 | 
			
		||||
    mirror: '{{ glob_mirror }}'
 | 
			
		||||
    mirror: '{{ glob_mirror.name }}'
 | 
			
		||||
  roles:
 | 
			
		||||
    - certbot
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue