Hi all,

I have a play that adds a line to a file in the host_vars directory on
the host running the play. I have a very sporadic error, that the
contents of the file are not being re-read afterwards.

I'll explain with a mock-up playbook containing three plays:

- hosts: foo
  gather_facts: true
  tasks:
    - name: "do something on foo"
    ...

- hosts: localhost
  gather_facts: true
  tasks:
    - name: "Change the line in host_vars on the host running the play"
    ...

- hosts: localhost
  gather_facts: true
  tasks:
    - name: "Do something that involves using this variable"


The third task does see the variable defined in the change file in the
host_vars, but not always. And not reproducibly.

Is there a way to trigger re-reading the host_vars files?

I'll try using set_fact next, but as this is only valid til the end of
the play IIRC, I'll have to combine the plays 2 and 3 (which I only
separeted because I hoped this would trigger the re-read...). And I am
not sure if the syntax allows setting hostvars for another host...

Any ideas?

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/95ce7e54-7b3d-e161-ac66-72b11f86eaa8%40ojkastl.de.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to