-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathst_deploy_master.yml
114 lines (106 loc) · 3.42 KB
/
st_deploy_master.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
108
109
110
111
112
113
114
# The playbook builds an EC deployment with PostgreSQL EC, 2 cores, 2 edges and a shared storage
# This is intended to be used just as a reference and an example.
# If you are using this to deploy SecureTransport, please review, validate and test all tasks and roles.
# This is provided as-is, and you should run it at your own risk.
# This is provided in order to provide usage examples and Axway cannot guarantee it is fit for production,
# or provide ongoing support for it.
# Author: Hristina Stoykova <[email protected]>
- name: Build a SecureTransport 2 x 2 EC
hosts: st_deployment
vars_files:
- files/external_vars.yml
- files/download_links.yml
pre_tasks:
- name: Store the hostname of each node as a variable
ansible.builtin.set_fact:
node_hostname: "{{ hostvars[inventory_hostname]['ansible_fqdn'] }}"
- name: Print the task start
ansible.builtin.debug:
msg: Starting to prepare the shared storage
- name: Install and configure NFS server
ansible.builtin.import_tasks: storage_install_tasks.yml
when: inventory_hostname in groups["storage"]
handlers:
- name: NFS server restart
ansible.builtin.service:
name: nfs-server
state: restarted
enabled: true
- name: Build the Postgres database
hosts: database
become: true
vars_files:
- files/external_vars.yml
roles:
- role: postgres-config
when: not skip_pgsql_install
- name: Prepare the OS
ansible.builtin.import_playbook: os_install.yml
vars:
storage_hostname: "{{ hostvars['nfs_storage']['node_hostname'] }}"
- name: Build the ST nodes
vars:
storage_hostname: "{{ hostvars['nfs_storage']['node_hostname'] }}"
edge_primary_hostname: "{{ hostvars['edge_primary']['node_hostname'] }}"
edge_primary_ip: "{{ hostvars['edge_primary']['ansible_default_ipv4']['address'] }}"
edge_secondary_ip: "{{ hostvars['edge_secondary']['ansible_default_ipv4']['address'] }}"
edge_secondary_cidr: "{{ hostvars['edge_secondary']['ansible_default_ipv4']['address'] }}/32"
hosts: ST_NODES
become: true
become_user: "{{ ST_USER }}"
vars_files:
- files/external_vars.yml
- files/services_vars.yml
- files/download_links.yml
roles:
- st_install
- name: Configure ST Cluster
hosts: ST_NODES
become: true
become_user: "{{ ST_USER }}"
roles:
- st_configuration
vars_files:
- files/external_vars.yml
- files/services_vars.yml
- name: Optimizing the ST nodes
hosts: ST_NODES
become: true
roles:
- st_optimization
vars_files:
- files/external_vars.yml
- files/services_vars.yml
#- name: Sanity restart of all services
# become: true
# become_user: "{{ ST_USER }}"
# hosts: ST_NODES
# vars_files:
# - files/external_vars.yml
# tasks:
# - name: Stop all
# ansible.builtin.shell:
# cmd: "sh {{ FILEDRIVEHOME }}/bin/stop_all -f"
# executable: /usr/bin/bash
# changed_when: true
#
# - name: Start all
# ansible.builtin.shell:
# cmd: "sh {{ FILEDRIVEHOME }}/bin/start_all"
# executable: /usr/bin/bash
# changed_when: true
- name: Cleanup local files
hosts: 127.0.0.1
connection: local
tasks:
- name: Delete local directory
ansible.builtin.file:
path: "files/{{ item }}"
state: absent
with_items:
- certs/core_primary.pem
- certs/edge_primary.pem
- core/taeh
- edge/taeh
tags:
- cleanup_local