Created
November 12, 2015 23:16
-
-
Save juliedavila/adb8e6f4b3dc099ff905 to your computer and use it in GitHub Desktop.
key rotation for autologic_users
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Move original key | |
command: mv files/sshkeys/{{item.value.username}}.priv files/sshkeys/{{item.value.username}}.priv.last | |
args: | |
removes: files/sshkeys/{{item.value.username}}.priv | |
delegate_to: localhost | |
with_dict: autologic_system_users | |
run_once: yes | |
when: rotate | |
- name: Move old pub key | |
command: mv files/sshkeys/{{item.value.username}} files/sshkeys/{{item.value.username}}.pub.last | |
delegate_to: localhost | |
with_dict: autologic_system_users | |
run_once: yes | |
when: rotate | |
- name: Generate New Keys | |
command: ssh-keygen -t rsa -N "" -f files/sshkeys/{{item.value.username}} | |
delegate_to: localhost | |
with_dict: autologic_system_users | |
run_once: yes | |
when: rotate | |
- name: Rename priv key | |
command: mv files/sshkeys/{{item.value.username}} files/sshkeys/{{item.value.username}}.priv | |
delegate_to: localhost | |
with_dict: autologic_system_users | |
run_once: yes | |
when: rotate | |
- name: Rename Pub key | |
command: mv files/sshkeys/{{item.value.username}}.pub files/sshkeys/{{item.value.username}} | |
delegate_to: localhost | |
with_dict: autologic_system_users | |
when: rotate | |
run_once: yes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment