Add script to run playbooks
This commit is contained in:
14
ansible/play.sh
Executable file
14
ansible/play.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
playbook_name=$1
|
||||
inventory_path="./inventories/"
|
||||
log_path="../logs"
|
||||
log_file="${log_path}/${playbook_name}.log"
|
||||
|
||||
mkdir -p "${log_path}"
|
||||
|
||||
echo "${playbook_name} started at $(date)" | tee -a "${log_file}"
|
||||
|
||||
{ time ansible-playbook -i "${inventory_path}" "${playbook_name}" ; } 2>&1 | tee -a "${log_file}"
|
||||
|
||||
echo "${playbook_name} finished at $(date)" | tee -a "${log_file}"
|
Reference in New Issue
Block a user