-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplaybook-prepare-controlhost.yml
50 lines (45 loc) · 1.52 KB
/
playbook-prepare-controlhost.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
---
- name: Configure the control host
hosts:
- control
become: false
tasks:
- name: Install packages
ansible.builtin.package:
state: present
name: [ 'rsync', 'epel-release', 'bash-completion' ]
become: true
- name: Install Ansible
ansible.builtin.package:
state: present
name: ansible
become: true
- name: Ensure .ssh dir is present
ansible.builtin.file:
path: "{{ ansible_facts['user_dir'] }}/.ssh"
state: directory
mode: 0700
- name: Install SSH key files
ansible.builtin.copy:
src: "{{ local_home }}/.ssh/{{ item.filename }}"
dest: "{{ ansible_facts['user_dir'] }}/.ssh/{{ item.filename }}"
mode: "{{ item.mode }}"
vars:
local_home: "{{ lookup('env','HOME') }}"
loop:
- { filename: id_rsa, mode: "0600" }
- { filename: id_rsa.pub, mode: "0644" }
- name: Install collections using ansible-galaxy
ansible.builtin.command: "ansible-galaxy collection install {{ item.namespace }}.{{ item.name }}"
args:
creates: "{{ ansible_facts['user_dir'] }}/.ansible/collections/ansible_collections/{{ item.namespace }}/{{ item.name }}"
loop:
- { namespace: community, name: general }
- { namespace: kubernetes, name: core }
- name: Synchronize mosibi-kubernetes
ansible.posix.synchronize:
src: "{{ playbook_dir }}"
dest: "{{ ansible_facts['user_dir'] }}"
delegate_to: localhost
tags:
- sync