Ansible: Change SSH key -
i have inventory of multiple servers. ssh access these servers secured using pem key files. periodically change pem key used servers. so, use ansible following: generate new pem key file for each server in inventory, connect server using old pem key file install new pem key file test ensure ssh new key works , old key does not work what best way via ansible? you should split in 3 playbooks. the first generate new pem key. run locally. see: https://docs.ansible.com/ansible/playbooks_delegation.html#local-playbooks the second 1 rollout. copies key servers. can use authorized_key or copy depending on preferred workflow is. thats question. the third step testing playbook, maybe assert statement or using ping ensure connection works. when have playbooks combine them in single include or add 3 plays in 1 playbook in right order. see: https://docs.ansible.com/ansible/playbooks_intro.html