blob: 40e697abac1cc7f0c9258a32186dc1f141859c97 (
plain)
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
|
---
- name: check for count of faf tables
shell: psql -c "SELECT COUNT(*) FROM pg_stat_user_tables"
register: count_tables
changed_when: "( count_tables.stdout_lines[2]|int ) == 0"
become: yes
become_user: faf
# Skip whole block if faf owns atleast 1 table in db
- block:
- name: create faf's database schema
command: faf-migrate-db --create-all
become: yes
become_user: faf
- name: stamp database as migrated to latest version
command: faf-migrate-db --stamp-only
become: yes
become_user: faf
- name: init faf
command: faf init
become: yes
become_user: faf
when: ( count_tables.stdout_lines[2]|int ) == 0
|