Guest User

Untitled

a guest
Oct 22nd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.52 KB | None | 0 0
  1. - name: Use a default SSH key for this playbook
  2. set_fact: ansible_ssh_private_key_file={{ whatever_default_location }}
  3. when: ansible_ssh_private_key_file is not defined
  4.  
  5. ---
  6.  
  7. - hosts: localhost
  8. tasks:
  9. - set_fact: ansible_skip_tags={{ ansible_skip_tags + ['foo'] }}
  10. - debug: msg="Foo"
  11. tags:
  12. - foo
  13.  
  14. PLAY [localhost] ******************************************************************************************************************************************************************************************************************************
  15.  
  16. TASK [Gathering Facts] ************************************************************************************************************************************************************************************************************************
  17. ok: [localhost]
  18.  
  19. TASK [set_fact] *******************************************************************************************************************************************************************************************************************************
  20. ok: [localhost]
  21.  
  22. TASK [debug] **********************************************************************************************************************************************************************************************************************************
  23. ok: [localhost] => {
  24. "msg": "Foo"
  25. }
  26.  
  27. PLAY RECAP ************************************************************************************************************************************************************************************************************************************
  28. localhost : ok=3 changed=0 unreachable=0 failed=0
  29.  
  30. PLAY [localhost] ******************************************************************************************************************************************************************************************************************************
  31.  
  32. TASK [Gathering Facts] ************************************************************************************************************************************************************************************************************************
  33. ok: [localhost]
  34.  
  35. TASK [set_fact] *******************************************************************************************************************************************************************************************************************************
  36. ok: [localhost]
  37.  
  38. PLAY RECAP ************************************************************************************************************************************************************************************************************************************
  39. localhost : ok=2 changed=0 unreachable=0 failed=0
  40.  
  41. ---
  42.  
  43. - hosts: localhost
  44. connection: local
  45. gather_facts: false
  46. tasks:
  47. - set_fact: ansible_skip_tags="{{ ansible_skip_tags }} + ['foo']"
  48. - debug: var=ansible_skip_tags
  49.  
  50. $ ansible-playbook -i "localhost," test.yml --skip-tags=bar -v
  51.  
  52.  
  53. PLAY [localhost] ********************************************************************
  54.  
  55. TASK [set_fact] *********************************************************************
  56. ok: [localhost] => {"ansible_facts": {"ansible_skip_tags": ["bar", "foo"]}, "changed": false}
  57.  
  58. TASK [debug] ************************************************************************
  59. ok: [localhost] => {
  60. "ansible_skip_tags": [
  61. "bar"
  62. ]
  63. }
  64.  
  65. PLAY RECAP **************************************************************************
  66. localhost : ok=2 changed=0 unreachable=0 failed=0
Add Comment
Please, Sign In to add comment