I am new to using Ansible and read google here and haven't found an answer yet.
My scenario is that I have 1 user on the server, but 2-3 different pub keys that need to insert an authorized_keys file.
I can successfully delete all keys or add all keys using this script:
- hosts: all
tasks:
- name: update SSH keys
authorized_key:
user: <user>
key: "{{ lookup('file', item) }}"
state: present
with_fileglob:
- ../files/pub_keys
With the flag, presenthe reads and adds all the keys. With a flag, absentit deletes all the keys listed.
The problem is that I have an old key that is only on the server, and I want to delete / rewrite it, and for future deployments, overwrite any unauthorized keys that may be on the server, and not in my book.
exclusive . , . Ansible , .
pub exclusive ?