Merge pull request #993 from Security-Onion-Solutions/bugfix/playbook-init

Bugfix/playbook init
This commit is contained in:
Josh Brower
2020-07-14 09:14:56 -04:00
committed by GitHub
3 changed files with 20 additions and 15 deletions

14
salt/playbook/db_init.sls Normal file
View File

@@ -0,0 +1,14 @@
# This state will import the initial default playbook database.
# If there is an existing playbook database, it will be overwritten - no backups are made.
include:
- mysql
salt://playbook/files/playbook_db_init.sh:
cmd.script:
- cwd: /root
- template: jinja
'sleep 5':
cmd.run

View File

@@ -6,17 +6,8 @@
{%- set MYSQLPASS = salt['pillar.get']('secrets:mysql', None) -%}
{%- set PLAYBOOKPASS = salt['pillar.get']('secrets:playbook', None) -%}
{% if salt['mysql.db_exists']('playbook') %}
#Playbook database exists - Do nothing
{% else %}
salt://playbook/files/playbook_db_init.sh:
cmd.script:
- cwd: /root
- template: jinja
'sleep 5':
cmd.run
{% endif %}
include:
- mysql
create_playbookdbuser:
module.run:

View File

@@ -539,8 +539,8 @@ fi
fi
if [[ "$PLAYBOOK" = 1 ]]; then
set_progress_str 73 "$(print_salt_state_apply 'mysql')"
salt-call state.apply -l info mysql >> $setup_log 2>&1
set_progress_str 73 "$(print_salt_state_apply 'playbook.db_init')"
salt-call state.apply -l info playbook.db_init >> $setup_log 2>&1
set_progress_str 73 "$(print_salt_state_apply 'playbook')"
salt-call state.apply -l info playbook >> $setup_log 2>&1