Playboox only runs the second time

10 views
Skip to first unread message

robert rottermann

unread,
Jul 21, 2020, 2:51:10 PM7/21/20
to Ansible Project
Hi friends in Ansible
I have a playbook that sets up a PostgreSQL environment.
One of the tasks sets up a db user.
This task always fails the first time. The error is, that psycopg2 could not be loaded.
If I run the playbook a second time, it works without a glitch.

A clumsy solution I found is to split the playbook into two parts. Running them in sequence work without a problem.

Could anybody of you give me a hint on how to find a solution for this?

thanks
Robert

here is the failing task:
- name: PostgreSQL - Add the config db Odoo user
   become: true
   become_user: postgres
   postgresql_user:
   name: '{{ odoo_config_db_user }}'
   password: '{{ odoo_config_db_passwd_crypt }}'
   encrypted: yes
   role_attr_flags: '{{ odoo_postgresql_user_role_attr }}'
   ignore_errors: yes



Phil Griffiths

unread,
Jul 23, 2020, 2:05:18 PM7/23/20
to Ansible Project
Hi Robert

This doesn't make a whole lot of sense why this would fail and then work. Definitely being applied to the SAME host on each run?
I suggest you post your whole playbook(s) here as there's something else going on outside the mentioned failing task I suspect.

As a good measure I would also include something like:
- name: Make sure psycopg2 is installed
  pip:
    name: psycopg2
    state: present
before you need it to ensure that base is covered as well.
Phil.
Reply all
Reply to author
Forward
0 new messages