ansible/ansible-modules-core — pull request #42 by kustodian (2014-09-29 23:08:27+00:00)
Title: Added 'clear_keys' parameter to the authorized_key module

Added a new `clear_keys` parameter to the `authorized_keys` module which if it is set to yes (default: no), clears all keys from the authorized_keys file before adding a new key.

This parameter could be useful if you would like to be sure that the user's authorized_keys file only has the key(s) you would like it to have and no other. Because the `authorized_keys` module appends new keys and only deletes those whose state is put as `absent`, so it was very hard to delete other keys which were not set by Ansible. `clear_keys=yes` could be an easy and fast solution for clearing all unneeded keys.