From d819639f77ba50fefb0ff0f67839df93419ba652 Mon Sep 17 00:00:00 2001 From: Charles Wright Date: Tue, 9 Jan 2024 10:20:38 -0600 Subject: [PATCH] Moved inventory out to a separate repo --- inventory/.gitkeep | 0 inventory/host_vars/.gitkeep | 0 inventory/scripts/ansible-all-hosts.sh | 32 -------------------------- 3 files changed, 32 deletions(-) delete mode 100644 inventory/.gitkeep delete mode 100644 inventory/host_vars/.gitkeep delete mode 100755 inventory/scripts/ansible-all-hosts.sh diff --git a/inventory/.gitkeep b/inventory/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/inventory/host_vars/.gitkeep b/inventory/host_vars/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/inventory/scripts/ansible-all-hosts.sh b/inventory/scripts/ansible-all-hosts.sh deleted file mode 100755 index 3b611ab35..000000000 --- a/inventory/scripts/ansible-all-hosts.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash -# -# Run the playbook on multiple hosts with different credentials with this script -# It defaults to ansible tags "setup-all,start". You can pass alternative tags -# to this script as arguments, e.g. -# -# ./inventory/scripts/ansible-all-hosts.sh self-check -# - -# set playbook root path -root=$(dirname "$(readlink -f "$0")")/../.. - -# set default tags or get from first argument if any -tags="${1:-setup-all,start}" - -# init password array -declare -A pws - -# capture passwords for all hosts -for host in "$root"/inventory/*.yml; do - read -rp "sudo password for $(basename "$host"): " -s pw - pws[$host]="$pw" - echo -done - -# run ansible on all captured passwords/hosts -for host in "${!pws[@]}"; do - ansible-playbook "$root"/setup.yml \ - --inventory-file "$host" \ - --extra-vars "ansible_become_pass=${pws[$host]}" \ - --tags="$tags" -done