workstation/roles/home-cli/tasks/ssh.yml

52 lines
2.7 KiB
YAML
Raw Permalink Normal View History

2019-10-05 19:33:23 +00:00
---
2023-01-21 19:42:51 +00:00
# Copyright 2021-2023 Anthony Perkins
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Copy default ssh config
ansible.builtin.copy:
src: ssh_config
dest: "{{ ansible_env.HOME }}/.ssh/config"
mode: '0600'
backup: yes
2023-02-15 15:50:56 +00:00
- name: Remove old home rsa key from authorized_keys
ansible.builtin.lineinfile:
path: "{{ ansible_env.HOME }}/.ssh/authorized_keys"
2023-02-15 15:50:56 +00:00
regexp: "{{ 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDUfTUp1m8MUCjj0Vu8E9sVGwvf4FWL4QcaZ6m8gK5+xGZl+w+yAcb1acH/96Y0DaP4ZNDassC5OlE6F1oJ+cIKtTykXBxqlChLRDCdX8JCt3sBaVmEcRJ0v8MMQrqWX2ajAW6fC/zNYJ4qbhTMGLiEUPbYu7gZKn0e+MEPBRrxdXzqVLTBq0RMelGx74UpZUwzwROq+VxLsFrumFZNFNJL+rWEK3XO5SsQkNp5QNYluIr8+WDbVU6V2thgJTcFpWWWYVg/al5iY5/bcnVSpzoab7Xxo98OYzpSrY0g+CqkLQkfRehOUMeEOGQYZxpUaXFhg2jE+Kf7W2gm3CeJWTzP' | regex_escape() }}"
mode: '0600'
2023-02-15 15:50:56 +00:00
state: absent
- name: Remove old work rsa key from authorized_keys
ansible.builtin.lineinfile:
path: "{{ ansible_env.HOME }}/.ssh/authorized_keys"
2023-02-15 15:50:56 +00:00
regexp: "{{ 'ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAjRPqXzNlrmPWGC6yRCnZszewblS6JcQeNBkHuNmWD9WoMFGLvjkl+NGiC01k9su4JMfz6vOvNG1A6J16+uhEz0+Q70Z/kCM91EqYK8iiGA+qfC2y5PMA10BtWInQ9OqPbanv38ZBB7+afOcEbGR3CC56rp/uibwdBo2RpVRjAjZfsC64tZ6Pt8C55rVvBeZwNtXtw9RIwKAJGmlBsZEdIKpTHIf2IDfPWX3OLahcNA5/6aNB65qQV7fqQXEgBSjJmMsdCD8Jy5O+f7rzC+kFxozB/36mV1pBgZhT/iTK9fFJip0vyFFjk4CPRRbrnnJUBod/aGfWAP876b/0DXviWQ==' | regex_escape() }}"
mode: '0600'
2023-02-15 15:50:56 +00:00
state: absent
2020-12-07 09:31:58 +00:00
- name: Add home ed25519 key to authorized_keys
2021-02-19 20:32:22 +00:00
ansible.builtin.lineinfile:
2020-12-07 09:31:58 +00:00
path: "{{ ansible_env.HOME }}/.ssh/authorized_keys"
line: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKG63aHe1QmTPj4mWg0F/fAzcB78tBJglxyLI0AzOKvW acp-home"
create: yes
mode: '0600'
2023-02-15 15:50:56 +00:00
- name: Remove old work ed25519 key from authorized_keys
ansible.builtin.lineinfile:
path: "{{ ansible_env.HOME }}/.ssh/authorized_keys"
2023-02-15 15:50:56 +00:00
regexp: "{{ 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMMMawkF2TJzmqHewciwMRhOOTE9W1+vXq1yzV13KWUg' | regex_escape() }}"
mode: '0600'
2023-02-15 15:50:56 +00:00
state: absent
2023-04-12 16:28:44 +00:00
- name: Add work ed25519 key to authorized_keys
ansible.builtin.lineinfile:
path: "{{ ansible_env.HOME }}/.ssh/authorized_keys"
line: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJV4Cddvb/D2/LDQc6HyG6kaW9XIGHYysGBebDlklclM acp-work"
create: yes
mode: '0600'