ansible/roles/kvm_install/tasks/hosts_vm2ip.yml

19 lines
527 B
YAML

---
- name: Retrieve ipv4-address for resolution in /etc/hosts on wirt machine
shell: /home/core/Scripte/vhost_getIPv4 "{{ vm_name }}"
register: ipv4
- name: Write vmname and ipv4-address for resolution to /etc/hosts on wirt machine
debug: msg={{ ipv4["stdout"] }}
- name: Write vmname and ipv4-address for resolution to /etc/hosts on wirt machine iXXXXXXXXXXXXXXXXXXXXX
ansible.builtin.lineinfile:
path: /etc/hosts
regexp: '^{{ ipv4["stdout"] }} ='
line: "{{ ipv4['stdout'] + ' ' + vm_name }}"
...