diff --git a/ansible/roles/postgresql/defaults/main.yml b/ansible/roles/postgresql/defaults/main.yml index 4e1677969c..160e7828ce 100644 --- a/ansible/roles/postgresql/defaults/main.yml +++ b/ansible/roles/postgresql/defaults/main.yml @@ -68,3 +68,7 @@ postgresql_users: [] # Whether to output user data when managing users. postgres_users_no_log: true + +# apt postgres repo details +postgres_repo_key: 'https://www.postgresql.org/media/keys/ACCC4CF8.asc' +postgres_repo: 'deb http://apt.postgresql.org/pub/repos/apt/ jammy-pgdg main' diff --git a/ansible/roles/postgresql/tasks/setup-Debian.yml b/ansible/roles/postgresql/tasks/setup-Debian.yml index 1b540196f0..b8e68b82b7 100644 --- a/ansible/roles/postgresql/tasks/setup-Debian.yml +++ b/ansible/roles/postgresql/tasks/setup-Debian.yml @@ -4,6 +4,16 @@ name: "{{ postgresql_python_library }}" state: present +- name: debian | Adding Postgres Debian Repo Key + apt_key: + url: "{{ postgres_repo_key }}" + state: "present" + +- name: debian | Adding postgres Debian Repo + apt_repository: + repo: "{{ postgres_repo }}" + state: "present" + - name: Ensure PostgreSQL packages are installed. apt: name: "{{ postgresql_packages }}" diff --git a/ansible/roles/postgresql/vars/Ubuntu-22.yml b/ansible/roles/postgresql/vars/Ubuntu-22.yml new file mode 100644 index 0000000000..650ca25e33 --- /dev/null +++ b/ansible/roles/postgresql/vars/Ubuntu-22.yml @@ -0,0 +1,11 @@ +--- +__postgresql_version: "10" +__postgresql_data_dir: "/var/lib/postgresql/{{ __postgresql_version }}/main" +__postgresql_bin_path: "/usr/lib/postgresql/{{ __postgresql_version }}/bin" +__postgresql_config_path: "/etc/postgresql/{{ __postgresql_version }}/main" +__postgresql_daemon: postgresql +__postgresql_packages: + - postgresql-10 + - postgresql-contrib + - libpq-dev +postgresql_python_library: python3-psycopg2