Guest User

Untitled

a guest
Dec 11th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. - name: compile
  2. hosts: localhost
  3. gather_facts: false
  4. tasks:
  5. - name: compile binary
  6. local_action: command make build FOO=foo1
  7.  
  8. - name: compile binary
  9. local_action: command make build FOO=foo1
  10. when: (inventory_hostname != "bar-1") and (inventory_hostname != "bar-2")
  11. - name: compile binary
  12. local_action: command make build FOO=bar1
  13. when: (inventory_hostname == "bar-1") or (inventory_hostname == "bar-2")
  14.  
  15. [foos]
  16. foo-1 ...
  17. foo-2 ...
  18.  
  19. [bars]
  20. bar-1 ...
  21. bar-2 ...
  22.  
  23. ansible-playbook -i provision/hosts -l localhost,bars provision/deploy.yml
  24.  
  25. shell: echo {{ inventory_hostname }}
  26. run_once: true
  27. delegate_to: localhost
  28. when: "'bars' in group_names"
  29.  
  30. ---
  31. - hosts: localhost,test-server
  32. gather_facts: no
  33. tasks:
  34. - shell: echo {{ inventory_hostname }}
  35. delegate_to: localhost
Add Comment
Please, Sign In to add comment