Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cat inventory.yml
- all:
- children:
- group1:
- children:
- subgroup1:
- hosts:
- 172.16.228.133
- 172.16.228.135
- cat deploy_ssh.yml
- ---
- - hosts: subgroup1
- become: true
- become_user: "root"
- tasks:
- - authorized_key:
- user: root
- state: present
- manage_dir: yes
- key: "{{ lookup('file', '/home/user/.ssh/ans_id_rsa.pub') }}"
- sudo ansible-playbook -i inventory.yml deploy_ssh.yml --ask-become-pass --ask-pass -u user
- [sudo] password for user:
- SSH password:
- SUDO password[defaults to SSH password]:
- PLAY [case1] *******************************************************************************************************************************************************************************************************************************
- TASK [Gathering Facts] *********************************************************************************************************************************************************************************************************************
- ok: [172.16.228.133 172.16.228.135]
- TASK [authorized_key] **********************************************************************************************************************************************************************************************************************
- ok: [172.16.228.133 172.16.228.135]
- PLAY RECAP *********************************************************************************************************************************************************************************************************************************
- 172.16.228.133 172.16.228.135 : ok=2 changed=0 unreachable=0 failed=0
- ansible correctly wrote my pubkey on .133 but seems to ignore .135
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement