diff options
| author | alex <alex@pdp7.net> | 2024-12-20 16:59:29 +0100 |
|---|---|---|
| committer | alexpdp7 <alex@corcoles.net> | 2024-12-20 17:00:31 +0100 |
| commit | a4e0694788adc5c082e2d1136391d052bfc0ef5c (patch) | |
| tree | d6e4ee21d7544cc2c9bdb24936fea4b79cfaa53a /personal_infra | |
| parent | 3d285ce726d7dff0558a32e51b633aa66a7035f5 (diff) | |
Get host filter from argv
Due to workstations being offline
Diffstat (limited to 'personal_infra')
| -rwxr-xr-x | personal_infra/inventory_os.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/personal_infra/inventory_os.py b/personal_infra/inventory_os.py index fa759a25..69161961 100755 --- a/personal_infra/inventory_os.py +++ b/personal_infra/inventory_os.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 import json +import sys import subprocess @@ -17,11 +18,13 @@ def parse_ansible(stdout): return result, errors -d = subprocess.run(["rye", "run", "ansible","-o", "-m", "setup", "-a", "filter=ansible_distribution", "!k8s"], stdout=subprocess.PIPE, encoding="utf8") +hosts = sys.argv[1] + +d = subprocess.run(["rye", "run", "ansible","-o", "-m", "setup", "-a", "filter=ansible_distribution", hosts], stdout=subprocess.PIPE, encoding="utf8") d_data, d_errors = parse_ansible(d.stdout) -v = subprocess.run(["rye", "run", "ansible", "-o", "-m", "setup", "-a", "filter=ansible_distribution_major_version", "!k8s"], stdout=subprocess.PIPE, encoding="utf8") +v = subprocess.run(["rye", "run", "ansible", "-o", "-m", "setup", "-a", "filter=ansible_distribution_major_version", hosts], stdout=subprocess.PIPE, encoding="utf8") v_data, v_errors = parse_ansible(v.stdout) |
