Remove hosts hardcode

This commit is contained in:
Андрей Лимачко 2022-03-09 09:01:02 +04:00
parent 1b4696fabd
commit 9cd23a3b68

View File

@ -59,12 +59,12 @@
owner: root
group: root
mode: 0644
- name: register nodes in /etc/hosts
lineinfile:
path: /etc/hosts
regexp: ".*{{ item }}$"
line: "{{ hostvars[item].ansible_default_ipv4.address }} {{ item }}"
state: present
when: hostvars[item].ansible_default_ipv4.address is defined
with_items: "{{ play_hosts }}"
#- name: register nodes in /etc/hosts
# lineinfile:
# path: /etc/hosts
# regexp: ".*{{ item }}$"
# line: "{{ hostvars[item].ansible_default_ipv4.address }} {{ item }}"
# state: present
# when: hostvars[item].ansible_default_ipv4.address is defined
# with_items: "{{ play_hosts }}"
tags: [ prepare ]