6 - host_vars_directory: './host_vars'
7 - host_vars_file: '{{ host_vars_directory }}/{{ inventory_hostname }}.yml'
8 - pri_domain_name: 'vagrant.local'
9 - ssh_key_path: '.vagrant/machines/{{ inventory_hostname }}/virtualbox/private_key'
10 - update_host_vars: true
13 - name: updating apt cache (Debian)
16 cache_valid_time: 3600
17 when: ansible_os_family == "Debian"
19 - name: installing ansible pre-reqs (Debian)
29 ansible_os_family == "Debian"
31 - name: installing epel repo (RedHat)
36 ansible_os_family == "RedHat" and
37 ansible_distribution != "Fedora"
39 - name: installing ansible pre-reqs (RedHat)
50 ansible_os_family == "RedHat" and
51 ansible_distribution != "Fedora"
53 - name: installing ansible pre-reqs (Fedora)
67 ansible_os_family == "RedHat" and
68 ansible_distribution == "Fedora"
70 - name: installing ansible pre-reqs (openSUSE)
82 ansible_os_family == "openSUSE Leap"
84 - name: installing python pip
89 - name: installing ansible
95 - name: ensuring host_vars directory exists
99 delegate_to: localhost
102 when: update_host_vars is defined and update_host_vars
104 - name: ensuring host file exists in host_vars
106 path: "{{ host_vars_file }}"
107 delegate_to: localhost
111 update_host_vars is defined and
114 - name: creating missing host_vars
116 path: "{{ host_vars_file }}"
118 delegate_to: localhost
120 when: not host_var.stat.exists
122 - name: updating ansible_ssh_port
124 dest: "{{ host_vars_file }}"
125 regexp: "^ansible_ssh_port{{ ':' }}"
126 line: "ansible_ssh_port{{ ':' }} 22"
127 delegate_to: localhost
130 (update_host_vars is defined and
131 update_host_vars) and
132 (ansible_eth1 is defined or
133 ansible_enp0s8 is defined)
135 - name: updating ansible_ssh_host
137 dest: "{{ host_vars_file }}"
138 regexp: "^ansible_ssh_host{{ ':' }}"
139 line: "ansible_ssh_host{{ ':' }} {{ ansible_eth1.ipv4.address }}"
140 delegate_to: localhost
143 (update_host_vars is defined and
144 update_host_vars) and
145 ansible_eth1 is defined
147 - name: updating ansible_ssh_host
149 dest: "{{ host_vars_file }}"
150 regexp: "^ansible_ssh_host{{ ':' }}"
151 line: "ansible_ssh_host{{ ':' }} {{ ansible_enp0s8.ipv4.address }}"
152 delegate_to: localhost
155 (update_host_vars is defined and
156 update_host_vars) and
157 ansible_enp0s8 is defined
159 - name: updating ansible_ssh_key
161 dest: "{{ host_vars_file }}"
162 regexp: "^ansible_ssh_private_key_file{{ ':' }}"
163 line: "ansible_ssh_private_key_file{{ ':' }} {{ ssh_key_path }}"
164 delegate_to: localhost
167 update_host_vars is defined and
170 - name: ensuring host_vars is yaml formatted
172 dest: "{{ host_vars_file }}"
176 delegate_to: localhost
179 update_host_vars is defined and