From e1a8dc4f7b896af8d92a70a18fa8902fab499eef Mon Sep 17 00:00:00 2001 From: Sietse Snel Date: Thu, 28 Mar 2024 16:23:44 +0100 Subject: [PATCH] CKAN DB init check: change failed value Only display DB init check as failed if an unexpected failure occurs, not if the DB is not initialized yet (which is expected when running the playbook for the first time) --- roles/ckan/tasks/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/ckan/tasks/main.yml b/roles/ckan/tasks/main.yml index e9923ca..21614ee 100644 --- a/roles/ckan/tasks/main.yml +++ b/roles/ckan/tasks/main.yml @@ -263,7 +263,7 @@ become: true become_user: postgres ansible.builtin.command: 'psql -d ckan_default -c "select * from public.user"' - ignore_errors: true + failed_when: "userlist.rc != 0 and 'ERROR: relation \"public.user\" does not exist' not in userlist.stderr" register: userlist changed_when: false vars: @@ -277,13 +277,13 @@ vars: # Pipelininig is needed for internal temporary files ansible_ssh_pipelining: true - when: 'userlist.rc !=0 or "default" not in userlist.stdout' + when: 'userlist.rc != 0 or "default" not in userlist.stdout' # Reload supervisorctl as task, because there is no way to enforce ordering in # Ansible handlers, and we need to reload before we can start tasks. - name: Reload supervisorctl # noqa command-instead-of-module ansible.builtin.command: supervisorctl reload - when: 'userlist.rc !=0 or "default" not in userlist.stdout' + when: 'userlist.rc != 0 or "default" not in userlist.stdout' - name: Check if CKAN admin user exists become_user: root