install postgresql

27 views
Skip to first unread message

gaddam mahendra

unread,
Feb 3, 2020, 3:51:20 AM2/3/20
to Ansible Project
HI Team,
could you please post a playbook to install postgresql database

thanks
mahi

Dick Visser

unread,
Feb 3, 2020, 4:12:28 AM2/3/20
to ansible...@googlegroups.com
Hi

This should do it:


---

- name: Playbook to install postgresql database
become: true
hosts: all

tasks:
- name: Install postgresql database
package:
name: postgresql
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/2bb56463-e7be-4427-b2ee-d1db00e099b7%40googlegroups.com.



--
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

gaddam mahendra

unread,
Feb 3, 2020, 9:42:02 AM2/3/20
to ansible...@googlegroups.com
Thanks Dick,
But i need to install with user xxxx and database xxxx how could i achive it when im running my below play book im getting below error could pls help out it below issue
 ---
# tasks file for ansible-postgresql
- name: Add repository
  yum_repository:
    name: epel
    description: EPEL YUM repo
    baseurl: https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm


#Install the client packages && Optionally install the server packages

- yum:
    name: postgresql10
    state: present

- yum:
    name: postgresql10-server
    state: present

- name: intialize the DB
  command: /usr/pgsql-10/bin/postgresql-10-setup initdb
  ignore_errors: yes

- name: enable service httpd and ensure it is not masked
  systemd:
    name: postgresql-10
    enabled:  yes


- name: Make sure a service is running
  systemd:
    state: started
    name: postgresql-10


- name: Create kong  user and passwd
  postgresql_user:
    name: kong
    password: kong111
    role_attr_flags: CREATEDB,NOSUPERUSER

error is below whihc im getting

image.png


Dick Visser

unread,
Feb 3, 2020, 10:10:05 AM2/3/20
to ansible...@googlegroups.com
On Mon, 3 Feb 2020 at 15:41, gaddam mahendra <mahikri...@gmail.com> wrote:
>
> Thanks Dick,
> But i need to install with user xxxx and database xxxx how could i achive it when im running my below play book im getting below error could pls help out it below issue

Your question was how to install postgresql, so that's the answer you got.
If you need other things, ask for that.

Regarding the error you get with postgreql_user, it LITERALLY says
what's wrong and how to fix it.
What part do you need helping out with?

Please make sure to copy/paste the text, and avoid attaching screen dumps.

Dick
> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CABvWte2dMtcpG-EJ8GQg6p770jq60Au-BwaBO0Sr_k5U0ueUFQ%40mail.gmail.com.

Stefan Hornburg (Racke)

unread,
Feb 3, 2020, 10:13:10 AM2/3/20
to ansible...@googlegroups.com
On 2/3/20 4:09 PM, Dick Visser wrote:
> On Mon, 3 Feb 2020 at 15:41, gaddam mahendra <mahikri...@gmail.com> wrote:
>>
>> Thanks Dick,
>> But i need to install with user xxxx and database xxxx how could i achive it when im running my below play book im getting below error could pls help out it below issue
>
> Your question was how to install postgresql, so that's the answer you got.
> If you need other things, ask for that.
>
> Regarding the error you get with postgreql_user, it LITERALLY says
> what's wrong and how to fix it.
> What part do you need helping out with?
>
> Please make sure to copy/paste the text, and avoid attaching screen dumps.

I agree with that, can't even read it in Thunderbird as the characters appear very small.

Regards
Racke
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

signature.asc
Reply all
Reply to author
Forward
Message has been deleted
0 new messages