Giter Site home page Giter Site logo

Comments (7)

varnav avatar varnav commented on May 20, 2024

Which example you are talking about?

from ansible-examples.

essanpupil avatar essanpupil commented on May 20, 2024

I try this example:
ansible-examples/language_features/postgresql.yml

from ansible-examples.

gregdek avatar gregdek commented on May 20, 2024

@essanpupil post the full output, may help to figure out the issue.

from ansible-examples.

essanpupil avatar essanpupil commented on May 20, 2024

Sorry, i'm too busy with my other problems. So here is my complete output:

pupil@DreamRunner:~/ansible_training$ ansible-playbook install_config_postgre.yml -K
SUDO password: 

PLAY [trustme] **************************************************************** 

TASK: [ensure apt cache is up to date] **************************************** 
ok: [trustme]

TASK: [ensure packages are installed] ***************************************** 
ok: [trustme] => (item=postgresql,libpq-dev,python-psycopg2)

PLAY [trustme] **************************************************************** 

TASK: [ensure database is created] ******************************************** 
failed: [trustme] => {"failed": true}
msg: unable to connect to database: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?


FATAL: all hosts have already failed -- aborting

PLAY RECAP ******************************************************************** 
           to retry, use: --limit @/home/pupil/install_config_postgre.retry

trustme                    : ok=2    changed=0    unreachable=0    failed=1 

and here is my .yml file

---
- hosts: trustme
  sudo: yes
  gather_facts: no

  tasks:
  - name: ensure apt cache is up to date
    apt: update_cache=yes
  - name: ensure packages are installed
    apt: name={{item}}
    with_items:
          - postgresql
          - libpq-dev
          - python-psycopg2


- hosts: trustme
  sudo: yes
  sudo_user: postgres
  gather_facts: no

  vars:
    dbname: scam_db
    dbuser: django
    dbpassword: katarahasia

  tasks:
  - name: ensure database is created
    postgresql_db: name={{dbname}}

  - name: ensure user has access to database
    postgresql_user: db={{dbname}} name={{dbuser}} password={{dbpassword}} priv=ALL

  - name: ensure user does not have unnecessary privilege
    postgresql_user: name={{dbuser}} role_attr_flags=NOSUPERUSER,NOCREATEDB

i hope this helps

from ansible-examples.

jaywink avatar jaywink commented on May 20, 2024

This happens to me as well, same symptoms, same versions.

from ansible-examples.

lowks avatar lowks commented on May 20, 2024

This happens to me too.

from ansible-examples.

jaywink avatar jaywink commented on May 20, 2024

To overcome this, I've added these two tasks to my roles which use Ubuntu 14.04, which seems to suffer from this problem.

- name: Locale patch for postgres
  lineinfile: dest=/etc/default/locale line='LANGUAGE="en_US:en"' state=present
- name: Locale patch for postgres
  lineinfile: dest=/etc/default/locale line='LC_ALL="en_US.UTF-8"' state=present

It's not .... ideal, but for my stuff it does the job. If done before installing postgresql via apt, it will install properly. I believe this is the problem described in full.

from ansible-examples.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.