Compare commits

...

2 Commits

Author SHA1 Message Date
Souldiv c5c0866449 typo fix 2023-10-31 13:32:03 -05:00
Souldiv ab212d0a3d refactor code to replace command module 2023-10-31 13:28:38 -05:00
1 changed files with 8 additions and 8 deletions

View File

@ -1,20 +1,20 @@
---
- name: Check if key is present
- name: Check if signing key is present
stat:
path: /etc/apt/trusted.gpg.d/pgdg.asc
register: st_pgdg
- name: Add PostgreSQL APT repo
command: sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
become: true
when: not st_pgdg.stat.exists
register: postgresql_st_pgdg
- name: Import and Write gpg key to pgdg.asc
get_url:
url: https://www.postgresql.org/media/keys/ACCC4CF8.asc
dest: /etc/apt/trusted.gpg.d/pgdg.asc
become: true
when: not st_pgdg.stat.exists
when: not postgresql_st_pgdg.stat.exists
- name: Add postgresql repository into sources list
ansible.builtin.apt_repository:
repo: "deb http://apt.postgresql.org/pub/repos/apt {{ ansible_distribution_release }}-pgdg main"
state: present
- name: Update cache
apt: update_cache=yes state=latest