-
Notifications
You must be signed in to change notification settings - Fork 5
/
bastion_setup.yml
86 lines (71 loc) · 1.93 KB
/
bastion_setup.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
---
- name: Setup bastion host
hosts: bastion_grp
connection: local
become: yes
gather_facts: yes
vars_files:
- vault.yml
vars:
httpd_port: 8080
https_ports:
- 8443
timesync_ntp_provider: chrony
tasks:
- name: Pip install
pip:
name: "{{item}}"
extra_args: "--no-index --find-links {{pip_path}}"
delegate_to: localhost
run_once: true
loop:
- pyvmomi
- name: Setup local yum repo
include_role:
name: "{{outer_item}}"
loop:
- yum-repo
- yum-conf
loop_control:
loop_var: outer_item
when: yum_repos is defined and yum_conf is defined
- name: Running role
include_role:
name: "{{ outer_item }}"
loop:
- common
- apache
- rhel-system-roles.timesync
loop_control:
loop_var: outer_item
- block:
- name: Setup registry
include_role:
name: registry
- name: b64encode registry authentication string
set_fact:
password_string: "{{registry_username + ':' + registry_password }}"
- name: Create authentication json string
set_fact:
auth_file_content:
auths: '{ "{{ registry_server }}": {"auth": "{{ password_string | b64encode }}"} }'
- name: "Save credentials to {{podman_auth_file}}"
copy:
content: "{{auth_file_content | to_nice_json}}"
dest: "{{podman_auth_file}}"
- name: Podman login to registry
command: podman login --authfile {{podman_auth_file}} {{registry_server}}
when: setup_registry
- name: Setup haproxy
include_role:
name: haproxy
when: setup_haproxy
- name: Install packages for bastion
yum:
name: "{{item}}"
state: latest
loop:
- podman
- skopeo
- buildah
- genisoimage