Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - name: compile
- hosts: localhost
- gather_facts: false
- tasks:
- - name: compile binary
- local_action: command make build FOO=foo1
- - name: compile binary
- local_action: command make build FOO=foo1
- when: (inventory_hostname != "bar-1") and (inventory_hostname != "bar-2")
- - name: compile binary
- local_action: command make build FOO=bar1
- when: (inventory_hostname == "bar-1") or (inventory_hostname == "bar-2")
- [foos]
- foo-1 ...
- foo-2 ...
- [bars]
- bar-1 ...
- bar-2 ...
- ansible-playbook -i provision/hosts -l localhost,bars provision/deploy.yml
- shell: echo {{ inventory_hostname }}
- run_once: true
- delegate_to: localhost
- when: "'bars' in group_names"
- ---
- - hosts: localhost,test-server
- gather_facts: no
- tasks:
- - shell: echo {{ inventory_hostname }}
- delegate_to: localhost
Add Comment
Please, Sign In to add comment