I'm trying to use the approach described here https://github.com/ansible/ansible/issues/12170 to get part of a role to run serially. I am on 2.1.2.0, but have also tried 2.1.1.0 and 2.0.2.0.
- include: do_deploy.yml with_items: "{{ play_hosts }}" delegate_to: "{{ item }}" run_once: true do_deploy.yml simply contains - debug: msg="{{ item }}" The role is being run from a playbook where hosts contains two hosts. I'd like this code to include do_deploy.yml once per host, and delegate each include to the host it's currently iterating over. I'm seeing this TASK [deploy : include] ******************************************************* included: /home/stig/ansible/roles/deploy/tasks/do_deploy.yml for host1 included: /home/stig/ansible/roles/deploy/tasks/do_deploy.yml for host1 TASK [deploy : debug] ********************************************************* ok: [host1 -> None] => { "msg": "host1" } TASK [deploy : debug] ********************************************************* ok: [host1 -> None] => { "msg": "host2" } while I'd expect to see this TASK [deploy : include] ******************************************************* included: /home/stig/ansible/roles/deploy/tasks/do_deploy.yml for host1 included: /home/stig/ansible/roles/deploy/tasks/do_deploy.yml for host2 TASK [deploy : debug] ********************************************************* ok: [host1 -> None] => { "msg": "host1" } TASK [deploy : debug] ********************************************************* ok: [host2 -> None] => { "msg": "host2" } Basically run_once seems to be acting like delegate_to isn't being used. Am I misusing delegate_to, or is there some other way to fake serial: 1 for an include? -- 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/07afeafa-d67d-48e3-9060-263fd147b8bd%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.