|
3 | 3 | hosts: all
|
4 | 4 | tasks:
|
5 | 5 | - name: Load OTA applications configs
|
| 6 | + tags: [always] |
6 | 7 | ansible.builtin.include_role:
|
7 | 8 | name: ota/apps
|
8 | 9 | public: true # ensure that the role's variables and defaults are accessible to the play
|
| 10 | + apply: |
| 11 | + tags: [always] |
9 | 12 | vars:
|
10 | 13 | ota_apps_read_config_only: true
|
11 | 14 |
|
12 | 15 | - name: Set required variables
|
13 |
| - set_fact: |
| 16 | + tags: [always] |
| 17 | + ansible.builtin.set_fact: |
14 | 18 | chromium_required: "{{ ota_apps_config['@opentermsarchive/engine'] is defined }}"
|
15 | 19 | # Skip Debian 11 with ARM architecture as it is not currently supported by MongoDB; see https://www.mongodb.com/docs/manual/installation/#supported-platforms
|
16 | 20 | mongo_required:
|
|
23 | 27 | ) | bool
|
24 | 28 | }}"
|
25 | 29 |
|
26 |
| - snapshots_repository: "{{ ota_apps_config['@opentermsarchive/engine'].recorder.snapshots.storage.git.repository is defined and ota_apps_config['@opentermsarchive/engine'].recorder.snapshots.storage.git.repository }}" |
27 |
| - snapshots_path: "{{ ota_apps_config['@opentermsarchive/engine'].recorder.snapshots.storage.git.path is defined and ota_apps_config['@opentermsarchive/engine'].recorder.snapshots.storage.git.path }}" |
28 |
| - |
29 |
| - versions_repository: "{{ ota_apps_config['@opentermsarchive/engine'].recorder.versions.storage.git.repository is defined and ota_apps_config['@opentermsarchive/engine'].recorder.versions.storage.git.repository }}" |
30 |
| - versions_path: "{{ ota_apps_config['@opentermsarchive/engine'].recorder.versions.storage.git.path is defined and ota_apps_config['@opentermsarchive/engine'].recorder.versions.storage.git.path }}" |
31 |
| - |
32 |
| - collection_api_basePath: "{{ ota_apps_config['@opentermsarchive/engine']['collection-api'].basePath is defined and ota_apps_config['@opentermsarchive/engine']['collection-api'].basePath }}" |
33 |
| - collection_api_port: "{{ ota_apps_config['@opentermsarchive/engine']['collection-api'].port is defined and ota_apps_config['@opentermsarchive/engine']['collection-api'].port }}" |
34 |
| - |
35 |
| - federation_api_basePath: "{{ ota_apps_config['@opentermsarchive/federation-api'].basePath is defined and ota_apps_config['@opentermsarchive/federation-api'].basePath }}" |
36 |
| - federation_api_port: "{{ ota_apps_config['@opentermsarchive/federation-api'].port is defined and ota_apps_config['@opentermsarchive/federation-api'].port }}" |
37 |
| - |
| 30 | + snapshots_repository: "{{ ota_apps_config['@opentermsarchive/engine'].recorder.snapshots.storage.git.repository | default(None) }}" |
| 31 | + snapshots_relative_path: "{{ ota_apps_config['@opentermsarchive/engine'].recorder.snapshots.storage.git.path | default(None) }}" |
| 32 | + |
| 33 | + versions_repository: "{{ ota_apps_config['@opentermsarchive/engine'].recorder.versions.storage.git.repository | default(None) }}" |
| 34 | + versions_relative_path: "{{ ota_apps_config['@opentermsarchive/engine'].recorder.versions.storage.git.path | default(None) }}" |
| 35 | + |
| 36 | + collection_api_basePath: "{{ ota_apps_config['@opentermsarchive/engine']['collection-api'].basePath | default(None) }}" |
| 37 | + collection_api_port: "{{ ota_apps_config['@opentermsarchive/engine']['collection-api'].port | default(None) }}" |
| 38 | + |
| 39 | + federation_api_basePath: "{{ ota_apps_config['@opentermsarchive/federation-api'].basePath | default(None) }}" |
| 40 | + federation_api_port: "{{ ota_apps_config['@opentermsarchive/federation-api'].port | default(None) }}" |
| 41 | + |
38 | 42 | - name: Install infrastructure
|
39 | 43 | become: true
|
40 | 44 | tags: [infrastructure]
|
41 | 45 | block:
|
42 | 46 | - name: Install Node
|
43 | 47 | ansible.builtin.include_role:
|
44 | 48 | name: node
|
45 |
| - |
| 49 | + |
46 | 50 | - name: Install PM2
|
47 | 51 | ansible.builtin.include_role:
|
48 | 52 | name: pm2/install
|
|
52 | 56 | name: chromium
|
53 | 57 | when: chromium_required
|
54 | 58 |
|
55 |
| - - name: Install Nginx |
| 59 | + - name: Install Nginx |
56 | 60 | ansible.builtin.include_role:
|
57 | 61 | name: nginx/install
|
58 |
| - |
| 62 | + |
59 | 63 | - name: Install Mongo
|
60 | 64 | ansible.builtin.include_role:
|
61 | 65 | name: mongo/install
|
|
69 | 73 | become: true
|
70 | 74 | when:
|
71 | 75 | - mongo_required
|
72 |
| - |
| 76 | + |
73 | 77 | - name: Setup Git-based versions database
|
74 | 78 | ansible.builtin.include_role:
|
75 | 79 | name: ota/git_database
|
76 | 80 | vars:
|
77 | 81 | ota_git_database_repository: "{{ versions_repository }}"
|
78 |
| - ota_git_database_directory: "{{ versions_path }}" |
| 82 | + ota_git_database_directory: /home/{{ ansible_user }}/{{ ota_directory }}/{{ versions_relative_path }} |
79 | 83 | ota_git_database_branch: main
|
80 | 84 | when:
|
81 |
| - - versions_repository and versions_path |
| 85 | + - versions_repository and versions_relative_path |
82 | 86 |
|
83 | 87 | - name: Setup Git-based snapshots database
|
84 | 88 | ansible.builtin.include_role:
|
85 | 89 | name: ota/git_database
|
86 | 90 | vars:
|
87 | 91 | ota_git_database_repository: "{{ snapshots_repository }}"
|
88 |
| - ota_git_database_directory: "{{ snapshots_path }}" |
| 92 | + ota_git_database_directory: /home/{{ ansible_user }}/{{ ota_directory }}/{{ snapshots_relative_path }} |
89 | 93 | ota_git_database_branch: main
|
90 | 94 | when:
|
91 |
| - - snapshots_repository and snapshots_path |
| 95 | + - snapshots_repository and snapshots_relative_path |
92 | 96 |
|
93 | 97 | - name: Setup OTA applications
|
94 | 98 | ansible.builtin.include_role:
|
|
0 commit comments