more stuff
This commit is contained in:
parent
6a43132bc8
commit
79e6a1a543
18 changed files with 426 additions and 144 deletions
|
|
@ -95,10 +95,20 @@ check_layer_0_complete() {
|
|||
}
|
||||
|
||||
get_hosts_from_inventory() {
|
||||
local group="$1"
|
||||
local target="$1"
|
||||
cd "$ANSIBLE_DIR"
|
||||
ansible-inventory -i inventory.ini --list | \
|
||||
python3 -c "import sys, json; data=json.load(sys.stdin); print(' '.join(data.get('$group', {}).get('hosts', [])))" 2>/dev/null || echo ""
|
||||
python3 - "$target" <<'PY' 2>/dev/null || echo ""
|
||||
import json, sys
|
||||
data = json.load(sys.stdin)
|
||||
target = sys.argv[1]
|
||||
if target in data:
|
||||
print(' '.join(data[target].get('hosts', [])))
|
||||
else:
|
||||
hostvars = data.get('_meta', {}).get('hostvars', {})
|
||||
if target in hostvars:
|
||||
print(target)
|
||||
PY
|
||||
}
|
||||
|
||||
check_target_hosts() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue