Hi, I've created quite simple python module for installation and execution of multihost tests. And because of synchronization between the hosts, I need to generate "random" string/id/whatever and pass it to each test and it has to be the same for all hosts in one test. (But it has to be different when I'll rerun the ansible playbook.)
Current solution looks like this: I'll locally create random string in separate task before the test execution and pass it as argument to the run_test module (named uuid): - name: generate uuidgen for test1 command: uuidgen run_once: true delegate_to: localhost register: uuid - name: run test1 run_test: name=test1 unique_id="{{ uuid.stdout_lines[0] }}" - name: generate uuidgen for test2 command: uuidgen run_once: true delegate_to: localhost register: uuid - name: run test2 run_test: name=test2 unique_id="{{ uuid.stdout_lines[0] }}" - name: generate uuidgen for test3 command: uuidgen run_once: true delegate_to: localhost register: uuid - name: run test3 run_test: name=test3 unique_id="{{ uuid.stdout_lines[0] }}" But my idea was to simplify it and generate some id directly inside the module (or probably reuse some internal ansible variable), so the final playbook could look like this (and each test will have available unique string common for all hosts): - name: run test1 run_test: name=test1 - name: run test2 run_test: name=test2 - name: run test3 run_test: name=test3 I've tried to use method get_module_path() and parse the first number after ansible-tmp-... in the path (it looks like /root/.ansible/tmp/ansible-tmp-1423668579.15-197746855489444), but it seems like it sometimes vary and it broke the synchronization. Do you have any suggestion how to generate or where to obtain common id for all hosts inside the ansible module (written in python)? Thanks! Daniel -- 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 ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/edda2917-58e5-42e7-ae34-5f774d451969%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.