mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 09:12:45 +01:00
Merge pull request #657 from Security-Onion-Solutions/bugfix/playbook-mysql
playbook mysql fixes
This commit is contained in:
5
salt/playbook/files/playbook_db_init.sh
Normal file
5
salt/playbook/files/playbook_db_init.sh
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{%- set MYSQLPASS = salt['pillar.get']('secrets:mysql', None) -%}
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
docker cp /opt/so/saltstack/salt/playbook/files/playbook_db_init.sql so-mysql:/tmp/playbook_db_init.sql
|
||||||
|
docker exec so-mysql /bin/bash -c "/usr/bin/mysql -b -uroot -p{{MYSQLPASS}} < /tmp/playbook_db_init.sql"
|
||||||
@@ -6,51 +6,16 @@
|
|||||||
{%- set PLAYBOOKPASS = salt['pillar.get']('secrets:playbook', None) -%}
|
{%- set PLAYBOOKPASS = salt['pillar.get']('secrets:playbook', None) -%}
|
||||||
|
|
||||||
{% if salt['mysql.db_exists']('playbook') %}
|
{% if salt['mysql.db_exists']('playbook') %}
|
||||||
#Playbook database exists - Do nothing
|
#Playbook database exists - Do nothing
|
||||||
{% else %}
|
{% else %}
|
||||||
|
salt://playbook/files/playbook_db_init.sh:
|
||||||
|
cmd.script:
|
||||||
|
- cwd: /root
|
||||||
|
- template: jinja
|
||||||
|
|
||||||
{% set PLAYBOOK_DB_COPY = salt['docker.copy_to']('so-mysql','salt://playbook/files/playbook_db_init.sql','/tmp/playbook_db_init.sql',overwrite=True) %}
|
'sleep 5':
|
||||||
{% set PLAYBOOK_DB_CREATE = salt['docker.run']('so-mysql','/bin/bash -c "/usr/bin/mysql -uroot -p' + MYSQLPASS + ' < /tmp/playbook_db_init.sql"') %}
|
cmd.run
|
||||||
|
|
||||||
{% if PLAYBOOK_DB_COPY and PLAYBOOK_DB_CREATE %}
|
|
||||||
PLAYBOOK_DB_INIT_SUCCESS:
|
|
||||||
test.configurable_test_state:
|
|
||||||
- changes: False
|
|
||||||
- result: True
|
|
||||||
- comment: "Playbook database initialization was successful"
|
|
||||||
{% else %}
|
|
||||||
PLAYBOOK_DB_INIT_FAILURE:
|
|
||||||
test.configurable_test_state:
|
|
||||||
- changes: False
|
|
||||||
- result: False
|
|
||||||
- comment: "Playbook database initialization was not successful"
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
query_updatwebhooks:
|
|
||||||
mysql_query.run:
|
|
||||||
- database: playbook
|
|
||||||
- query: "update webhooks set url = 'http://{{MASTERIP}}:7000/playbook/webhook' where project_id = 1"
|
|
||||||
- connection_host: {{ MAINIP }}
|
|
||||||
- connection_port: 3306
|
|
||||||
- connection_user: root
|
|
||||||
- connection_pass: {{ MYSQLPASS }}
|
|
||||||
|
|
||||||
|
|
||||||
query_updatepluginurls:
|
|
||||||
mysql_query.run:
|
|
||||||
- database: playbook
|
|
||||||
- query: |-
|
|
||||||
update settings set value =
|
|
||||||
"--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess
|
|
||||||
project: '1'
|
|
||||||
convert_url: http://{{MASTERIP}}:7000/playbook/sigmac
|
|
||||||
create_url: http://{{MASTERIP}}:7000/playbook/play"
|
|
||||||
where id = 43
|
|
||||||
- connection_host: {{ MAINIP }}
|
|
||||||
- connection_port: 3306
|
|
||||||
- connection_user: root
|
|
||||||
- connection_pass: {{ MYSQLPASS }}
|
|
||||||
|
|
||||||
playbookdbuser:
|
playbookdbuser:
|
||||||
mysql_user.present:
|
mysql_user.present:
|
||||||
@@ -72,6 +37,30 @@ playbookdbdbpriv:
|
|||||||
- connection_user: root
|
- connection_user: root
|
||||||
- connection_pass: {{ MYSQLPASS }}
|
- connection_pass: {{ MYSQLPASS }}
|
||||||
|
|
||||||
|
query_updatwebhooks:
|
||||||
|
mysql_query.run:
|
||||||
|
- database: playbook
|
||||||
|
- query: "update webhooks set url = 'http://{{MASTERIP}}:7000/playbook/webhook' where project_id = 1"
|
||||||
|
- connection_host: {{ MAINIP }}
|
||||||
|
- connection_port: 3306
|
||||||
|
- connection_user: root
|
||||||
|
- connection_pass: {{ MYSQLPASS }}
|
||||||
|
|
||||||
|
query_updatepluginurls:
|
||||||
|
mysql_query.run:
|
||||||
|
- database: playbook
|
||||||
|
- query: |-
|
||||||
|
update settings set value =
|
||||||
|
"--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess
|
||||||
|
project: '1'
|
||||||
|
convert_url: http://{{MASTERIP}}:7000/playbook/sigmac
|
||||||
|
create_url: http://{{MASTERIP}}:7000/playbook/play"
|
||||||
|
where id = 43
|
||||||
|
- connection_host: {{ MAINIP }}
|
||||||
|
- connection_port: 3306
|
||||||
|
- connection_user: root
|
||||||
|
- connection_pass: {{ MYSQLPASS }}
|
||||||
|
|
||||||
{% if PLAYBOOKPASS == None %}
|
{% if PLAYBOOKPASS == None %}
|
||||||
|
|
||||||
playbook_password_none:
|
playbook_password_none:
|
||||||
@@ -92,8 +81,6 @@ so-playbook:
|
|||||||
- REDMINE_DB_DATABASE=playbook
|
- REDMINE_DB_DATABASE=playbook
|
||||||
- REDMINE_DB_USERNAME=playbookdbuser
|
- REDMINE_DB_USERNAME=playbookdbuser
|
||||||
- REDMINE_DB_PASSWORD={{ PLAYBOOKPASS }}
|
- REDMINE_DB_PASSWORD={{ PLAYBOOKPASS }}
|
||||||
- binds:
|
|
||||||
- /opt/so/conf/playbook/redmine.db:/usr/src/redmine/sqlite/redmine.db:rw
|
|
||||||
- port_bindings:
|
- port_bindings:
|
||||||
- 0.0.0.0:3200:3000
|
- 0.0.0.0:3200:3000
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user