remove comments from keyfile

This commit is contained in:
2022-02-20 02:04:54 +01:00
parent 3699b1d728
commit cb8ebc37d1
2 changed files with 36 additions and 20 deletions

View File

@@ -16,8 +16,11 @@
- public_keys/yubikey.pub
- name: users | rene | install private ssh keys
block:
- name: users | rene | cat block into keyfile
blockinfile:
dest: "/home/rene/.ssh/{{ item.dest }}"
state: present
create: true
block: |
{{ lookup('file',item.src) }}
@@ -26,6 +29,11 @@
mode: '0600'
marker_begin: ""
marker_end: ""
- name: users | rene | remove ansible comments from keyfile
lineinfile:
path: "home/rene/.ssh/{{ item.dest }}"
state: absent
line: "# ANSIBLE MANAGED BLOCK" # not required. The line to insert/replace into the file. Required for C(state=present). If C(backrefs) is set, may contain backreferences that will get expanded with the C(regexp) capture groups if the regexp matches.
loop:
- {src: private_keys/gitlab_read_ed25519, dest: gitlab_read_ed25519}
# - private_keys/id_dsa

View File

@@ -25,8 +25,11 @@
- public_keys/backup_ed25519.pub
- name: users | root | install private ssh keys
block:
- name: users | root | cat block into keyfile
blockinfile:
dest: "/root/.ssh/{{ item.dest }}"
state: present
create: true
block: |
{{ lookup('file',item.src) }}
@@ -35,6 +38,11 @@
mode: '0600'
marker_begin: ""
marker_end: ""
- name: users | root | remove ansible comments from keyfile
lineinfile:
path: "/root/.ssh/{{ item.dest }}"
state: absent
line: "# ANSIBLE MANAGED BLOCK"
loop:
- {src: private_keys/gitlab_read_ed25519, dest: gitlab_read_ed25519}