Skip to content

Commit 53b2813

Browse files
authored
Merge pull request #90 from lae/feature/deprecated-pvelocalhost
Don't insert pvelocalhost names in /etc/hosts
2 parents af1a963 + 3f90a50 commit 53b2813

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

tasks/main.yml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@
3232
{% for host in groups[pve_group] %}\
3333
{{ hostvars[host].pve_cluster_addr0 }}
3434
{{ hostvars[host].ansible_fqdn }}
35-
{{ hostvars[host].ansible_hostname }}\
36-
{% if ansible_fqdn == hostvars[host].ansible_fqdn %} pvelocalhost{% endif %}
35+
{{ hostvars[host].ansible_hostname }}
3736
3837
3938
{% endfor %}"
@@ -42,7 +41,7 @@
4241
lineinfile:
4342
dest: /etc/hosts
4443
# expanded, this turns out to be, for example:
45-
# regexp: "^(?!10\.0\.3\.17\\ test01\.lxc\\ test01\\ pvelocalhost)(?!10\.0\.3\.17)[0-9a-f:.]+(\s+.*)?\s(test01\.lxc|test01|pvelocalhost)(\s+.*|\s*)$'
44+
# regexp: "^(?!10\.0\.3\.17\\ test01\.lxc\\ test01)(?!10\.0\.3\.17)[0-9a-f:.]+(\s+.*)?\s(test01\.lxc|test01)(\s+.*|\s*)$'
4645
# basically first we ignore lines that match from the host enumeration task
4746
# above, then we match against different IPs (e.g. NOT 10.0.3.17) that have
4847
# the hostname/fqdn we inserted a record for previously, taking care also to
@@ -68,16 +67,12 @@
6867
_correct_line: "\
6968
{{ hostvars[item].pve_cluster_addr0 }}
7069
{{ hostvars[item].ansible_fqdn }}
71-
{{ hostvars[item].ansible_hostname }}\
72-
{% if ansible_fqdn == hostvars[item].ansible_fqdn %} pvelocalhost{% endif %}"
70+
{{ hostvars[item].ansible_hostname }}"
7371
_correct_ip: "{{ hostvars[item].pve_cluster_addr0 }}"
7472
_match_hosts: >-
7573
[
7674
"{{ hostvars[item].ansible_fqdn }}",
77-
"{{ hostvars[item].ansible_hostname }}",
78-
{% if ansible_fqdn == hostvars[item].ansible_fqdn %}
79-
"pvelocalhost"
80-
{% endif %}
75+
"{{ hostvars[item].ansible_hostname }}"
8176
]
8277
8378
- name: Trust Proxmox' packaging key

0 commit comments

Comments
 (0)