Tuesday, 15 May 2012

shell - Ansible read after write file operations in playbooks -


I am working on a project using an angle for which I write a data book to write some data Required and then read data from another file using the same playbook.

PlayBook will be something like this test1.yml

  --- - Host: Localhost connection: Local Assembled Function: No Action: - Name: Check File Local_Action Writing data for: Shell echo "Data:" {{100 | Random (step = 10)}} & gt; Test.txt - Include: test2.yml  

and it will need to use test2.yml

  --- - Host: Localhost connection : Local Assemble: No vars_files: - test.txt Action: - Name: Writing data for file local_action: Shell echo "{{data}}" & gt; However,  

The second playbook is not yet able to read the latest data posted by the PlayBook.

If I look at the data written in test.txt and result.txt , then they are both different. Is there any way of achieving continuity between the results of Playbook calls ????

Are those two playbooks separately called? If they are included inside a master playbook, then it will explain it. All Master Playbooks are included before the execution, so Anjali will have already read both the Playbook and vars_file before any of them will not be executed. While playing with the module, you should be able to resolve it with a dual-purpose file.

If I was wrong with my belief and you are not including Playbook in a parent's playbook: What do you really mean by "different"? Is it completely different data or is this a formatting issue? I suspect that data can not generally be compatible between calls. There is no magic by writing and writing in writing. Doctrine should work


No comments:

Post a Comment