On 08.02.17 07:01 Mona Gopal wrote:
> A text file with configuration contents would be given to us by the
> product teams. I will have to compare this file against the one on
> the remote host , find out the difference, and replace values for
> the variables where it doesn't match. How is this achievable using
> Ansible. Kindly suggest a solution.
I assume you want to manually control, what the differences are.
Automating this is difficult.
I would use a template task, put the file you just got into your
ansible folder as the template src file and then run the
ansible-playbook command with --check --diff:
# File foobar.yml
- hosts: foobar
tasks:
- template:
src: "file_you_just_got"
dest: "/path/to/file/on/remote/server"
check_mode: yes
Then run the playbook foobar.yml like this:
ansible-playbook foobar.yml --check --diff
Johannes