1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

Merge pull request #729 from holta/runrole

Jerry's ./runrole works with Ansible 2.5.0
This commit is contained in:
A Holt 2018-04-03 13:22:42 -04:00 committed by GitHub
commit 457ae20a7e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 41 additions and 0 deletions

13
run-one-role.yml Normal file
View file

@ -0,0 +1,13 @@
---
- hosts: all
become: yes
vars_files:
- vars/default_vars.yml
- vars/{{ ansible_local.local_facts.os_ver }}.yml
- vars/local_vars.yml
- /etc/iiab/config_vars.yml
roles:
- { role: 0-init, tags: ['0-init'] }
- { role: "{{ role_to_run }}", tags: ['run'] }

28
runrole Executable file
View file

@ -0,0 +1,28 @@
#!/bin/bash
INVENTORY="ansible_hosts"
PLAYBOOK="run-one-role.yml"
#PLAYBOOK="iiab-stages.yml"
CWD=`pwd`
export ANSIBLE_LOG_PATH="$CWD/iiab-debug.log"
if [ ! -f $PLAYBOOK ]; then
echo "Exiting: IIAB Playbook not found."
echo "Please run this in /opt/iiab/iiab (top level of the git repo)."
exit 1
fi
# Is the following stanza nec?
if [ ! -f /etc/iiab/config_vars.yml ]; then
mkdir -p /etc/iiab
echo "{}" > /etc/iiab/config_vars.yml
fi
if [[ $# -eq 0 ]] ; then
echo " usage: ./runrole <name of role>"
echo " Can only take a single value."
exit 0
fi
ansible-playbook -i $INVENTORY $PLAYBOOK --connection=local -e "role_to_run=$1"