add check vault_pass file

This commit is contained in:
Gilles Mouchet 2024-05-22 00:15:45 +02:00
parent 9849f32eb5
commit e48ef91265

View File

@ -137,14 +137,6 @@ chronyc -a makestep
if [ $? -ne 0 ]; then printError "Problem to update date and time";exit; fi if [ $? -ne 0 ]; then printError "Problem to update date and time";exit; fi
printSuccess "Date and Time updated successfully" printSuccess "Date and Time updated successfully"
#-----------------------------------------------------------------------------
# execute playbook
#-----------------------------------------------------------------------------
printInfo "Execute playbook"
~/.local/bin/ansible-playbook main.yml --vault-password-file ~/ansible/.vault_pass.txt
if [ $? -ne 0 ]; then printError "Problem to execute playbook";exit; fi
printSuccess "Ansible playbook finished"
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# check /root/ansible/.vault_pass.txt exits # check /root/ansible/.vault_pass.txt exits
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
@ -155,6 +147,14 @@ if [ ! -f "/root/ansible/.vault_pass.txt"]; then
fi fi
printSuccess "/root/ansible/.vault_pass.txt exist" printSuccess "/root/ansible/.vault_pass.txt exist"
#-----------------------------------------------------------------------------
# execute playbook
#-----------------------------------------------------------------------------
printInfo "Execute playbook"
~/.local/bin/ansible-playbook main.yml --vault-password-file ~/ansible/.vault_pass.txt
if [ $? -ne 0 ]; then printError "Problem to execute playbook";exit; fi
printSuccess "Ansible playbook finished"
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# set timezone # set timezone
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------