I want to add some new pub keys, when use the
authorized_key
- name: add key authorized_key: user: "{{ user if user is defined else 'ubuntu' }}" state: present key: '{{ item }}' exclusive: no # comment: "test add comment from playbook" with_file: - public-keys/test-add.pub - public-keys/test-add-doge.pub
and the files:
roles/add-ssh-key/files/ └── public-keys ├── test-add-doge.pub └── test-add.pub 1 directory, 2 files
after I executed the playbook
ansible-playbook add.yml
~/.ssh/authorized_keys
test-add.pub
test-add-doge.pub
So how can I keep original records without overwriting?
Anonymous Asked question May 14, 2021
Recent Comments