1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Merge pull request #13157 from fghaas/lxc

LXC inventory scripts: fix libvirt_lxc, add lxc
This commit is contained in:
Toshio Kuratomi 2015-12-04 10:57:50 -08:00
commit 6472b3daee

View file

@ -27,11 +27,11 @@ result['all'] = {}
pipe = Popen(['virsh', '-q', '-c', 'lxc:///', 'list', '--name', '--all'], stdout=PIPE, universal_newlines=True) pipe = Popen(['virsh', '-q', '-c', 'lxc:///', 'list', '--name', '--all'], stdout=PIPE, universal_newlines=True)
result['all']['hosts'] = [x[:-1] for x in pipe.stdout.readlines()] result['all']['hosts'] = [x[:-1] for x in pipe.stdout.readlines()]
result['all']['vars'] = {} result['all']['vars'] = {}
result['all']['vars']['ansible_connection'] = 'lxc' result['all']['vars']['ansible_connection'] = 'libvirt_lxc'
if len(sys.argv) == 2 and sys.argv[1] == '--list': if len(sys.argv) == 2 and sys.argv[1] == '--list':
print(json.dumps(result)) print(json.dumps(result))
elif len(sys.argv) == 3 and sys.argv[1] == '--host': elif len(sys.argv) == 3 and sys.argv[1] == '--host':
print(json.dumps({'ansible_connection': 'lxc'})) print(json.dumps({'ansible_connection': 'libvirt_lxc'}))
else: else:
print("Need an argument, either --list or --host <host>") print("Need an argument, either --list or --host <host>")