Ansible playbook with serial > 1 and run_once -


i writing simple 2 task ansible playbook download update file internet , push managed servers, similar to:

- hosts:   serial: 10    tasks:   - name: download update file     get_url: url=http://f.q.d.n/path/to/file dest=/tmp/     connection: local     run_once: true    - name: copy update file servers     copy: src=/tmp/file dest=/path/to/file mode="..." 

first task supposed run once on localhost, rest run in 10 serial batches. according ansible documentation, tasks marked "run_once" ran on 1 host in each serial batch.

i can't use workaround mentioned in documentation, using inventory_hostname in conditional, since actual target hosts may different, e.g. restricted --limit etc.
what proper way design playbook? pre_task of use here ?

- hosts: localhost    tasks:   - name: download update file     get_url: url=http://f.q.d.n/path/to/file dest=/tmp/   - hosts:   serial: 10    tasks:   - name: copy update file servers     copy: src=/tmp/file dest=/path/to/file mode="..." 

Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo