/
retrieve-blockstore.yaml
37 lines (36 loc) · 1.29 KB
/
retrieve-blockstore.yaml
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
- name: retrieve blockstore
hosts: validators
become: false
gather_facts: true
vars:
target_host: all
tasks:
- name: stop app
ansible.builtin.systemd:
name: testappd
state: stopped
become: yes
when: target_host == "all" or target_host == hostvars[inventory_hostname].name
- name: Delete old zip
ansible.builtin.file:
path: "{{ cmt_home }}/data/blockstore.db.zip"
state: absent
when: target_host == "all" or target_host == hostvars[inventory_hostname].name
- name: Zip the blockstore directory
archive:
path: "{{ cmt_home }}/data/blockstore.db"
format: zip
dest: "{{ cmt_home }}/data/blockstore.db.zip"
when: target_host == "all" or target_host == hostvars[inventory_hostname].name
- name: Fetch the blockstore
ansible.builtin.fetch:
src: "{{ cmt_home }}/data/blockstore.db.zip"
dest: "{{dir}}/{{ hostvars[inventory_hostname].name }}/blockstore.db.zip"
flat: yes
when: target_host == "all" or target_host == hostvars[inventory_hostname].name
- name: start the systemd-unit
ansible.builtin.systemd:
name: testappd
state: started
become: yes
when: target_host == "all" or target_host == hostvars[inventory_hostname].name