Using `hosts` action cause losing your local changes
Summary
When one uses hosts
action after changing something in /etc/hosts
, all this changes are gone.
Steps to reproduce
- hosts: host1
roles:
- role: "system"
action: "hosts"
- hosts: host1
tasks:
- become: yes
lineinfile:
path: "/etc/hosts"
line: "127.0.0.1 pajac"
- hosts: host1
roles:
- role: "system"
action: "hosts"
Expected behavior
/etc/hosts
with line 127.0.0.1 pajac
.
Actual behavior
/etc/hosts
without this line.
Relevant logs and/or screenshots
nothing here
Possible fixes
Template should be changed to lineinfile
or blockinfile
.