devolab-openshift/update_host_file.yml

18 lines
420 B
YAML
Raw Normal View History

2018-11-14 18:56:34 +01:00
- hosts:
- OSEv3
- localhost
become: true
tasks:
- name: debug hostvars for OSEv3 group
debug:
var: "{{ hostvars }}"
verbosity: 3
- name: Update /etc/hosts file with all nodes
blockinfile:
path: /etc/hosts
block: |
{% for item in groups['OSEv3'] %}
{{ hostvars[item]['ansible_default_ipv4']['address'] }} {{ item }}
{% endfor %}