Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions development/playbooks/deploy-dev/deploy-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
- "../../../src/vars/foreman.yml"
- "../../../src/vars/base.yaml"
pre_tasks:
- name: Stop foreman target
Comment thread
jeremylenz marked this conversation as resolved.
Outdated
ansible.builtin.systemd:
name: foreman.target
state: stopped
failed_when: false

- name: Set development postgresql databases
ansible.builtin.set_fact:
postgresql_databases: >-
Expand Down Expand Up @@ -48,6 +54,7 @@
- role: candlepin
- role: httpd
- role: pulp
- role: systemd_target
- role: foreman_development
vars:
foreman_development_oauth_consumer_key: "{{ foreman_oauth_consumer_key }}"
Expand Down
9 changes: 8 additions & 1 deletion src/roles/postgresql/tasks/upgrade.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@
ansible.builtin.systemd:
name: foreman.target
state: stopped
failed_when: false
Comment thread
jeremylenz marked this conversation as resolved.
Outdated

- name: Stop postgresql service
Comment thread
jeremylenz marked this conversation as resolved.
Outdated
ansible.builtin.systemd:
name: "{{ postgresql_container_name }}"
state: stopped
failed_when: false

- name: Wait for port 5432 to be completely freed by Podman
ansible.builtin.wait_for:
Expand All @@ -39,7 +46,7 @@
state: quadlet
sdnotify: false
volumes:
- "{{ postgresql_data_dir }}:/var/lib/pgsql/data:rw,Z"
- "{{ postgresql_data_dir }}:/var/lib/pgsql/data:rw,z"
Comment thread
jeremylenz marked this conversation as resolved.
Outdated
secrets:
- 'postgresql-admin-password,target=POSTGRESQL_ADMIN_PASSWORD,type=env'
env:
Expand Down
26 changes: 21 additions & 5 deletions src/roles/pre_install/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,32 @@
ansible.builtin.include_role:
name: debug_tools

- name: 'Check current postgresql module stream'
ansible.builtin.slurp:
src: /etc/dnf/modules.d/postgresql.module
register: postgresql_module_file
failed_when: false
when:
- ansible_facts['os_family'] == 'RedHat'
- ansible_facts['distribution_major_version'] == '9'

- name: 'Enable postgresql:16 module'
ansible.builtin.command: dnf module enable -y postgresql:16
# can't use the `dnf` module for modules without a default stream
# https://github.com/ansible/ansible/issues/56504
# https://github.com/ansible/ansible/issues/64852
args:
creates: /etc/dnf/modules.d/postgresql.module
changed_when: true
when:
- ansible_facts['os_family'] == 'RedHat'
- ansible_facts['distribution_major_version'] == '9'
- postgresql_module_file is failed or postgresql_module_file.content is not defined

- name: 'Switch to postgresql:16 module'
Comment thread
evgeni marked this conversation as resolved.
Outdated
ansible.builtin.command: dnf module switch-to -y postgresql:16
changed_when: true
when:
- ansible_facts['os_family'] == 'RedHat'
- ansible_facts['distribution_major_version'] == '9'
- postgresql_module_file is succeeded
- postgresql_module_file.content is defined
- "'stream=16' not in (postgresql_module_file.content | b64decode)"

- name: Install podman and utilities
ansible.builtin.package:
Expand Down
Loading