-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add abid_production task to pul_nomad
Co-authored-by: Anna Headley <[email protected]>
- Loading branch information
1 parent
3d63a0b
commit ecf1d51
Showing
2 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,6 @@ jobs: | |
strategy: | ||
matrix: | ||
role: | ||
# - abid | ||
- apache2 | ||
- approvals | ||
- bibdata | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- | ||
- name: 'pul_nomad_abid | create postgresql db users' | ||
community.postgresql.postgresql_user: | ||
name: '{{ abid_production_db_user }}' | ||
password: '{{ abid_production_db_password }}' | ||
encrypted: true | ||
state: 'present' | ||
delegate_to: '{{ abid_production_postgres_host }}' | ||
become: true | ||
become_user: '{{ abid_production_postgres_admin_user }}' | ||
run_once: true | ||
|
||
- name: 'pul_nomad_abid | create postgresql database' | ||
community.postgresql.postgresql_db: | ||
name: '{{ abid_production_db_name }}' | ||
encoding: 'UTF-8' | ||
state: 'present' | ||
owner: "{{ abid_production_db_user }}" | ||
delegate_to: '{{ abid_production_postgres_host }}' | ||
become: true | ||
become_user: '{{ abid_production_postgres_admin_user }}' | ||
run_once: true | ||
|
||
- name: 'pul_nomad_abid | ensure access to postgres server for client connections' | ||
ansible.builtin.lineinfile: | ||
path: '/etc/postgresql/{{ abid_production_postgres_version }}/main/pg_hba.conf' | ||
line: 'host all all {{ ansible_default_ipv4.address }}/32 md5' | ||
delegate_to: '{{ abid_production_postgres_host }}' | ||
register: remote_postgres_configured | ||
throttle: 1 # have this task run one machine at a time to avoid race condition | ||
when: | ||
- "nomad_node_role == 'client'" | ||
|
||
- name: 'pul_nomad_abid | reload postgresql' | ||
ansible.builtin.service: | ||
name: postgresql | ||
state: reloaded | ||
when: | ||
- remote_postgres_configured.changed | ||
delegate_to: '{{ abid_production_postgres_host }}' | ||
|
||
- name: 'pul_nomad_abid | add the application environment variables' | ||
ansible.builtin.shell: | ||
cmd: '/usr/local/bin/nomad var put -force nomad/jobs/abid-production {{ abid_production_nomad_env_vars.keys() | zip(abid_production_nomad_env_vars.values()) | map("join", "=") | join(" ") }}' | ||
environment: | ||
NOMAD_TOKEN: '{{ pul_nomad_management_token }}' | ||
run_once: true |