forked from redhat-cop/agnosticd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpre_software.yml
107 lines (100 loc) · 2.64 KB
/
pre_software.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
---
- name: Step 003 - Pre Software
hosts: localhost
connection: local
gather_facts: false
become: false
tags:
- step003
tasks:
- debug:
msg: "Step 003 - Pre Software"
- name: Configure all hosts with repositories, common files and set environment key
hosts:
- all:!windows
become: true
gather_facts: false
tags:
- step003
- common_tasks
roles:
- role: set-repositories
when: repo_method is defined
- role: common
when: install_common | bool
- role: set_env_authorized_key
when: set_env_authorized_key | bool
tasks:
- name: Add GUID to /etc/skel/.bashrc
lineinfile:
path: "/etc/skel/.bashrc"
regexp: "^export GUID"
line: "export GUID={{ guid }}"
- name: Step 003.1 - Configuring Bastion Hosts
hosts: bastions
become: true
roles:
- role: bastion-lite
when: install_bastion | bool
- role: bastion-student-user
when: install_student_user | bool
tags:
- step003.1
- bastion_tasks
tasks:
- name: Setup Student SSH Key
when:
- install_student_user | bool
- student_name is defined
- env_authorized_key is defined
block:
- name: Copy SSH private key to student user .ssh directory
copy:
src: "/root/.ssh/{{ env_authorized_key }}.pem"
dest: "~{{ student_name }}/.ssh/{{ env_authorized_key }}.pem"
mode: u=rw,go=
owner: "{{ student_name }}"
remote_src: true
- name: Copy SSH public key to student user .ssh directory
copy:
src: "/root/.ssh/{{ env_authorized_key }}.pub"
dest: "~{{ student_name }}/.ssh/{{ env_authorized_key }}.pub"
mode: u=rw,go=
owner: "{{ student_name }}"
remote_src: true
- name: Copy SSH config to student user .ssh directory
copy:
src: "/root/.ssh/config"
dest: "~{{ student_name }}/.ssh/config"
mode: u=rw,go=
owner: "{{ student_name }}"
remote_src: true
- name: Create a Python3 VirtualEnv for use in the k8s Ansible tasks
hosts: bastions
gather_facts: false
become: true
tasks:
- name: Setup k8s virtualenv
include_role:
name: host_virtualenv
vars:
host_virtualenv_path: /opt/virtualenvs/k8s
# Merge base k8s requirements with cloud provider specific requirements
host_virtualenv_requirements:
- requirements_k8s.txt
- requirements_{{ cloud_provider }}.txt
- name: Install git
package:
state: present
name:
- git
- name: PreSoftware flight-check
hosts: localhost
connection: local
gather_facts: false
become: false
tags:
- flight_check
tasks:
- debug:
msg: "Pre-Software checks completed successfully"