mirror of
https://gitea.0xace.cc/ansible-galaxy/hosts.git
synced 2024-11-28 16:36:39 +00:00
17 lines
425 B
YAML
17 lines
425 B
YAML
---
|
|
- block:
|
|
- name: Add ip address of all hosts to all hosts
|
|
lineinfile:
|
|
dest: /etc/hosts
|
|
regexp: '.*{{ item }} {{ item.split(".")[0] }}$'
|
|
line: "{{ hostvars[item].ansible_host }} {{ item }} {{ item.split('.')[0] }}"
|
|
state: present
|
|
when:
|
|
- hostvars[item].ansible_host is defined
|
|
- hosts_pin
|
|
with_items: "{{ ansible_play_hosts_all }}"
|
|
tags:
|
|
- hosts
|
|
|
|
become: true
|