Guest User

Untitled

a guest
Jan 17th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. Simple Ansible test setup
  2. =========================
  3.  
  4. ## Execute on localhost
  5.  
  6. If the tasks are simple enough and/or non-invasive.
  7.  
  8. $ ansible -c local -i localhost, -m ping all
  9. localhost | SUCCESS => {
  10. "changed": false,
  11. "failed": false,
  12. "ping": "pong"
  13. }
  14.  
  15. $ ansible-playbook -c local -i localhost, test.yml
  16.  
  17. PLAY [all] *******************************************************************
  18.  
  19. TASK [Gathering Facts] *******************************************************
  20. ok: [localhost]
  21.  
  22. TASK [Sample task 1] *********************************************************
  23. changed: [localhost]
  24.  
  25. TASK [Sample task 2] *********************************************************
  26. changed: [localhost]
  27.  
  28. PLAY RECAP *******************************************************************
  29. localhost : ok=3 changed=2 unreachable=0 failed=0
  30.  
  31.  
  32. ## Execute on remote host
  33.  
  34. $ vagrant up
  35.  
  36. $ vagrant snapshot save init
  37.  
  38. $ ansible -i ./inventory -m ping all
  39. ubuntu16.04-x86_64 | SUCCESS => {
  40. "changed": false,
  41. "failed": false,
  42. "ping": "pong"
  43. }
  44.  
  45. $ ansible-playbook -i ./inventory test.yml
  46.  
  47. PLAY [all] *******************************************************************
  48.  
  49. TASK [Gathering Facts] *******************************************************
  50. ok: [ubuntu16.04-x86_64]
  51.  
  52. TASK [Sample task 1] *********************************************************
  53. changed: [ubuntu16.04-x86_64]
  54.  
  55. TASK [Sample task 2] *********************************************************
  56. changed: [ubuntu16.04-x86_64]
  57.  
  58. PLAY RECAP *******************************************************************
  59. ubuntu16.04-x86_64 : ok=3 changed=2 unreachable=0 failed=0
  60.  
  61. $ vagrant snapshot restore init
Add Comment
Please, Sign In to add comment