Quiet script output + fix pillar value

This commit is contained in:
William Wernert
2020-09-30 19:46:18 -04:00
parent 596f2d31e4
commit 11ae904100
2 changed files with 9 additions and 6 deletions

View File

@@ -8,7 +8,7 @@ try_count=6
interval=10
while [[ $try_count -le 6 ]]; do
if docker top "so-playbook"; then
if docker top "so-playbook" &>/dev/null; then
#Create Automation user
automation_group=6
@@ -27,17 +27,20 @@ while [[ $try_count -le 6 ]]; do
automation_api_key=${automation_res[0]}
automation_user_id=${automation_res[1]}
curl --location --request POST "http://127.0.0.1:3200/playbook/groups/${automation_group}/users.json" \
curl -s --location --request POST "http://127.0.0.1:3200/playbook/groups/${automation_group}/users.json" \
--user "admin:{{ admin_pass }}" \
--header 'Content-Type: application/json' \
--data "{
\"user_id\" : ${automation_user_id}
}"
if (grep -qi "playbook_api_key" $local_salt_dir/pillar/global.sls); then
sed -i "/s/playbook_api_key:.*/playbook_api_key: ${automation_api_key}/g" $local_salt_dir/pillar/global.sls
if (sed -z '/playbook:\n api_key:.*/Q' $local_salt_dir/pillar/global.sls); then
sed -iz "s/playbook:\n api_key:.*/playbook:\n api_key: ${automation_api_key}/" $local_salt_dir/pillar/global.sls
else
echo " playbook_api_key: ${automation_api_key}" >> $local_salt_dir/pillar/global.sls
{
echo "playbook:"
echo " api_key: ${automation_api_key}"
} >> $local_salt_dir/pillar/global.sls
fi
fi
((try_count++))

View File

@@ -1,7 +1,7 @@
{%- set MANAGER = salt['pillar.get']('global:url_base', '') %}
{%- set HIVEKEY = salt['pillar.get']('global:hivekey', '') %}
{%- set CORTEXKEY = salt['pillar.get']('global:cortexorguserkey', '') %}
{%- set PLAYBOOK_KEY = salt['pillar.get']('global:playbook_api_key', '') %}
{%- set PLAYBOOK_KEY = salt['pillar.get']('playbook:api_key', '') %}
[es]