3 ms·
How do you manage to "remove" SSH keys. Since sensible is stateless, you probably run once for removing and once for adding a new key.
by drinchev 9y ago
How do you manage to "remove" SSH keys. Since sensible is stateless, you probably run once for removing and once for adding a new key.
- lamby 9y agoNot the OP, but say you were populating a directory of keys, you would simply remove it via file's state=absent and then repopulate.
- janvdberg 9y agoYes, we run it once/only when things (people) change.
- Spivak 9y agoThere are two states that we're talking about. * Ensure that the following key is present. * Ensure that only the following keys are present. You can accomplish the second one with the 'exclusive' flag. http://docs.ansible.com/ansible/authorized_key_module.html http://docs.ansible.com/ansible/authorized_key_module.html
- falcolas 9y agoThere's a third state as well: absent. Move keys from one file to another, and they go from allowed to denyed. That said, I do like the "exclusive" tag too, I just tend to have a few one-off keys laying around as technical debt.
- dkhenry 9y agoYou can have Ansible generate the authorized_keys file from a list of public key files, then when that list changes ansible will detect that the file has changed and will copy over the new file.
- ruffrey 9y agoFor a file, specify state=absent http://docs.ansible.com/ansible/file_module.html http://docs.ansible.com/ansible/file_module.html