Add script to run playbooks
This commit is contained in:
parent
10343d8f36
commit
94e6d890a8
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}"
|
@ -24,6 +24,13 @@ Some ansible playbooks to manage a [pibox](https://pibox.io) in various ways
|
||||
- If you can't resolve any hosts, check DNS. It's always DNS.
|
||||
1. Proceed to running playbooks
|
||||
|
||||
## Running Playbooks
|
||||
|
||||
It's recommended to use [`play.sh`](./ansible/play.sh) as it will automatically create log files for the playbooks that you execute.
|
||||
|
||||
Its usage is: `./play.sh <playbook-name>`
|
||||
|
||||
|
||||
## Fixing no SSH on latest version
|
||||
|
||||
During install of the custom image, `pi flasher` allowed me to configure things like the hostname, ssid, my ssh key, my user account. This sets up a script that runs when the pi reboots for the first time after install.
|
||||
|
Loading…
Reference in New Issue
Block a user