Team,
Could you please guide me how we can revert changes of a remote server file using ansible? like I have a file on server 1 abc.txt and someone have changed it my requirement is to make the abc.txt file in previous status using ansible.
Thanks,
Team,
Could you please guide me how we can revert changes of a remote server file using ansible? like I have a file on server 1 abc.txt and someone have changed it my requirement is to make the abc.txt file in previous status using ansible.
Thanks,
If someone made the change to a config outside of ansible, re-running the ansible playbook will restore the config to what is in the playbook.
Thanks, means we can not automate things like ansible keep monitoring the config file and revert it to original state if someone make any changes.
You can, many ways:
- schedule Ansible runs that set the file to the 'correct' version
(this is mostly how other CM tools do it)
- have a FAM (file alteration monitor: gam, aide, osiris, tripwire,
incron) trigger an Ansible run to update/correct the file
- run Ansible on a schedule with --check mode to notify you on
changes and rerun manually/automatically to do remediation
For schedule/triggering you can use many tools, including Tower/AWX, I
also recomend etckeeper as a tool to keep track of changes to local
configs.