-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ansible: refactor known_hosts tasks for github.com
Refactor the Ansible tasks for updating the `known_hosts` file for github.com into its own role. Call that role from both the docker-host and jenkins-worker/create playbooks.
- Loading branch information
1 parent
ddf79d5
commit c3a27df
Showing
7 changed files
with
53 additions
and
27 deletions.
There are no files selected for viewing
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
File renamed without changes.
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
|
||
argument_specs: | ||
main: | ||
short_description: Set up specific to hosts that need to interact with github.com. | ||
options: | ||
user_home_dir: | ||
description: The user's HOME directory. | ||
required: yes | ||
type: str |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
|
||
# Set up hosts to be able to checkout/fetch from github.com. | ||
|
||
- name: create .ssh directory | ||
ansible.builtin.file: | ||
dest: "{{ user_home_dir }}/.ssh" | ||
mode: "0700" | ||
owner: "{{ server_user }}" | ||
group: "{{ server_user }}" | ||
state: directory | ||
|
||
- name: write github.com entry in known_hosts | ||
ansible.builtin.known_hosts: | ||
name: github.com | ||
key: "{{ item }}" | ||
path: "{{ user_home_dir }}/.ssh/known_hosts" | ||
state: present | ||
become: yes | ||
become_user: "{{ server_user }}" | ||
loop: "{{ lookup('file', 'files/github_known_hosts').splitlines() }}" | ||
|
||
- name: remove old github.com ssh keys | ||
ansible.builtin.lineinfile: | ||
path: "{{ user_home_dir }}/.ssh/known_hosts" | ||
search_string: "{{ item }}" | ||
state: absent | ||
become: yes | ||
become_user: "{{ server_user }}" | ||
loop: "{{ lookup('file', 'files/github_bad_hosts').splitlines() }}" |
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
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