mirror of
https://github.com/iiab/iiab.git
synced 2025-02-15 04:32:11 +00:00
Merge pull request #2239 from tim-moody/runroles
Add runroles script to run multiple roles
This commit is contained in:
commit
f126c06e6e
2 changed files with 38 additions and 0 deletions
27
runroles
Executable file
27
runroles
Executable file
|
@ -0,0 +1,27 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
INVENTORY=ansible_hosts
|
||||||
|
PLAYBOOK=run-roles-tmp.yml
|
||||||
|
|
||||||
|
CWD=`pwd`
|
||||||
|
if [ ! -f iiab-stages.yml ]; then
|
||||||
|
echo "Exiting: IIAB Playbook not found."
|
||||||
|
echo "Please run this in /opt/iiab/iiab (top level of the git repo)."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $# -eq 0 ]] ; then
|
||||||
|
echo "Usage: ./runroles <list of roles separated by spaces>"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# make working playbook
|
||||||
|
cp runroles-base.yml $PLAYBOOK
|
||||||
|
|
||||||
|
# add desired roles from arguments
|
||||||
|
for role in "$@"
|
||||||
|
do
|
||||||
|
echo " - { role: $role }" >> $PLAYBOOK
|
||||||
|
done
|
||||||
|
|
||||||
|
ansible-playbook -i $INVENTORY $PLAYBOOK --connection=local
|
11
runroles-base.yml
Normal file
11
runroles-base.yml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
---
|
||||||
|
- hosts: all
|
||||||
|
become: yes
|
||||||
|
|
||||||
|
vars_files:
|
||||||
|
- vars/default_vars.yml
|
||||||
|
- vars/{{ ansible_local.local_facts.os_ver }}.yml
|
||||||
|
- /etc/iiab/local_vars.yml
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- { role: 0-init }
|
Loading…
Reference in a new issue