mirror of
https://gitea.0xace.cc/ansible-galaxy/postgresql.git
synced 2024-11-25 08:16:43 +00:00
38 lines
1007 B
YAML
38 lines
1007 B
YAML
|
- 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
|