diff --git a/tasks/main.yml b/tasks/main.yml index d16f580ecf7d0e41c9f967db23e139468e013511..8923553538770c23bde78db7e723c11772d98295 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -9,21 +9,21 @@ - name: "Create The /etc/hosts File" template: - src='etc_hosts' - dest='/etc/hosts' - owner='root' - group='root' - mode='644' + src: 'etc_hosts' + dest: '/etc/hosts' + owner: 'root' + group: 'root' + mode: '644' - name: "Copy SSH Config For Server-To-Server Communication For Admins" template: - src='ssh_config' - dest='/home/{{ item }}/.ssh/config' - owner='{{ item }}' - group='root' - mode='644' + src: 'ssh_config' + dest: '/home/{{ item }}/.ssh/config' + owner: '{{ item }}' + group: 'root' + mode: '644' with_flattened: - - '{{ admins }}' + - '{{ admins|default([]) }}' - '{{ jailusers|default([]) }}' - name: "Read available variable cache files" diff --git a/tasks/more.yml b/tasks/more.yml index bdd26540bc554313b18b6d9bf3d24202858a3d8f..91c1e675803579ea19092595c4ce563adc58d316 100644 --- a/tasks/more.yml +++ b/tasks/more.yml @@ -10,8 +10,8 @@ - name: "Add Hosts to Hostfile" lineinfile: - dest='/etc/hosts' - regexp='.* {{ item }}$' - line='{{ facts[item].static_ipv4 }} {{ item }}' - state=present + dest: '/etc/hosts' + regexp: '.* {{ item }}$' + line: '{{ facts[item].static_ipv4 }} {{ item }}' + state: 'present' with_items: '{{ facts }}' diff --git a/templates/etc_hosts b/templates/etc_hosts index 68fdd199ad729bdc080383eb3def6801b7dd6bca..ce413a4e46d208d12ad2a7ffa64e616a49a1d8a1 100644 --- a/templates/etc_hosts +++ b/templates/etc_hosts @@ -47,6 +47,8 @@ ff02::2 ip6-allrouters {% endfor %} {% for host in commonauth_extras|default([]) %} +{% if host.ip is defined %} {{host.ip}}{% for name in host['names'] %} {{name}}{% endfor %} +{% endif %} {% endfor %}