Skip to content

Commit 43ceff8

Browse files
authored
Fix database paths (#45)
2 parents ad02502 + 0c98682 commit 43ceff8

File tree

5 files changed

+49
-40
lines changed

5 files changed

+49
-40
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22

33
All changes that impact users of this module are documented in this file, in the [Common Changelog](https://common-changelog.org) format with some additional specifications defined in the CONTRIBUTING file. This codebase adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
44

5-
## Unreleased
5+
## Unreleased [patch]
6+
7+
### Fixed
8+
9+
- Set up the Git-based databases at the proper locations
10+
- Make refined playbook execution work with the `infrastructure` tag
611

712
## 2.0.0 - 2024-05-31
813

playbooks/deploy.yml

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,18 @@
33
hosts: all
44
tasks:
55
- name: Load OTA applications configs
6+
tags: [always]
67
ansible.builtin.include_role:
78
name: ota/apps
89
public: true # ensure that the role's variables and defaults are accessible to the play
10+
apply:
11+
tags: [always]
912
vars:
1013
ota_apps_read_config_only: true
1114

1215
- name: Set required variables
13-
set_fact:
16+
tags: [always]
17+
ansible.builtin.set_fact:
1418
chromium_required: "{{ ota_apps_config['@opentermsarchive/engine'] is defined }}"
1519
# Skip Debian 11 with ARM architecture as it is not currently supported by MongoDB; see https://www.mongodb.com/docs/manual/installation/#supported-platforms
1620
mongo_required:
@@ -23,26 +27,26 @@
2327
) | bool
2428
}}"
2529

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+
3842
- name: Install infrastructure
3943
become: true
4044
tags: [infrastructure]
4145
block:
4246
- name: Install Node
4347
ansible.builtin.include_role:
4448
name: node
45-
49+
4650
- name: Install PM2
4751
ansible.builtin.include_role:
4852
name: pm2/install
@@ -52,10 +56,10 @@
5256
name: chromium
5357
when: chromium_required
5458

55-
- name: Install Nginx
59+
- name: Install Nginx
5660
ansible.builtin.include_role:
5761
name: nginx/install
58-
62+
5963
- name: Install Mongo
6064
ansible.builtin.include_role:
6165
name: mongo/install
@@ -69,26 +73,26 @@
6973
become: true
7074
when:
7175
- mongo_required
72-
76+
7377
- name: Setup Git-based versions database
7478
ansible.builtin.include_role:
7579
name: ota/git_database
7680
vars:
7781
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 }}
7983
ota_git_database_branch: main
8084
when:
81-
- versions_repository and versions_path
85+
- versions_repository and versions_relative_path
8286

8387
- name: Setup Git-based snapshots database
8488
ansible.builtin.include_role:
8589
name: ota/git_database
8690
vars:
8791
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 }}
8993
ota_git_database_branch: main
9094
when:
91-
- snapshots_repository and snapshots_path
95+
- snapshots_repository and snapshots_relative_path
9296

9397
- name: Setup OTA applications
9498
ansible.builtin.include_role:

roles/github/tasks/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@
2222
with_items: # GitHub's SSH key fingerprints can be found here: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/githubs-ssh-key-fingerprints
2323
- github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl
2424
- github.com ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEmKSENjQEezOmxkZMy7opKgwFB9nkt5YRrYMjNuG5N87uRgg6CLrbo5wAdT/y6v0mKV0U2w0WZ2YB/++Tpockg=
25-
- github.com ssh-rsa
25+
- github.com ssh-rsa
2626
AAAAB3NzaC1yc2EAAAADAQABAAABgQCj7ndNxQowgcQnjshcLrqPEiiphnt+VTTvDP6mHBL9j1aNUkY4Ue1gvwnGLVlOhGeYrnZaMgRK6+PKCUXaDbC7qtbW8gIkhL7aGCsOr/C56SJMy/BCZfxd1nWzAOxSDPgVsmerOBYfNqltV9/hWCqBywINIR+5dIg6JTJ72pcEpEjcYgXkE2YEFXV1JHnsKgbLWNlhScqb2UmyRkQyytRLtL+38TGxkxCflmO+5Z8CSSNY7GidjMIZ7Q4zMjA2n1nGrlTDkzwDCsw+wqFPGQA179cnfGWOWRVruj16z6XyvxvjJwbz0wQZ75XK5tKSb7FNyeIEs4TT4jk+S4dhPeAUC5y+bDYirYgM4GC7uEnztnZyaVWQ7B381AK4Qdrwt51ZqExKbQpTUNn+EjqoTwvqNj4kqx5QUCI0ThS/YkOxJCXmPUWZbhjpCg56i+2aB6CmK2JGhn57K5mj0MNdBXA4/WnwH6XoPWJzK5Nyu2zB3nAZp+S5hpQs+p1vN1/wsjk=

roles/mongo/configure/tasks/main.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22
- name: Configure MongoDB
33
notify: Restart MongoDB
44
block:
5-
- name: Add mongod.conf
6-
ansible.builtin.copy:
7-
src: mongod.conf
8-
dest: /etc/mongod.conf
9-
mode: "644"
5+
- name: Add mongod.conf
6+
ansible.builtin.copy:
7+
src: mongod.conf
8+
dest: /etc/mongod.conf
9+
mode: "644"
1010

11-
- name: Create data directory
12-
ansible.builtin.file:
13-
path: /mnt/disk/mongodb
14-
state: directory
15-
mode: "744"
11+
- name: Create data directory
12+
ansible.builtin.file:
13+
path: /mnt/disk/mongodb
14+
state: directory
15+
mode: "744"
1616

17-
- name: Set database files permissions
18-
ansible.builtin.file:
19-
path: /mnt/disk/mongodb
20-
owner: mongodb
21-
group: mongodb
22-
recurse: true
17+
- name: Set database files permissions
18+
ansible.builtin.file:
19+
path: /mnt/disk/mongodb
20+
owner: mongodb
21+
group: mongodb
22+
recurse: true

tests/inventory.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
vagrant:
1+
all:
22
hosts:
33
vagrant: # Name the host instead of using 127.0.0.1 to ensure `delegate_to` distinguishes between the local machine and the locally running Vagrant VM
44
ansible_user: vagrant

0 commit comments

Comments
 (0)