Advertisement
Guest User

Untitled

a guest
Mar 19th, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. cat inventory.yml
  2. all:
  3. children:
  4. group1:
  5. children:
  6. subgroup1:
  7. hosts:
  8. 172.16.228.133
  9. 172.16.228.135
  10.  
  11. cat deploy_ssh.yml
  12. ---
  13. - hosts: subgroup1
  14. become: true
  15. become_user: "root"
  16. tasks:
  17. - authorized_key:
  18. user: root
  19. state: present
  20. manage_dir: yes
  21. key: "{{ lookup('file', '/home/user/.ssh/ans_id_rsa.pub') }}"
  22.  
  23. sudo ansible-playbook -i inventory.yml deploy_ssh.yml --ask-become-pass --ask-pass -u user
  24. [sudo] password for user:
  25. SSH password:
  26. SUDO password[defaults to SSH password]:
  27.  
  28. PLAY [case1] *******************************************************************************************************************************************************************************************************************************
  29.  
  30. TASK [Gathering Facts] *********************************************************************************************************************************************************************************************************************
  31. ok: [172.16.228.133 172.16.228.135]
  32.  
  33. TASK [authorized_key] **********************************************************************************************************************************************************************************************************************
  34. ok: [172.16.228.133 172.16.228.135]
  35.  
  36. PLAY RECAP *********************************************************************************************************************************************************************************************************************************
  37. 172.16.228.133 172.16.228.135 : ok=2 changed=0 unreachable=0 failed=0
  38.  
  39. ansible correctly wrote my pubkey on .133 but seems to ignore .135
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement