Initial commit
This commit is contained in:
commit
7e029a0d33
22 changed files with 598 additions and 0 deletions
39
tasks/known_hosts.yml
Normal file
39
tasks/known_hosts.yml
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
- name: load OS specific vars
|
||||
include_vars: "{{ item }}"
|
||||
with_first_found:
|
||||
- files:
|
||||
- "{{ ansible_distribution|lower }}-{{ ansible_distribution_release|lower }}.yml"
|
||||
- "{{ ansible_distribution|lower }}.yml"
|
||||
- "{{ ansible_os_family|lower }}.yml"
|
||||
paths:
|
||||
- "{{ role_path }}/vars"
|
||||
|
||||
- name: install packages
|
||||
become: yes
|
||||
package:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
loop: "{{ known_hosts_packages }}"
|
||||
|
||||
- name: retrieve user $HOME
|
||||
shell: "echo $HOME" # noqa 301
|
||||
become_user: "{{ user }}"
|
||||
register: home_stats
|
||||
|
||||
- name: set user $HOME
|
||||
set_fact:
|
||||
user_home: "{{ home_stats.stdout }}"
|
||||
|
||||
- name: create local ssh directory
|
||||
become_user: "{{ user }}"
|
||||
file:
|
||||
path: "{{ user_home }}/.ssh"
|
||||
state: directory
|
||||
mode: "0755"
|
||||
|
||||
- name: add items to known hosts
|
||||
become_user: "{{ user }}"
|
||||
known_hosts:
|
||||
name: "{{ item.domain }}"
|
||||
key: "{{ item.key }}"
|
||||
loop: "{{ items }}"
|
||||
Reference in a new issue