Implement postgresql ansible role

This commit is contained in:
ionutboangiu
2023-07-11 04:43:34 -04:00
committed by Dan Christian Bogos
parent b6df49fbb6
commit 7faab6e0ff
4 changed files with 28 additions and 2 deletions

View File

@@ -13,6 +13,10 @@
import_role:
name: ../roles/install_mongodb
- name: Install PostgreSQL
import_role:
name: ../roles/postgresql
- name: Install Go
import_role:
name: ../roles/install_go

View File

@@ -9,7 +9,5 @@ cgrates_dependencies:
- git
- redis-server
- mariadb-server
- postgresql
- postgresql-contrib
- make
- gcc

View File

@@ -0,0 +1,4 @@
---
postgresql_version: "postgresql"
postgresql_repo: "http://apt.postgresql.org/pub/repos/apt"
postgresql_key_url: "https://www.postgresql.org/media/keys/ACCC4CF8.asc"

View File

@@ -0,0 +1,20 @@
---
- name: Create the PostgreSQL repository configuration
become: yes
ansible.builtin.copy:
content: "deb {{ postgresql_repo }} {{ ansible_distribution_release }}-pgdg main"
dest: /etc/apt/sources.list.d/pgdg.list
when: not (ansible.builtin.stat.exists is defined and ansible.builtin.stat.exists)
- name: Import the PostgreSQL repository signing key
become: yes
ansible.builtin.apt_key:
url: "{{ postgresql_key_url }}"
state: present
- name: Update the package lists and ensure PostgreSQL is the latest version
become: yes
ansible.builtin.apt:
name: "{{ postgresql_version }}"
state: latest
update_cache: yes