-
Notifications
You must be signed in to change notification settings - Fork 2
/
swap_datafs.yml
74 lines (69 loc) · 2.23 KB
/
swap_datafs.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
---
# This puts the Data.fs.new file in place
- name: stop zclients
hosts: zclient
tasks:
- become: yes
supervisorctl:
name: "{{ item }}"
state: stopped
with_items: "[{% for i in range(0, hostvars[inventory_hostname].zclient_count|default(1), 1) %}'{{ 'zclient_instance{}'.format(i) }}',{% endfor %}]"
- name: stop pdf_gen applications
hosts: pdf_gen
tasks:
- become: yes
supervisorctl:
name: pdf_gen
state: stopped
- name: swap datafs
hosts: zeo
vars_prompt:
- name: "db_conn_object_path"
prompt: "What is the db connection object path?"
private: no
# Note: In production this is `app.devrep` everywhere else it's `app.plone.rhaptosDA`.
default: "app.devrep"
tasks:
- name: stop zeo
become: yes
supervisorctl:
name: zeo
state: stopped
- name: move Data.fs to Data.fs.old
become: yes
become_user: www-data
command: "mv Data.fs Data.fs.old"
args:
chdir: "/var/lib/cnx/cnx-buildout/var/filestorage"
- name: move Data.fs.new to Data.fs
become: yes
become_user: www-data
command: "mv Data.fs.new Data.fs"
args:
chdir: "/var/lib/cnx/cnx-buildout/var/filestorage"
- name: start zeo
become: yes
supervisorctl:
name: zeo
state: started
- name: update database connection string in rhaptos site
shell: echo 'import transaction; {{ db_conn_object_path }}.connection_string = "postgres://{{ archive_db_user }}:{{ archive_db_password }}@{{ archive_db_host }}:{{ archive_db_port }}/{{ archive_db_name }}"; transaction.commit()' | ./bin/instance debug
args:
chdir: "/var/lib/cnx/cnx-buildout"
- name: update pdf_gen settings
import_tasks: tasks/assign_pdf_gen_settings.yml
- name: start zclient applications
hosts: zclient
tasks:
- become: yes
supervisorctl:
name: "{{ item }}"
state: started
with_items: "[{% for i in range(0, hostvars[inventory_hostname].zclient_count|default(1), 1) %}'{{ 'zclient_instance{}'.format(i) }}',{% endfor %}]"
- name: start pdf_gen applications
hosts: pdf_gen
tasks:
- become: yes
supervisorctl:
name: pdf_gen
state: started