From 8fa5f1854751fa94e7e62c7091f87982970bdc54 Mon Sep 17 00:00:00 2001 From: Tim Moody Date: Wed, 5 Feb 2020 08:39:47 -0500 Subject: [PATCH 1/2] script to run multiple roles --- runroles | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 runroles diff --git a/runroles b/runroles new file mode 100644 index 000000000..cc7f3b08b --- /dev/null +++ b/runroles @@ -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 " + 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 From 9f3dcfab16a7278ae0d231b0746dd02a31beea88 Mon Sep 17 00:00:00 2001 From: Tim Moody Date: Wed, 5 Feb 2020 08:42:57 -0500 Subject: [PATCH 2/2] more runroles --- runroles | 0 runroles-base.yml | 11 +++++++++++ 2 files changed, 11 insertions(+) mode change 100644 => 100755 runroles create mode 100644 runroles-base.yml diff --git a/runroles b/runroles old mode 100644 new mode 100755 diff --git a/runroles-base.yml b/runroles-base.yml new file mode 100644 index 000000000..55bcb1efd --- /dev/null +++ b/runroles-base.yml @@ -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 }