commit | author | age
|
07c98c
|
1 |
--- |
WK |
2 |
- name: Step 00xxxxx software |
|
3 |
hosts: localhost |
|
4 |
gather_facts: False |
|
5 |
become: false |
|
6 |
vars_files: |
|
7 |
- "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" |
|
8 |
- "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" |
|
9 |
tasks: |
|
10 |
- debug: |
|
11 |
msg: "Software tasks started" |
|
12 |
|
|
13 |
- name: Preflight Checks |
|
14 |
hosts: localhost |
|
15 |
tasks: |
|
16 |
- name: Validate Required Group Configuration |
|
17 |
fail: |
|
18 |
msg: "'database', 'redis' and 'quay_enterprise' groups must be specified" |
|
19 |
when: |
|
20 |
- "'redis' not in groups or groups['redis']| length == 0 or 'database' not in groups or groups['database']| length == 0 or 'quay_enterprise' not in groups or groups['quay_enterprise']| length == 0" |
|
21 |
|
|
22 |
- name: Set up Node Software (Docker) |
|
23 |
hosts: bastions |
|
24 |
gather_facts: false |
|
25 |
become: true |
|
26 |
vars_files: |
|
27 |
- "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" |
|
28 |
- "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" |
|
29 |
roles: |
1aed44
|
30 |
- ../../roles/host-ocp-node |
07c98c
|
31 |
|
WK |
32 |
- name: Install and Configure Database |
|
33 |
hosts: database |
|
34 |
gather_facts: false |
|
35 |
become: true |
|
36 |
vars_files: |
|
37 |
- "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" |
|
38 |
- "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" |
|
39 |
tasks: |
|
40 |
- name: Install MySQL |
|
41 |
include_role: |
|
42 |
name: ../../roles/config-mysql |
|
43 |
vars: |
|
44 |
mode: containerized |
|
45 |
mysql_username: "{{ database_username }}" |
|
46 |
mysql_password: "{{ database_password }}" |
|
47 |
mysql_root_username: "{{ database_admin_username }}" |
|
48 |
mysql_root_password: "{{ database_admin_password }}" |
|
49 |
mysql_database: "{{ database_name }}" |
|
50 |
when: database_type == "mysql" |
|
51 |
|
|
52 |
- name: Install and Configure PostgreSQL |
|
53 |
block: |
|
54 |
- name: Install PostgreSQL |
|
55 |
include_role: |
|
56 |
name: ../../roles/config-postgresql |
|
57 |
vars: |
|
58 |
mode: containerized |
|
59 |
postgresql_username: "{{ database_username }}" |
|
60 |
postgresql_password: "{{ database_password }}" |
|
61 |
postgresql_admin_user: "{{ database_admin_username }}" |
|
62 |
postgresql_admin_password: "{{ database_admin_password }}" |
|
63 |
postgresql_database: "{{ database_name }}" |
|
64 |
|
|
65 |
- name: Flush Handlers |
|
66 |
meta: flush_handlers |
|
67 |
|
|
68 |
- name: Locate PostgreSQL Container |
|
69 |
command: docker ps --filter=name=postgresql.service -q |
|
70 |
register: postgresql_container |
|
71 |
|
|
72 |
- name: Sleep to give PostgreSQL a chance to finish starting up |
|
73 |
pause: |
|
74 |
seconds: 10 |
|
75 |
|
|
76 |
- name: Configure PostgreSQL |
|
77 |
shell: docker exec -i {{ postgresql_container.stdout }} /bin/bash -c 'PGPASSWORD={{ database_admin_password }} psql {{ database_name }} -c "CREATE EXTENSION pg_trgm;"' |
|
78 |
register: shell_result |
|
79 |
failed_when: |
|
80 |
- shell_result.rc != 0 |
|
81 |
- "'already exists' not in shell_result.stderr" |
|
82 |
when: database_type == "postgresql" |
|
83 |
|
|
84 |
- name: Install Redis |
|
85 |
hosts: redis |
|
86 |
become: true |
|
87 |
tasks: |
|
88 |
- name: Install Redis |
|
89 |
include_role: |
|
90 |
name: ../../roles/config-redis |
|
91 |
vars: |
|
92 |
mode: containerized |
|
93 |
|
|
94 |
- name: Install Quay Enterprise |
|
95 |
hosts: quay_enterprise |
|
96 |
gather_facts: false |
|
97 |
become: true |
|
98 |
vars_files: |
|
99 |
- "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml" |
|
100 |
- "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml" |
|
101 |
tasks: |
|
102 |
- name: Install Quay |
|
103 |
include_role: |
|
104 |
name: ../../roles/config-quay-enterprise |
|
105 |
vars: |
|
106 |
quay_ssl_generate_hostname: "{{ quay_hostname }}.{{subdomain_base}}" |
|
107 |
database_host: "{{ hostvars[groups['database'][0]]['ansible_eth0']['ipv4']['address'] }}" |
|
108 |
redis_host: "{{ hostvars[groups['redis'][0]]['ansible_eth0']['ipv4']['address'] }}" |
|
109 |
|
|
110 |
- name: Software flight-check |
|
111 |
hosts: localhost |
|
112 |
connection: local |
|
113 |
gather_facts: false |
|
114 |
become: false |
|
115 |
tags: |
|
116 |
- post_flight_check |
|
117 |
tasks: |
|
118 |
- debug: |
|
119 |
msg: "Software checks completed successfully" |