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)
26 when: ansible_os_family == "Debian"
28 - name: installing epel repo (RedHat)
33 ansible_os_family == "RedHat" and
34 ansible_distribution != "Fedora"
36 - name: installing ansible pre-reqs (RedHat)
45 ansible_os_family == "RedHat" and
46 ansible_distribution != "Fedora"
48 - name: installing ansible pre-reqs (Fedora)
59 ansible_os_family == "RedHat" and
60 ansible_distribution == "Fedora"
62 - name: installing ansible
67 - name: ensuring host_vars directory exists
71 delegate_to: localhost
74 when: update_host_vars is defined and update_host_vars
76 - name: ensuring host file exists in host_vars
78 path: "{{ host_vars_file }}"
79 delegate_to: localhost
83 update_host_vars is defined and
86 - name: creating missing host_vars
88 path: "{{ host_vars_file }}"
90 delegate_to: localhost
92 when: not host_var.stat.exists
94 - name: updating ansible_ssh_port
96 dest: "{{ host_vars_file }}"
97 regexp: "^ansible_ssh_port{{ ':' }}"
98 line: "ansible_ssh_port{{ ':' }} 22"
99 delegate_to: localhost
102 (update_host_vars is defined and
103 update_host_vars) and
104 (ansible_eth1 is defined or
105 ansible_enp0s8 is defined)
107 - name: updating ansible_ssh_host
109 dest: "{{ host_vars_file }}"
110 regexp: "^ansible_ssh_host{{ ':' }}"
111 line: "ansible_ssh_host{{ ':' }} {{ ansible_eth1.ipv4.address }}"
112 delegate_to: localhost
115 (update_host_vars is defined and
116 update_host_vars) and
117 ansible_eth1 is defined
119 - name: updating ansible_ssh_host
121 dest: "{{ host_vars_file }}"
122 regexp: "^ansible_ssh_host{{ ':' }}"
123 line: "ansible_ssh_host{{ ':' }} {{ ansible_enp0s8.ipv4.address }}"
124 delegate_to: localhost
127 (update_host_vars is defined and
128 update_host_vars) and
129 ansible_enp0s8 is defined
131 - name: updating ansible_ssh_key
133 dest: "{{ host_vars_file }}"
134 regexp: "^ansible_ssh_private_key_file{{ ':' }}"
135 line: "ansible_ssh_private_key_file{{ ':' }} {{ ssh_key_path }}"
136 delegate_to: localhost
139 update_host_vars is defined and
142 - name: ensuring host_vars is yaml formatted
144 dest: "{{ host_vars_file }}"
148 delegate_to: localhost
151 update_host_vars is defined and