-
-
Notifications
You must be signed in to change notification settings - Fork 74
/
main.yml
94 lines (84 loc) · 2.4 KB
/
main.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
---
- name: Install st2mistral dependency
become: yes
package:
name: st2python
state: present
when: (ansible_distribution == "CentOS" or ansible_distribution == "RedHat") and ansible_distribution_major_version == "6"
tags: st2mistral
- name: Install latest st2mistral
become: yes
package:
name: st2mistral
state: latest
when: mistral_version == "stable"
tags: st2mistral
- name: Install latest st2mistral
become: yes
package:
name: st2mistral={{ mistral_version }}
state: present
when: mistral_version != "stable"
tags: st2mistral
- name: Configure mistral
become: yes
ini_file:
dest: /etc/mistral/mistral.conf
section: database
option: connection
value: postgresql://{{ mistral_db_username }}:{{ mistral_db_password }}@localhost/{{ mistral_db }}
backup: yes
tags: st2mistral
- name: Deploy database init script
become: yes
template:
src: init_mistral_db.SQL.j2
dest: /etc/mistral/init_mistral_db.SQL
notify:
- restart mistral
tags: st2mistral
- name: Initiate database
vars:
ansible_ssh_pipelining: true
become: yes
become_user: postgres
shell: psql < /etc/mistral/init_mistral_db.SQL
args:
creates: /etc/mistral/init_mistral_db.SQL.ansible.has.run
notify:
- restart mistral
tags: st2mistral
- name: Make sure "Initiate database" doesn't run twice
become: yes
file:
path: /etc/mistral/init_mistral_db.SQL.ansible.has.run
state: touch
tags: st2mistral
- name: Setup Mistral DB tables, etc
become: yes
command: /opt/stackstorm/mistral/bin/mistral-db-manage --config-file /etc/mistral/mistral.conf upgrade head
args:
creates: /etc/mistral/mistral-db-manage.upgrade.head.ansible.has.run
notify:
- restart mistral
tags: st2mistral
- name: Make sure "Setup Mistral DB tables, etc" does not run again
become: yes
file:
path: /etc/mistral/mistral-db-manage.upgrade.head.ansible.has.run
state: touch
tags: st2mistral
- name: Register mistral actions
become: yes
command: /opt/stackstorm/mistral/bin/mistral-db-manage --config-file /etc/mistral/mistral.conf populate
args:
creates: /etc/mistral/mistral-db-manage.populate.ansible.has.run
notify:
- restart mistral
tags: st2mistral
- name: Make sure "Register mistral actions" does not run again
become: yes
file:
path: /etc/mistral/mistral-db-manage.upgrade.head.ansible.has.run
state: touch
tags: st2mistral