Ansible Playbook for PostgreSQL 11 on Centos7


He’re a not very elegant, but short and simple ansible playbook for installing PostgreSQL 11 on Centos7.

Yeah, we know we’re not using proper Ansible modules for that, but at least if you’re not using ansible, you can use it, as is, for manual PostgreSQL installation.

Initdb will only execute if ‘data’ directory is empty that’s why we’re ignoring errors if it is to be executed second time.

- hosts: postgresql11_hosts
    - name: setup pg 11
      shell: |
        rpm -Uvh
        yum install -y postgresql11-server postgresql11-contrib
    - name: initdb
      shell: |
        /usr/pgsql-11/bin/postgresql-11-setup initdb
      ignore_errors: yes
    - name: setup service
      shell: |
        systemctl enable postgresql-11.service
        systemctl start postgresql-11.service

You may also like...

Popular Posts

Leave a Reply

Your email address will not be published. Required fields are marked *