Skip to content

Commit

Permalink
import db tasks only run once fixes #181
Browse files Browse the repository at this point in the history
  • Loading branch information
mkayontour committed Sep 20, 2023
1 parent daf21f8 commit 68c2973
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions roles/icingaweb2/tasks/manage_icingaweb_mysql_db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
echo "INSERT INTO icingaweb_user (name, active, password_hash) VALUES ('{{ icingaweb2_admin_username }}', 1,
'"`php -r 'echo password_hash("{{ icingaweb2_admin_password }}", PASSWORD_DEFAULT);'`"')" | {{ _tmp_mysqlcmd }} -Ns
when: _icingaweb2_db_user.stdout_lines | length <= 0
run_once: yes
when:
- icingaweb2_admin_username is defined
- icingaweb2_admin_password is defined
2 changes: 2 additions & 0 deletions roles/icingaweb2/tasks/manage_icingaweb_pgsql_db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
{{ _tmp_pgsqlcmd }}
-w -f /usr/share/icingaweb2/schema/pgsql.schema.sql
when: _icingaweb2_db_schema.rc != 0
run_once: yes
when: icingaweb2_db_import_schema | default(False)

- name: Ensure Icinga Web User
Expand All @@ -56,6 +57,7 @@
echo "INSERT INTO icingaweb_user (name, active, password_hash) VALUES ('{{ icingaweb2_admin_username }}', 1,
'"`php -r 'echo password_hash("{{ icingaweb2_admin_password }}", PASSWORD_DEFAULT);'`"')" | {{ _tmp_pgsqlcmd }} -w
when: '"(0 rows)" in _icingaweb2_db_user.stdout_lines'
run_once: yes
when:
- icingaweb2_admin_username is defined
- icingaweb2_admin_password is defined

0 comments on commit 68c2973

Please sign in to comment.