dnf - install postgresql fom postgresql.org yum repos

I want to install PostgreSQL & barman with Ansible from the PostgreSQL.org repositories on an almalinux lxd container.

as none of the 2 package can be installed it seems my enablerepo is not working though:

failed: [barman-220320] (item=postgresql14-server) => changed=false
ansible_loop_var: item
failures:

  • No package postgresql14-server available.
    item: postgresql14-server
    msg: Failed to install some of the specified packages
    rc: 1
    results:
    failed: [barman-220320] (item=barman) => changed=false
    ansible_loop_var: item
    failures:
  • No package barman available.
    item: barman
    msg: Failed to install some of the specified packages
    rc: 1
    results:

I adapted it from https://www.postgresql.org/download/linux/redhat/

can anybody advise where I am falling short in this?

Hi,

You are specifying RPM url location in enablerepo, whereas enablerepo expects the name of the repoids. You may need to install the Postgresql rpm first and then use the repo in a subsequent task.

- name: Install Postgresql official repo
dnf:
name: https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
state: latest
disable_gpg_check: yes

- name: Install packages
dnf:
name: “{{ item }}”
state: “present”
with_items:
- postgresql
- postgresql-server