mirror of
https://github.com/CPunch/openpunk-ansible.git
synced 2024-11-22 07:20:05 +00:00
roles/git: ssh known_hosts is now idempotent
- roles/git now uses blockinfile to ensure the github ssh keypairs are trusted, and to allow subsequent ssh keypairs to be trusted and not overwritten by future runs. - this commit marks idempotency for all roles. after a successful run of this playbook, subsequent runs will result in a change=0 !!!!!
This commit is contained in:
parent
3d75ac18e7
commit
e8fe024b77
@ -9,21 +9,22 @@
|
|||||||
# make sure our vps trusts the github.com key signature. we pipe the output
|
# make sure our vps trusts the github.com key signature. we pipe the output
|
||||||
# of ssh-keyscan into .ssh/known_hosts
|
# of ssh-keyscan into .ssh/known_hosts
|
||||||
|
|
||||||
# TODO: make idempotent
|
|
||||||
- name: Scan for SSH host keys
|
- name: Scan for SSH host keys
|
||||||
command: ssh-keyscan github.com 2>/dev/null
|
command: ssh-keyscan github.com 2>/dev/null
|
||||||
register: ssh_scan
|
register: ssh_scan
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
- name: Update known_hosts
|
- name: Update .ssh/known_hosts
|
||||||
copy:
|
blockinfile:
|
||||||
content: "{{ ssh_scan.stdout_lines|join('\n') }}"
|
path: /root/.ssh/known_hosts
|
||||||
dest: /root/.ssh/known_hosts
|
block: "{{ ssh_scan.stdout_lines|join('\n') }}"
|
||||||
|
insertbefore: BOF
|
||||||
|
create: yes
|
||||||
owner: root
|
owner: root
|
||||||
mode: u=rw,g=,o=
|
mode: u=rw,g=,o=
|
||||||
force: no # if we already have a known_hosts file, ignore!
|
|
||||||
|
|
||||||
# this keypair is trusted under my github account, so it allows my vps to make pushes
|
# this keypair is trusted under my github account, so it allows my vps to make pushes
|
||||||
# to the main branch of my openpunk repository. (for my deadswitch: see static/blog/imdead.sh)
|
# to the main branch of my openpunk repository. (see roles/deadswitchfiles/imdead.sh)
|
||||||
|
|
||||||
- name: Install ssh priv key
|
- name: Install ssh priv key
|
||||||
copy:
|
copy:
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
- name: Check if Gitea is installed
|
- name: Check if Gitea is installed
|
||||||
shell: gitea --version
|
shell: gitea --version
|
||||||
register: validate_gitea
|
register: validate_gitea
|
||||||
changed_when: false
|
changed_when: no
|
||||||
|
|
||||||
- name: Add Gitea key && repository
|
- name: Add Gitea key && repository
|
||||||
block:
|
block:
|
||||||
|
Loading…
Reference in New Issue
Block a user