Advertisement
Guest User

Untitled

a guest
Sep 27th, 2018
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.68 KB | None | 0 0
  1. inventory file:
  2.  
  3. [usr@host automation]# cat inventory
  4. [nsm-064-1]
  5. 10.1.242.11 ansible_user=nsm csa_id=22222 ansible_ssh_pass=12345
  6.  
  7. ------------
  8. Playbook
  9.  
  10. [user@hostautomation]# cat playbooks/t.yml
  11. ---
  12.   - hosts: all
  13.     gather_facts: True
  14.     become: True
  15.     debugger: always
  16.     vars:
  17.  
  18.     tasks:
  19.  
  20.       - debug:
  21.           msg: "csa_id: {{csa_id}}"
  22.  
  23. ------------
  24. Run Output
  25.  
  26. [user@hostautomation]# ansible-playbook -i inventory --key-file /root/.ssh/id_rsa --limit nsm-064-1 playbooks/t.yml
  27.  
  28. PLAY [all] **********************************************************************************************************************************************************************************************************************************
  29.  
  30. TASK [Gathering Facts] **********************************************************************************************************************************************************************************************************************
  31. ok: [10.1.242.11]
  32. [10.1.242.11] TASK: Gathering Facts (debug)> c
  33.  
  34. TASK [debug] ********************************************************************************************************************************************************************************************************************************
  35. ok: [10.1.242.11] => {
  36.     "msg": "csa_id: 52"
  37. }
  38. [10.1.242.11] TASK: debug (debug)> c
  39.  
  40. PLAY RECAP **********************************************************************************************************************************************************************************************************************************
  41. 10.1.242.11                : ok=2    changed=0    unreachable=0    failed=0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement