enhancement(ansible/inventory.py) add --quit argument

close #8
This commit is contained in:
egarette@silique.fr 2023-07-28 08:40:46 +02:00
parent 833f6e8d4d
commit d0aaf99890

View file

@ -41,6 +41,7 @@ class RisottoInventory(object):
parser.add_argument('--nocache', action='store_true') parser.add_argument('--nocache', action='store_true')
parser.add_argument('--debug', action='store_true') parser.add_argument('--debug', action='store_true')
parser.add_argument('--pretty_print', action='store_true') parser.add_argument('--pretty_print', action='store_true')
parser.add_argument('--quite', action='store_true')
self.args = parser.parse_args() self.args = parser.parse_args()
if self.args.debug: if self.args.debug:
global DEBUG global DEBUG
@ -75,7 +76,7 @@ class RisottoInventory(object):
'hosts': servers, 'hosts': servers,
'vars': { 'vars': {
# FIXME # FIXME
# 'ansible_ssh_host': '192.168.0.29', 'ansible_ssh_host': '192.168.0.29',
'ansible_ssh_user': 'root', 'ansible_ssh_user': 'root',
'ansible_python_interpreter': '/usr/bin/python3' 'ansible_python_interpreter': '/usr/bin/python3'
} }
@ -119,7 +120,7 @@ def main():
from pprint import pprint from pprint import pprint
from json import loads from json import loads
pprint(loads(values)) pprint(loads(values))
else: elif not inv.args.quite:
print(values) print(values)
except Exception as err: except Exception as err:
if DEBUG: if DEBUG: