From d4873c27a84a8e4d5ea8991164c7bea4587df461 Mon Sep 17 00:00:00 2001 From: mg Date: Fri, 28 Jan 2022 16:49:15 +0100 Subject: [PATCH] Nacharbeiten: ssh-key Wechsel (#321) Co-authored-by: Michael Grote Reviewed-on: https://git.mgrote.net/mg/ansible/pulls/321 Co-authored-by: mg Co-committed-by: mg --- .remote-sync.json | 4 ++-- playbooks/on-off/new_ssh_key | 1 + playbooks/on-off/remove_old_ssh_key.yml | 12 ++++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 playbooks/on-off/new_ssh_key create mode 100644 playbooks/on-off/remove_old_ssh_key.yml diff --git a/.remote-sync.json b/.remote-sync.json index 8f252b61..e43df73d 100644 --- a/.remote-sync.json +++ b/.remote-sync.json @@ -9,7 +9,7 @@ ".git/**" ], "username": "mg", - "keyfile": "C:\\Users\\mg\\Desktop\\NextCloud\\Rest\\ssh-keys\\ssh_key_heimserver_mg.ppk", + "keyfile": "C:\\Users\\mg\\Desktop\\NextCloud\\Rest\\ssh-keys\\ssh_key_heimserver_mg2.ppk", "transport": "scp", "watch": [] -} \ No newline at end of file +} diff --git a/playbooks/on-off/new_ssh_key b/playbooks/on-off/new_ssh_key new file mode 100644 index 00000000..af59f2c1 --- /dev/null +++ b/playbooks/on-off/new_ssh_key @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC0NNNWRq4BnKgh17P6VSLRztuPzEMUB7X4g/ft75j/EvwIP6yuPvvvtgPlewxA8C8c2ztc0VpsyEFxXgDrKGD+VxeU41CjTNr8ccbZenyaePmJxZEsgzZ0ujaCE6hiFYJoMlHhkT3EhDhS1UMfWsEdhiDo8wwU3b6KnwRnqFq+Kc6iSceBn5tl7KxUlxqoM1pjBHTl27Vcq5z2Qw5cLQsQdGT+881gJHoc2U+DjPSuk8w2hKcOqagOwa9IBSuy8GF5u27LVwcwV31KHNSFHz/52pgfgyfpf/AucbVvYIB36paNbvrcnrod7tFJeN5GnNrqX8/wV1OodFsDoc8ZulXQnol/vvBW/p5C98POvjQqptGvo0HMvUjvMrB77phdk/r8cQ30Ry2IcttiTGpM2tKbv5HBNoFntWSX1Tv1J3tovI7qDtipSiCvpc4M9jkj5KB61FRUy7V3S3l9hdjLooL4793EwUsm2Zijgq629f4EkCLCSAepJziF02N+WCzbftMEN5wybZKWUhJjjFV7or0irjEbxImw8NkTZiM485MD1OSzug4DGvFbQGm4fQx531YpbmLyf4og+mC3n79E4IizHP1bkPbpb1EHRG7fsUkt/KtW/bg4OUhphPc1PTNexQFr5Kmn2JuIEnRLtqeyPpe55KQHHoTJ/ZdvqvpKClNjCQ== mg@irantu diff --git a/playbooks/on-off/remove_old_ssh_key.yml b/playbooks/on-off/remove_old_ssh_key.yml new file mode 100644 index 00000000..a5a863a1 --- /dev/null +++ b/playbooks/on-off/remove_old_ssh_key.yml @@ -0,0 +1,12 @@ +--- +- hosts: all + become: yes + + tasks: + - name: Set authorized key taken from file + become: yes + ansible.posix.authorized_key: + user: mg + state: present + key: "{{ lookup('file', '/home/mg/ansible/playbooks/on-off/new_ssh_key') }}" + exclusive: true #entferne alle keys bis auf diesen