postgresql/tasks/Debian/main.yaml

38 lines
1007 B
YAML
Raw Normal View History

2023-02-07 23:13:12 +00:00
- name: Add gpg package
apt:
name: gpg
- name: Add gpg keys for postgresql
ansible.builtin.apt_key:
url: "{{ item.url }}"
keyring: "{{ item.keyring }}"
loop: "{{ postgresql_apt_key }}"
- name: Add Hashicorp repository
apt_repository:
repo: "{{ item.repo }}"
state: present
filename: "{{ item.filename }}"
update_cache: yes
loop: "{{ postgresql_apt_repository }}"
- name: Check if Patroni is installed
ansible.builtin.shell: dpkg-query -l {{ postgresql_package_name }} 2>&1 | grep {{ postgresql_version }}
ignore_errors: True
register: is_postgresql
changed_when: is_postgresql.rc != 0
failed_when: False
- name: Mask Patroni before install
ansible.builtin.systemd:
name: "{{ postgresql_package_name }}"
masked: yes
when: is_postgresql.rc != 0
- name: "Install {{ postgresql_package_name }} {{ postgresql_version }}"
apt:
name: "{{ postgresql_package }}"
update_cache: yes
register: postgresql_setup
when: is_postgresql.rc != 0