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

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/7b02fb4a-ddcb-c3be-6134-d37a504c419c%40ojkastl.de.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to