mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
more wildcards
This commit is contained in:
parent
1ee08c0f06
commit
8de6cff2b1
30 changed files with 324 additions and 633 deletions
|
@ -1,18 +1,11 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# (c) 2016, Flavio Percoco <flavio@redhat.com>
|
# (c) 2016, Flavio Percoco <flavio@redhat.com>
|
||||||
#
|
#
|
||||||
# This module is free software: you can redistribute it and/or modify
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
from __future__ import absolute_import, division, print_function
|
||||||
# (at your option) any later version.
|
__metaclass__ = type
|
||||||
#
|
|
||||||
# This software is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -102,9 +95,6 @@ EXAMPLES = '''
|
||||||
name: my-memcached
|
name: my-memcached
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import grpc
|
import grpc
|
||||||
from pyhelm import tiller
|
from pyhelm import tiller
|
||||||
|
@ -113,7 +103,6 @@ try:
|
||||||
except ImportError as exc:
|
except ImportError as exc:
|
||||||
HAS_PYHELM = False
|
HAS_PYHELM = False
|
||||||
|
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
|
||||||
|
@ -127,7 +116,7 @@ def install(module, tserver):
|
||||||
|
|
||||||
chartb = chartbuilder.ChartBuilder(chart)
|
chartb = chartbuilder.ChartBuilder(chart)
|
||||||
try:
|
try:
|
||||||
result = tserver.install_release(chartb.get_helm_chart(), namespace,
|
tserver.install_release(chartb.get_helm_chart(), namespace,
|
||||||
dry_run=False, name=name,
|
dry_run=False, name=name,
|
||||||
values=values)
|
values=values)
|
||||||
changed = True
|
changed = True
|
||||||
|
@ -149,7 +138,7 @@ def delete(module, tserver, purge=False):
|
||||||
disable_hooks = params['disable_hooks']
|
disable_hooks = params['disable_hooks']
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result = tserver.uninstall_release(name, disable_hooks, purge)
|
tserver.uninstall_release(name, disable_hooks, purge)
|
||||||
changed = True
|
changed = True
|
||||||
except grpc._channel._Rendezvous as exc:
|
except grpc._channel._Rendezvous as exc:
|
||||||
if 'not found' not in str(exc):
|
if 'not found' not in str(exc):
|
||||||
|
|
|
@ -1,21 +1,11 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
# (c) 2013, Vincent Van der Kussen <vincent at vanderkussen.org>
|
# (c) 2013, Vincent Van der Kussen <vincent at vanderkussen.org>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -268,6 +258,7 @@ ovirt:
|
||||||
rootpw: bigsecret
|
rootpw: bigsecret
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
import time
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from ovirtsdk.api import API
|
from ovirtsdk.api import API
|
||||||
|
@ -276,6 +267,9 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_OVIRTSDK = False
|
HAS_OVIRTSDK = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------- #
|
# ------------------------------------------------------------------- #
|
||||||
# create connection with API
|
# create connection with API
|
||||||
#
|
#
|
||||||
|
@ -524,10 +518,5 @@ def main():
|
||||||
module.exit_json(changed=True, msg="VM %s removed" % vmname)
|
module.exit_json(changed=True, msg="VM %s removed" % vmname)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,18 +1,10 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# This file is part of Ansible
|
# Copyright: Ansible Project
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
from __future__ import absolute_import, division, print_function
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
__metaclass__ = type
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -327,9 +319,7 @@ EXAMPLES = '''
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
# import module snippets
|
import traceback
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible.module_utils.pycompat24 import get_exception
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from proxmoxer import ProxmoxAPI
|
from proxmoxer import ProxmoxAPI
|
||||||
|
@ -337,6 +327,10 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PROXMOXER = False
|
HAS_PROXMOXER = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils._text import to_native
|
||||||
|
|
||||||
|
|
||||||
VZ_TYPE = None
|
VZ_TYPE = None
|
||||||
|
|
||||||
|
|
||||||
|
@ -344,9 +338,9 @@ def get_nextvmid(module, proxmox):
|
||||||
try:
|
try:
|
||||||
vmid = proxmox.cluster.nextid.get()
|
vmid = proxmox.cluster.nextid.get()
|
||||||
return vmid
|
return vmid
|
||||||
except Exception:
|
except Exception as e:
|
||||||
exc = get_exception()
|
module.fail_json(msg="Unable to get next vmid. Failed with exception: %s" % to_native(e),
|
||||||
module.fail_json(msg="Unable to get next vmid. Failed with exception: %s" % exc)
|
exception=traceback.format_exc())
|
||||||
|
|
||||||
|
|
||||||
def get_vmid(proxmox, hostname):
|
def get_vmid(proxmox, hostname):
|
||||||
|
@ -637,7 +631,7 @@ def main():
|
||||||
|
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg="deletion of VM %s failed with exception: %s" % (vmid, e))
|
module.fail_json(msg="deletion of VM %s failed with exception: %s" % (vmid, to_native(e)))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -2,20 +2,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2016, Abdoul Bah (@helldorado) <bahabdoul at gmail.com>
|
# (c) 2016, Abdoul Bah (@helldorado) <bahabdoul at gmail.com>
|
||||||
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
|
|
||||||
|
from __future__ import absolute_import, division, print_function
|
||||||
|
__metaclass__ = type
|
||||||
|
|
||||||
"""
|
|
||||||
Ansible module to manage Qemu(KVM) instance in Proxmox VE cluster.
|
|
||||||
This module is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
This software is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this software. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
"""
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -706,9 +697,7 @@ status:
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
# import module snippets
|
import traceback
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible.module_utils.pycompat24 import get_exception
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from proxmoxer import ProxmoxAPI
|
from proxmoxer import ProxmoxAPI
|
||||||
|
@ -716,6 +705,10 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PROXMOXER = False
|
HAS_PROXMOXER = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils._text import to_native
|
||||||
|
|
||||||
|
|
||||||
VZ_TYPE = 'qemu'
|
VZ_TYPE = 'qemu'
|
||||||
|
|
||||||
|
|
||||||
|
@ -723,9 +716,9 @@ def get_nextvmid(module, proxmox):
|
||||||
try:
|
try:
|
||||||
vmid = proxmox.cluster.nextid.get()
|
vmid = proxmox.cluster.nextid.get()
|
||||||
return vmid
|
return vmid
|
||||||
except Exception:
|
except Exception as e:
|
||||||
exc = get_exception()
|
module.fail_json(msg="Unable to get next vmid. Failed with exception: %s" % to_native(e),
|
||||||
module.fail_json(msg="Unable to get next vmid. Failed with exception: %s" % exc)
|
exception=traceback.format_exc())
|
||||||
|
|
||||||
|
|
||||||
def get_vmid(proxmox, name):
|
def get_vmid(proxmox, name):
|
||||||
|
|
|
@ -1,18 +1,12 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
#
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
# Copyright: Ansible Project
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
#
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
from __future__ import absolute_import, division, print_function
|
||||||
# GNU General Public License for more details.
|
__metaclass__ = type
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -138,8 +132,6 @@ EXAMPLES = '''
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from proxmoxer import ProxmoxAPI
|
from proxmoxer import ProxmoxAPI
|
||||||
|
@ -147,6 +139,8 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PROXMOXER = False
|
HAS_PROXMOXER = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
|
||||||
def get_template(proxmox, node, storage, content_type, template):
|
def get_template(proxmox, node, storage, content_type, template):
|
||||||
return [True for tmpl in proxmox.nodes(node).storage(storage).content.get()
|
return [True for tmpl in proxmox.nodes(node).storage(storage).content.get()
|
||||||
|
|
|
@ -1,21 +1,11 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
# (c) 2016, Timothy Vandenbrande <timothy.vandenbrande@gmail.com>
|
# (c) 2016, Timothy Vandenbrande <timothy.vandenbrande@gmail.com>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -331,9 +321,6 @@ EXAMPLES = '''
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import time
|
import time
|
||||||
import sys
|
|
||||||
import traceback
|
|
||||||
import json
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from ovirtsdk.api import API
|
from ovirtsdk.api import API
|
||||||
|
@ -342,6 +329,9 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_SDK = False
|
HAS_SDK = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
|
||||||
RHEV_FAILED = 1
|
RHEV_FAILED = 1
|
||||||
RHEV_SUCCESS = 0
|
RHEV_SUCCESS = 0
|
||||||
RHEV_UNAVAILABLE = 2
|
RHEV_UNAVAILABLE = 2
|
||||||
|
@ -1024,13 +1014,13 @@ class RHEV(object):
|
||||||
vminfo['cpu_cores'] = VM.cpu.topology.cores
|
vminfo['cpu_cores'] = VM.cpu.topology.cores
|
||||||
vminfo['cpu_sockets'] = VM.cpu.topology.sockets
|
vminfo['cpu_sockets'] = VM.cpu.topology.sockets
|
||||||
vminfo['cpu_shares'] = VM.cpu_shares
|
vminfo['cpu_shares'] = VM.cpu_shares
|
||||||
vminfo['memory'] = (int(VM.memory) / 1024 / 1024 / 1024)
|
vminfo['memory'] = (int(VM.memory) // 1024 // 1024 // 1024)
|
||||||
vminfo['mem_pol'] = (int(VM.memory_policy.guaranteed) / 1024 / 1024 / 1024)
|
vminfo['mem_pol'] = (int(VM.memory_policy.guaranteed) // 1024 // 1024 // 1024)
|
||||||
vminfo['os'] = VM.get_os().type_
|
vminfo['os'] = VM.get_os().type_
|
||||||
vminfo['del_prot'] = VM.delete_protected
|
vminfo['del_prot'] = VM.delete_protected
|
||||||
try:
|
try:
|
||||||
vminfo['host'] = str(self.conn.get_Host_byid(str(VM.host.id)).name)
|
vminfo['host'] = str(self.conn.get_Host_byid(str(VM.host.id)).name)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
vminfo['host'] = None
|
vminfo['host'] = None
|
||||||
vminfo['boot_order'] = []
|
vminfo['boot_order'] = []
|
||||||
for boot_dev in VM.os.get_boot():
|
for boot_dev in VM.os.get_boot():
|
||||||
|
@ -1039,7 +1029,7 @@ class RHEV(object):
|
||||||
for DISK in VM.disks.list():
|
for DISK in VM.disks.list():
|
||||||
disk = dict()
|
disk = dict()
|
||||||
disk['name'] = DISK.name
|
disk['name'] = DISK.name
|
||||||
disk['size'] = (int(DISK.size) / 1024 / 1024 / 1024)
|
disk['size'] = (int(DISK.size) // 1024 // 1024 // 1024)
|
||||||
disk['domain'] = str((self.conn.get_domain_byid(DISK.get_storage_domains().get_storage_domain()[0].id)).name)
|
disk['domain'] = str((self.conn.get_domain_byid(DISK.get_storage_domains().get_storage_domain()[0].id)).name)
|
||||||
disk['interface'] = DISK.interface
|
disk['interface'] = DISK.interface
|
||||||
vminfo['disks'].append(disk)
|
vminfo['disks'].append(disk)
|
||||||
|
@ -1523,8 +1513,5 @@ def main():
|
||||||
module.exit_json(**result)
|
module.exit_json(**result)
|
||||||
|
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -2,22 +2,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2016, Ryan Scott Brown <ryansb@redhat.com>
|
# (c) 2016, Ryan Scott Brown <ryansb@redhat.com>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -125,11 +114,12 @@ command:
|
||||||
sample: serverless deploy --stage production
|
sample: serverless deploy --stage production
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import traceback
|
import traceback
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
|
||||||
def read_serverless_config(module):
|
def read_serverless_config(module):
|
||||||
path = module.params.get('service_path')
|
path = module.params.get('service_path')
|
||||||
|
@ -208,8 +198,6 @@ def main():
|
||||||
module.exit_json(changed=True, state='present', out=out, command=command,
|
module.exit_json(changed=True, state='present', out=out, command=command,
|
||||||
service_name=get_service_name(module, stage))
|
service_name=get_service_name(module, stage))
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,19 +1,15 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
# Copyright 2007, 2012 Red Hat, Inc
|
||||||
Virt management features
|
# Michael DeHaan <michael.dehaan@gmail.com>
|
||||||
|
# Seth Vidal <skvidal@fedoraproject.org>
|
||||||
|
#
|
||||||
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
|
|
||||||
Copyright 2007, 2012 Red Hat, Inc
|
from __future__ import absolute_import, division, print_function
|
||||||
Michael DeHaan <michael.dehaan@gmail.com>
|
__metaclass__ = type
|
||||||
Seth Vidal <skvidal@fedoraproject.org>
|
|
||||||
|
|
||||||
This software may be freely redistributed under the terms of the GNU
|
|
||||||
general public license.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
"""
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -119,11 +115,8 @@ status:
|
||||||
sample: "success"
|
sample: "success"
|
||||||
returned: success
|
returned: success
|
||||||
'''
|
'''
|
||||||
VIRT_FAILED = 1
|
|
||||||
VIRT_SUCCESS = 0
|
|
||||||
VIRT_UNAVAILABLE=2
|
|
||||||
|
|
||||||
import sys
|
import traceback
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import libvirt
|
import libvirt
|
||||||
|
@ -132,6 +125,14 @@ except ImportError:
|
||||||
else:
|
else:
|
||||||
HAS_VIRT = True
|
HAS_VIRT = True
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils._text import to_native
|
||||||
|
|
||||||
|
|
||||||
|
VIRT_FAILED = 1
|
||||||
|
VIRT_SUCCESS = 0
|
||||||
|
VIRT_UNAVAILABLE=2
|
||||||
|
|
||||||
ALL_COMMANDS = []
|
ALL_COMMANDS = []
|
||||||
VM_COMMANDS = ['create','status', 'start', 'stop', 'pause', 'unpause',
|
VM_COMMANDS = ['create','status', 'start', 'stop', 'pause', 'unpause',
|
||||||
'shutdown', 'undefine', 'destroy', 'get_xml', 'define']
|
'shutdown', 'undefine', 'destroy', 'get_xml', 'define']
|
||||||
|
@ -537,9 +538,8 @@ def main():
|
||||||
rc = VIRT_SUCCESS
|
rc = VIRT_SUCCESS
|
||||||
try:
|
try:
|
||||||
rc, result = core(module)
|
rc, result = core(module)
|
||||||
except Exception:
|
except Exception as e:
|
||||||
e = get_exception()
|
module.fail_json(msg=to_native(e), exception=traceback.format_exc())
|
||||||
module.fail_json(msg=str(e))
|
|
||||||
|
|
||||||
if rc != 0: # something went wrong emit the msg
|
if rc != 0: # something went wrong emit the msg
|
||||||
module.fail_json(rc=rc, msg=result)
|
module.fail_json(rc=rc, msg=result)
|
||||||
|
@ -547,9 +547,5 @@ def main():
|
||||||
module.exit_json(**result)
|
module.exit_json(**result)
|
||||||
|
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.pycompat24 import get_exception
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -2,21 +2,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2015, Maciej Delmanowski <drybjed@gmail.com>
|
# (c) 2015, Maciej Delmanowski <drybjed@gmail.com>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -141,11 +131,6 @@ EXAMPLES = '''
|
||||||
name: br_nat
|
name: br_nat
|
||||||
'''
|
'''
|
||||||
|
|
||||||
VIRT_FAILED = 1
|
|
||||||
VIRT_SUCCESS = 0
|
|
||||||
VIRT_UNAVAILABLE=2
|
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import libvirt
|
import libvirt
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
@ -164,6 +149,10 @@ from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils._text import to_native
|
from ansible.module_utils._text import to_native
|
||||||
|
|
||||||
|
|
||||||
|
VIRT_FAILED = 1
|
||||||
|
VIRT_SUCCESS = 0
|
||||||
|
VIRT_UNAVAILABLE=2
|
||||||
|
|
||||||
ALL_COMMANDS = []
|
ALL_COMMANDS = []
|
||||||
ENTRY_COMMANDS = ['create', 'status', 'start', 'stop',
|
ENTRY_COMMANDS = ['create', 'status', 'start', 'stop',
|
||||||
'undefine', 'destroy', 'get_xml', 'define',
|
'undefine', 'destroy', 'get_xml', 'define',
|
||||||
|
|
|
@ -2,21 +2,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2015, Maciej Delmanowski <drybjed@gmail.com>
|
# (c) 2015, Maciej Delmanowski <drybjed@gmail.com>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -156,10 +146,6 @@ EXAMPLES = '''
|
||||||
name: vms
|
name: vms
|
||||||
'''
|
'''
|
||||||
|
|
||||||
VIRT_FAILED = 1
|
|
||||||
VIRT_SUCCESS = 0
|
|
||||||
VIRT_UNAVAILABLE=2
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import libvirt
|
import libvirt
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
@ -177,6 +163,10 @@ else:
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
|
||||||
|
VIRT_FAILED = 1
|
||||||
|
VIRT_SUCCESS = 0
|
||||||
|
VIRT_UNAVAILABLE=2
|
||||||
|
|
||||||
ALL_COMMANDS = []
|
ALL_COMMANDS = []
|
||||||
ENTRY_COMMANDS = ['create', 'status', 'start', 'stop', 'build', 'delete',
|
ENTRY_COMMANDS = ['create', 'status', 'start', 'stop', 'build', 'delete',
|
||||||
'undefine', 'destroy', 'get_xml', 'define', 'refresh']
|
'undefine', 'destroy', 'get_xml', 'define', 'refresh']
|
||||||
|
|
|
@ -1,18 +1,10 @@
|
||||||
#!/usr/bin/python -tt
|
#!/usr/bin/python -tt
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
#
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
# Copyright: Ansible Project
|
||||||
# it under the terms of the GNU General Public License as published by
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
from __future__ import absolute_import, division, print_function
|
||||||
#
|
__metaclass__ = type
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
|
@ -62,6 +54,8 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
|
||||||
class XenServerFacts:
|
class XenServerFacts:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -209,7 +203,6 @@ def main():
|
||||||
|
|
||||||
module.exit_json(ansible=data)
|
module.exit_json(ansible=data)
|
||||||
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -2,22 +2,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2012, Jan-Piet Mens <jpmens () gmail.com>
|
# (c) 2012, Jan-Piet Mens <jpmens () gmail.com>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
# see examples/playbooks/get_url.yml
|
# see examples/playbooks/get_url.yml
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
|
@ -299,9 +288,11 @@ import os
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import traceback
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule, get_exception
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.six.moves.urllib.parse import urlsplit
|
from ansible.module_utils.six.moves.urllib.parse import urlsplit
|
||||||
|
from ansible.module_utils._text import to_native
|
||||||
from ansible.module_utils.urls import fetch_url, url_argument_spec
|
from ansible.module_utils.urls import fetch_url, url_argument_spec
|
||||||
|
|
||||||
# ==============================================================
|
# ==============================================================
|
||||||
|
@ -355,10 +346,10 @@ def url_get(module, url, dest, use_proxy, last_mod_time, force, timeout=10, head
|
||||||
f = os.fdopen(fd, 'wb')
|
f = os.fdopen(fd, 'wb')
|
||||||
try:
|
try:
|
||||||
shutil.copyfileobj(rsp, f)
|
shutil.copyfileobj(rsp, f)
|
||||||
except Exception:
|
except Exception as e:
|
||||||
e = get_exception()
|
|
||||||
os.remove(tempname)
|
os.remove(tempname)
|
||||||
module.fail_json(msg="failed to create temporary content file: %s" % e)
|
module.fail_json(msg="failed to create temporary content file: %s" % to_native(e),
|
||||||
|
exception=traceback.format_exc())
|
||||||
f.close()
|
f.close()
|
||||||
rsp.close()
|
rsp.close()
|
||||||
return tempname, info
|
return tempname, info
|
||||||
|
@ -536,10 +527,10 @@ def main():
|
||||||
if os.path.exists(dest):
|
if os.path.exists(dest):
|
||||||
backup_file = module.backup_local(dest)
|
backup_file = module.backup_local(dest)
|
||||||
shutil.copyfile(tmpsrc, dest)
|
shutil.copyfile(tmpsrc, dest)
|
||||||
except Exception:
|
except Exception as e:
|
||||||
e = get_exception()
|
|
||||||
os.remove(tmpsrc)
|
os.remove(tmpsrc)
|
||||||
module.fail_json(msg="failed to copy %s to %s: %s" % (tmpsrc, dest, e))
|
module.fail_json(msg="failed to copy %s to %s: %s" % (tmpsrc, dest, to_native(e)),
|
||||||
|
exception=traceback.format_exc())
|
||||||
changed = True
|
changed = True
|
||||||
else:
|
else:
|
||||||
changed = False
|
changed = False
|
||||||
|
|
|
@ -2,21 +2,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
|
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['stableinterface'],
|
'status': ['stableinterface'],
|
||||||
|
|
|
@ -2,23 +2,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2013, Romeo Theriault <romeot () hawaii.edu>
|
# (c) 2013, Romeo Theriault <romeot () hawaii.edu>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
# see examples/playbooks/uri.yml
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['stableinterface'],
|
'status': ['stableinterface'],
|
||||||
|
@ -239,19 +227,16 @@ EXAMPLES = '''
|
||||||
|
|
||||||
import cgi
|
import cgi
|
||||||
import datetime
|
import datetime
|
||||||
|
import json
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import traceback
|
||||||
|
|
||||||
try:
|
|
||||||
import json
|
|
||||||
except ImportError:
|
|
||||||
import simplejson as json
|
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.pycompat24 import get_exception
|
|
||||||
import ansible.module_utils.six as six
|
import ansible.module_utils.six as six
|
||||||
from ansible.module_utils._text import to_text
|
from ansible.module_utils._text import to_native, to_text
|
||||||
from ansible.module_utils.urls import fetch_url, url_argument_spec
|
from ansible.module_utils.urls import fetch_url, url_argument_spec
|
||||||
|
|
||||||
|
|
||||||
|
@ -261,10 +246,10 @@ def write_file(module, url, dest, content):
|
||||||
f = open(tmpsrc, 'wb')
|
f = open(tmpsrc, 'wb')
|
||||||
try:
|
try:
|
||||||
f.write(content)
|
f.write(content)
|
||||||
except Exception:
|
except Exception as e:
|
||||||
err = get_exception()
|
|
||||||
os.remove(tmpsrc)
|
os.remove(tmpsrc)
|
||||||
module.fail_json(msg="failed to create temporary content file: %s" % str(err))
|
module.fail_json(msg="failed to create temporary content file: %s" % to_native(e),
|
||||||
|
exception=traceback.format_exc())
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
checksum_src = None
|
checksum_src = None
|
||||||
|
@ -297,10 +282,10 @@ def write_file(module, url, dest, content):
|
||||||
if checksum_src != checksum_dest:
|
if checksum_src != checksum_dest:
|
||||||
try:
|
try:
|
||||||
shutil.copyfile(tmpsrc, dest)
|
shutil.copyfile(tmpsrc, dest)
|
||||||
except Exception:
|
except Exception as e:
|
||||||
err = get_exception()
|
|
||||||
os.remove(tmpsrc)
|
os.remove(tmpsrc)
|
||||||
module.fail_json(msg="failed to copy %s to %s: %s" % (tmpsrc, dest, str(err)))
|
module.fail_json(msg="failed to copy %s to %s: %s" % (tmpsrc, dest, to_native(e)),
|
||||||
|
exception=traceback.format_exc())
|
||||||
|
|
||||||
os.remove(tmpsrc)
|
os.remove(tmpsrc)
|
||||||
|
|
||||||
|
|
|
@ -2,21 +2,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2016 Michael Gruener <michael.gruener@chaosmoon.net>
|
# (c) 2016 Michael Gruener <michael.gruener@chaosmoon.net>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -280,18 +270,11 @@ record:
|
||||||
sample: sample.com
|
sample: sample.com
|
||||||
'''
|
'''
|
||||||
|
|
||||||
try:
|
import json
|
||||||
import json
|
|
||||||
except ImportError:
|
|
||||||
try:
|
|
||||||
import simplejson as json
|
|
||||||
except ImportError:
|
|
||||||
# Let snippet from module_utils/basic.py return a proper error in this case
|
|
||||||
pass
|
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.pycompat24 import get_exception
|
|
||||||
from ansible.module_utils.six.moves.urllib.parse import urlencode
|
from ansible.module_utils.six.moves.urllib.parse import urlencode
|
||||||
|
from ansible.module_utils._text import to_native
|
||||||
from ansible.module_utils.urls import fetch_url
|
from ansible.module_utils.urls import fetch_url
|
||||||
|
|
||||||
|
|
||||||
|
@ -342,9 +325,8 @@ class CloudflareAPI(object):
|
||||||
if payload:
|
if payload:
|
||||||
try:
|
try:
|
||||||
data = json.dumps(payload)
|
data = json.dumps(payload)
|
||||||
except Exception:
|
except Exception as e:
|
||||||
e = get_exception()
|
self.module.fail_json(msg="Failed to encode payload as JSON: %s " % to_native(e))
|
||||||
self.module.fail_json(msg="Failed to encode payload as JSON: %s " % str(e))
|
|
||||||
|
|
||||||
resp, info = fetch_url(self.module,
|
resp, info = fetch_url(self.module,
|
||||||
self.cf_api_endpoint + api_call,
|
self.cf_api_endpoint + api_call,
|
||||||
|
|
|
@ -1,18 +1,10 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# This file is part of Ansible
|
# Copyright: Ansible Project
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
from __future__ import absolute_import, division, print_function
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
__metaclass__ = type
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -169,6 +161,7 @@ EXAMPLES = '''
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from dnsimple import DNSimple
|
from dnsimple import DNSimple
|
||||||
from dnsimple.dnsimple import DNSimpleException
|
from dnsimple.dnsimple import DNSimpleException
|
||||||
|
@ -176,6 +169,9 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_DNSIMPLE = False
|
HAS_DNSIMPLE = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=dict(
|
argument_spec=dict(
|
||||||
|
@ -338,15 +334,11 @@ def main():
|
||||||
else:
|
else:
|
||||||
module.fail_json(msg="'%s' is an unknown value for the state argument" % state)
|
module.fail_json(msg="'%s' is an unknown value for the state argument" % state)
|
||||||
|
|
||||||
except DNSimpleException:
|
except DNSimpleException as e:
|
||||||
e = get_exception()
|
|
||||||
module.fail_json(msg="Unable to contact DNSimple: %s" % e.message)
|
module.fail_json(msg="Unable to contact DNSimple: %s" % e.message)
|
||||||
|
|
||||||
module.fail_json(msg="Unknown what you wanted me to do")
|
module.fail_json(msg="Unknown what you wanted me to do")
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.pycompat24 import get_exception
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,18 +1,10 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# This file is part of Ansible
|
# Copyright: Ansible Project
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
from __future__ import absolute_import, division, print_function
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
__metaclass__ = type
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -717,7 +709,7 @@ def main():
|
||||||
module.exit_json(changed=True)
|
module.exit_json(changed=True)
|
||||||
|
|
||||||
# record does not exist, return w/o change.
|
# record does not exist, return w/o change.
|
||||||
module.exit_json(changed=False)
|
module.exit_json(changed=changed)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
module.fail_json(
|
module.fail_json(
|
||||||
|
|
|
@ -2,21 +2,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# (c) 2016, René Moser <mail@renemoser.net>
|
# (c) 2016, René Moser <mail@renemoser.net>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -186,11 +176,7 @@ exo_dns_domain:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.exoscale import (
|
from ansible.module_utils.exoscale import ExoDns, exo_dns_argument_spec, exo_dns_required_together
|
||||||
ExoDns,
|
|
||||||
exo_dns_argument_spec,
|
|
||||||
exo_dns_required_together
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class ExoDnsDomain(ExoDns):
|
class ExoDnsDomain(ExoDns):
|
||||||
|
|
|
@ -2,21 +2,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# (c) 2016, René Moser <mail@renemoser.net>
|
# (c) 2016, René Moser <mail@renemoser.net>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -246,11 +236,8 @@ exo_dns_record:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.exoscale import (
|
from ansible.module_utils.exoscale import ExoDns, exo_dns_argument_spec, exo_dns_required_together
|
||||||
ExoDns,
|
|
||||||
exo_dns_argument_spec,
|
|
||||||
exo_dns_required_together
|
|
||||||
)
|
|
||||||
|
|
||||||
EXO_RECORD_TYPES = [
|
EXO_RECORD_TYPES = [
|
||||||
'A',
|
'A',
|
||||||
|
|
|
@ -2,21 +2,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2014, Ravi Bhure <ravibhure@gmail.com>
|
# (c) 2014, Ravi Bhure <ravibhure@gmail.com>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -184,11 +174,13 @@ EXAMPLES = '''
|
||||||
backend: www
|
backend: www
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import socket
|
|
||||||
import csv
|
import csv
|
||||||
|
import socket
|
||||||
import time
|
import time
|
||||||
from string import Template
|
from string import Template
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_SOCKET_LOCATION = "/var/run/haproxy.sock"
|
DEFAULT_SOCKET_LOCATION = "/var/run/haproxy.sock"
|
||||||
RECV_SIZE = 1024
|
RECV_SIZE = 1024
|
||||||
|
@ -429,8 +421,6 @@ def main():
|
||||||
ansible_haproxy = HAProxy(module)
|
ansible_haproxy = HAProxy(module)
|
||||||
ansible_haproxy.act()
|
ansible_haproxy.act()
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -2,21 +2,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# (c) 2015, René Moser <mail@renemoser.net>
|
# (c) 2015, René Moser <mail@renemoser.net>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -75,14 +65,7 @@ ipify_public_ip:
|
||||||
sample: 1.2.3.4
|
sample: 1.2.3.4
|
||||||
'''
|
'''
|
||||||
|
|
||||||
try:
|
import json
|
||||||
import json
|
|
||||||
except ImportError:
|
|
||||||
try:
|
|
||||||
import simplejson as json
|
|
||||||
except ImportError:
|
|
||||||
# Let snippet from module_utils/basic.py return a proper error in this case
|
|
||||||
pass
|
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.urls import fetch_url
|
from ansible.module_utils.urls import fetch_url
|
||||||
|
@ -124,5 +107,6 @@ def main():
|
||||||
ipify_facts_result = dict(changed=False, ansible_facts=ipify_facts)
|
ipify_facts_result = dict(changed=False, ansible_facts=ipify_facts)
|
||||||
module.exit_json(**ipify_facts_result)
|
module.exit_json(**ipify_facts_result)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,21 +1,11 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
#
|
#
|
||||||
# (c) 2016, Aleksei Kostiuk <unitoff@gmail.com>
|
# (c) 2016, Aleksei Kostiuk <unitoff@gmail.com>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -90,6 +80,10 @@ ansible_facts:
|
||||||
type: string
|
type: string
|
||||||
sample: "94035"
|
sample: "94035"
|
||||||
'''
|
'''
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
from ansible.module_utils.urls import fetch_url
|
||||||
|
|
||||||
|
|
||||||
USER_AGENT = 'ansible-ipinfoio-module/0.0.1'
|
USER_AGENT = 'ansible-ipinfoio-module/0.0.1'
|
||||||
|
|
||||||
|
@ -135,8 +129,6 @@ def main():
|
||||||
changed=False, ansible_facts=ipinfoio.get_geo_data())
|
changed=False, ansible_facts=ipinfoio.get_geo_data())
|
||||||
module.exit_json(**ipinfoio_result)
|
module.exit_json(**ipinfoio_result)
|
||||||
|
|
||||||
from ansible.module_utils.basic import * # NOQA
|
|
||||||
from ansible.module_utils.urls import * # NOQA
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -4,20 +4,11 @@
|
||||||
# (c) 2016, Peter Sagerson <psagers@ignorare.net>
|
# (c) 2016, Peter Sagerson <psagers@ignorare.net>
|
||||||
# (c) 2016, Jiri Tyr <jiri.tyr@gmail.com>
|
# (c) 2016, Jiri Tyr <jiri.tyr@gmail.com>
|
||||||
#
|
#
|
||||||
# This file is part of Ansible
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
#
|
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
from __future__ import absolute_import, division, print_function
|
||||||
# it under the terms of the GNU General Public License as published by
|
__metaclass__ = type
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -193,8 +184,7 @@ modlist:
|
||||||
sample: '[[2, "olcRootDN", ["cn=root,dc=example,dc=com"]]]'
|
sample: '[[2, "olcRootDN", ["cn=root,dc=example,dc=com"]]]'
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
import traceback
|
||||||
from ansible.module_utils.pycompat24 import get_exception
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import ldap
|
import ldap
|
||||||
|
@ -204,6 +194,9 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_LDAP = False
|
HAS_LDAP = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils._text import to_native
|
||||||
|
|
||||||
|
|
||||||
class LdapAttr(object):
|
class LdapAttr(object):
|
||||||
def __init__(self, module):
|
def __init__(self, module):
|
||||||
|
@ -251,11 +244,10 @@ class LdapAttr(object):
|
||||||
try:
|
try:
|
||||||
results = self.connection.search_s(
|
results = self.connection.search_s(
|
||||||
self.dn, ldap.SCOPE_BASE, attrlist=[self.name])
|
self.dn, ldap.SCOPE_BASE, attrlist=[self.name])
|
||||||
except ldap.LDAPError:
|
except ldap.LDAPError as e:
|
||||||
e = get_exception()
|
|
||||||
self.module.fail_json(
|
self.module.fail_json(
|
||||||
msg="Cannot search for attribute %s" % self.name,
|
msg="Cannot search for attribute %s" % self.name,
|
||||||
details=str(e))
|
details=to_native(e))
|
||||||
|
|
||||||
current = results[0][1].get(self.name, [])
|
current = results[0][1].get(self.name, [])
|
||||||
modlist = []
|
modlist = []
|
||||||
|
@ -293,19 +285,17 @@ class LdapAttr(object):
|
||||||
if self.start_tls:
|
if self.start_tls:
|
||||||
try:
|
try:
|
||||||
connection.start_tls_s()
|
connection.start_tls_s()
|
||||||
except ldap.LDAPError:
|
except ldap.LDAPError as e:
|
||||||
e = get_exception()
|
self.module.fail_json(msg="Cannot start TLS.", details=to_native(e))
|
||||||
self.module.fail_json(msg="Cannot start TLS.", details=str(e))
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if self.bind_dn is not None:
|
if self.bind_dn is not None:
|
||||||
connection.simple_bind_s(self.bind_dn, self.bind_pw)
|
connection.simple_bind_s(self.bind_dn, self.bind_pw)
|
||||||
else:
|
else:
|
||||||
connection.sasl_interactive_bind_s('', ldap.sasl.external())
|
connection.sasl_interactive_bind_s('', ldap.sasl.external())
|
||||||
except ldap.LDAPError:
|
except ldap.LDAPError as e:
|
||||||
e = get_exception()
|
|
||||||
self.module.fail_json(
|
self.module.fail_json(
|
||||||
msg="Cannot bind to the server.", details=str(e))
|
msg="Cannot bind to the server.", details=to_native(e))
|
||||||
|
|
||||||
return connection
|
return connection
|
||||||
|
|
||||||
|
@ -360,10 +350,9 @@ def main():
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
try:
|
try:
|
||||||
ldap.connection.modify_s(ldap.dn, modlist)
|
ldap.connection.modify_s(ldap.dn, modlist)
|
||||||
except Exception:
|
except Exception as e:
|
||||||
e = get_exception()
|
module.fail_json(msg="Attribute action failed.", details=to_native(e),
|
||||||
module.fail_json(
|
exception=traceback.format_exc())
|
||||||
msg="Attribute action failed.", details=str(e))
|
|
||||||
|
|
||||||
module.exit_json(changed=changed, modlist=modlist)
|
module.exit_json(changed=changed, modlist=modlist)
|
||||||
|
|
||||||
|
|
|
@ -4,20 +4,11 @@
|
||||||
# (c) 2016, Peter Sagerson <psagers@ignorare.net>
|
# (c) 2016, Peter Sagerson <psagers@ignorare.net>
|
||||||
# (c) 2016, Jiri Tyr <jiri.tyr@gmail.com>
|
# (c) 2016, Jiri Tyr <jiri.tyr@gmail.com>
|
||||||
#
|
#
|
||||||
# This file is part of Ansible
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
#
|
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
from __future__ import absolute_import, division, print_function
|
||||||
# it under the terms of the GNU General Public License as published by
|
__metaclass__ = type
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
|
|
@ -1,18 +1,11 @@
|
||||||
#!/usr/bin/python -tt
|
#!/usr/bin/python -tt
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
#
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
# Copyright: Ansible Project
|
||||||
# it under the terms of the GNU General Public License as published by
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
from __future__ import absolute_import, division, print_function
|
||||||
#
|
__metaclass__ = type
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -50,12 +43,15 @@ EXAMPLES = '''
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
|
||||||
def gather_lldp(module):
|
def gather_lldp(module):
|
||||||
cmd = ['lldpctl', '-f', 'keyvalue']
|
cmd = ['lldpctl', '-f', 'keyvalue']
|
||||||
rc, output, err = module.run_command(cmd)
|
rc, output, err = module.run_command(cmd)
|
||||||
if output:
|
if output:
|
||||||
output_dict = {}
|
output_dict = {}
|
||||||
|
current_dict = {}
|
||||||
lldp_entries = output.split("\n")
|
lldp_entries = output.split("\n")
|
||||||
|
|
||||||
for entry in lldp_entries:
|
for entry in lldp_entries:
|
||||||
|
@ -84,8 +80,6 @@ def main():
|
||||||
except TypeError:
|
except TypeError:
|
||||||
module.fail_json(msg="lldpctl command failed. is lldpd running?")
|
module.fail_json(msg="lldpctl command failed. is lldpd running?")
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -2,21 +2,10 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2015, Chris Long <alcamie@gmail.com> <chlong@redhat.com>
|
# (c) 2015, Chris Long <alcamie@gmail.com> <chlong@redhat.com>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is a module for Ansible that interacts with Network Manager
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
|
@ -491,9 +480,7 @@ EXAMPLES='''
|
||||||
# - 9 nmcli and NetworkManager versions mismatch
|
# - 9 nmcli and NetworkManager versions mismatch
|
||||||
# - 10 Connection, device, or access point does not exist.
|
# - 10 Connection, device, or access point does not exist.
|
||||||
'''
|
'''
|
||||||
# import ansible.module_utils.basic
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
HAVE_DBUS=False
|
HAVE_DBUS=False
|
||||||
try:
|
try:
|
||||||
import dbus
|
import dbus
|
||||||
|
@ -607,7 +594,7 @@ class Nmcli(object):
|
||||||
for setting in secrets:
|
for setting in secrets:
|
||||||
for key in secrets[setting]:
|
for key in secrets[setting]:
|
||||||
config[setting_name][key]=secrets[setting][key]
|
config[setting_name][key]=secrets[setting][key]
|
||||||
except Exception as e:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def dict_to_string(self, d):
|
def dict_to_string(self, d):
|
||||||
|
@ -639,7 +626,7 @@ class Nmcli(object):
|
||||||
for setting_name in config:
|
for setting_name in config:
|
||||||
setting_list.append(self.dict_to_string(config[setting_name]))
|
setting_list.append(self.dict_to_string(config[setting_name]))
|
||||||
return setting_list
|
return setting_list
|
||||||
# print ""
|
# print("")
|
||||||
|
|
||||||
def bool_to_string(self, boolean):
|
def bool_to_string(self, boolean):
|
||||||
if boolean:
|
if boolean:
|
||||||
|
@ -1198,5 +1185,6 @@ def main():
|
||||||
|
|
||||||
module.exit_json(**result)
|
module.exit_json(**result)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,27 +1,16 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
"""
|
# (c) 2016, Marcin Skarbek <github@skarbek.name>
|
||||||
Ansible module to manage DNS records using dnspython
|
# (c) 2016, Andreas Olsson <andreas@arrakis.se>
|
||||||
(c) 2016, Marcin Skarbek <github@skarbek.name>
|
# (c) 2017, Loic Blot <loic.blot@unix-experience.fr>
|
||||||
(c) 2016, Andreas Olsson <andreas@arrakis.se>
|
#
|
||||||
(c) 2017, Loic Blot <loic.blot@unix-experience.fr>
|
# This module was ported from https://github.com/mskarbek/ansible-nsupdate
|
||||||
|
#
|
||||||
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
|
|
||||||
This module was ported from https://github.com/mskarbek/ansible-nsupdate
|
from __future__ import absolute_import, division, print_function
|
||||||
|
__metaclass__ = type
|
||||||
|
|
||||||
This file is part of Ansible
|
|
||||||
|
|
||||||
Ansible is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
Ansible is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
"""
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -151,9 +140,6 @@ dns_rc_str:
|
||||||
from binascii import Error as binascii_error
|
from binascii import Error as binascii_error
|
||||||
from socket import error as socket_error
|
from socket import error as socket_error
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible.module_utils.pycompat24 import get_exception
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import dns.update
|
import dns.update
|
||||||
import dns.query
|
import dns.query
|
||||||
|
@ -165,6 +151,9 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAVE_DNSPYTHON = False
|
HAVE_DNSPYTHON = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils._text import to_native
|
||||||
|
|
||||||
|
|
||||||
class RecordManager(object):
|
class RecordManager(object):
|
||||||
def __init__(self, module):
|
def __init__(self, module):
|
||||||
|
@ -182,9 +171,8 @@ class RecordManager(object):
|
||||||
})
|
})
|
||||||
except TypeError:
|
except TypeError:
|
||||||
module.fail_json(msg='Missing key_secret')
|
module.fail_json(msg='Missing key_secret')
|
||||||
except binascii_error:
|
except binascii_error as e:
|
||||||
e = get_exception()
|
module.fail_json(msg='TSIG key error: %s' % to_native(e))
|
||||||
module.fail_json(msg='TSIG key error: %s' % str(e))
|
|
||||||
else:
|
else:
|
||||||
self.keyring = None
|
self.keyring = None
|
||||||
|
|
||||||
|
@ -199,12 +187,10 @@ class RecordManager(object):
|
||||||
response = None
|
response = None
|
||||||
try:
|
try:
|
||||||
response = dns.query.tcp(update, self.module.params['server'], timeout=10)
|
response = dns.query.tcp(update, self.module.params['server'], timeout=10)
|
||||||
except (dns.tsig.PeerBadKey, dns.tsig.PeerBadSignature):
|
except (dns.tsig.PeerBadKey, dns.tsig.PeerBadSignature) as e:
|
||||||
e = get_exception()
|
self.module.fail_json(msg='TSIG update error (%s): %s' % (e.__class__.__name__, to_native(e)))
|
||||||
self.module.fail_json(msg='TSIG update error (%s): %s' % (e.__class__.__name__, str(e)))
|
except (socket_error, dns.exception.Timeout) as e:
|
||||||
except (socket_error, dns.exception.Timeout):
|
self.module.fail_json(msg='DNS server error: (%s): %s' % (e.__class__.__name__, to_native(e)))
|
||||||
e = get_exception()
|
|
||||||
self.module.fail_json(msg='DNS server error: (%s): %s' % (e.__class__.__name__, str(e)))
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
def create_or_update_record(self):
|
def create_or_update_record(self):
|
||||||
|
@ -288,9 +274,8 @@ class RecordManager(object):
|
||||||
update = dns.update.Update(self.zone, keyring=self.keyring, keyalgorithm=self.algorithm)
|
update = dns.update.Update(self.zone, keyring=self.keyring, keyalgorithm=self.algorithm)
|
||||||
try:
|
try:
|
||||||
update.present(self.module.params['record'], self.module.params['type'])
|
update.present(self.module.params['record'], self.module.params['type'])
|
||||||
except dns.rdatatype.UnknownRdatatype:
|
except dns.rdatatype.UnknownRdatatype as e:
|
||||||
e = get_exception()
|
self.module.fail_json(msg='Record error: {0}'.format(to_native(e)))
|
||||||
self.module.fail_json(msg='Record error: {}'.format(str(e)))
|
|
||||||
|
|
||||||
response = self.__do_update(update)
|
response = self.__do_update(update)
|
||||||
self.dns_rc = dns.message.Message.rcode(response)
|
self.dns_rc = dns.message.Message.rcode(response)
|
||||||
|
|
|
@ -1,26 +1,15 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
# (c) 2016, Loic Blot <loic.blot@unix-experience.fr>
|
||||||
Ansible module to configure DHCPd hosts using OMAPI protocol
|
# Sponsored by Infopro Digital. http://www.infopro-digital.com/
|
||||||
(c) 2016, Loic Blot <loic.blot@unix-experience.fr>
|
# Sponsored by E.T.A.I. http://www.etai.fr/
|
||||||
Sponsored by Infopro Digital. http://www.infopro-digital.com/
|
#
|
||||||
Sponsored by E.T.A.I. http://www.etai.fr/
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
|
|
||||||
This file is part of Ansible
|
from __future__ import absolute_import, division, print_function
|
||||||
|
__metaclass__ = type
|
||||||
|
|
||||||
Ansible is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
Ansible is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
"""
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -141,12 +130,10 @@ lease:
|
||||||
sample: 'mydesktop'
|
sample: 'mydesktop'
|
||||||
'''
|
'''
|
||||||
|
|
||||||
# import module snippets
|
import binascii
|
||||||
from ansible.module_utils.basic import AnsibleModule, get_exception, to_bytes
|
|
||||||
from ansible.module_utils.six import iteritems
|
|
||||||
import socket
|
import socket
|
||||||
import struct
|
import struct
|
||||||
import binascii
|
import traceback
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from pypureomapi import Omapi, OmapiMessage, OmapiError, OmapiErrorNotFound
|
from pypureomapi import Omapi, OmapiMessage, OmapiError, OmapiErrorNotFound
|
||||||
|
@ -156,6 +143,9 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pureomapi_found = False
|
pureomapi_found = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils._text import to_bytes, to_native
|
||||||
|
|
||||||
|
|
||||||
class OmapiHostManager:
|
class OmapiHostManager:
|
||||||
def __init__(self, module):
|
def __init__(self, module):
|
||||||
|
@ -169,13 +159,11 @@ class OmapiHostManager:
|
||||||
self.module.params['key'])
|
self.module.params['key'])
|
||||||
except binascii.Error:
|
except binascii.Error:
|
||||||
self.module.fail_json(msg="Unable to open OMAPI connection. 'key' is not a valid base64 key.")
|
self.module.fail_json(msg="Unable to open OMAPI connection. 'key' is not a valid base64 key.")
|
||||||
except OmapiError:
|
except OmapiError as e:
|
||||||
e = get_exception()
|
|
||||||
self.module.fail_json(msg="Unable to open OMAPI connection. Ensure 'host', 'port', 'key' and 'key_name' "
|
self.module.fail_json(msg="Unable to open OMAPI connection. Ensure 'host', 'port', 'key' and 'key_name' "
|
||||||
"are valid. Exception was: %s" % e)
|
"are valid. Exception was: %s" % to_native(e))
|
||||||
except socket.error:
|
except socket.error as e:
|
||||||
e = get_exception()
|
self.module.fail_json(msg="Unable to connect to OMAPI server: %s" % to_native(e))
|
||||||
self.module.fail_json(msg="Unable to connect to OMAPI server: %s" % e)
|
|
||||||
|
|
||||||
def get_host(self, macaddr):
|
def get_host(self, macaddr):
|
||||||
msg = OmapiMessage.open(to_bytes("host", errors='surrogate_or_strict'))
|
msg = OmapiMessage.open(to_bytes("host", errors='surrogate_or_strict'))
|
||||||
|
@ -225,9 +213,9 @@ class OmapiHostManager:
|
||||||
if len(self.module.params['statements']) > 0:
|
if len(self.module.params['statements']) > 0:
|
||||||
stmt_join += "; ".join(self.module.params['statements'])
|
stmt_join += "; ".join(self.module.params['statements'])
|
||||||
stmt_join += "; "
|
stmt_join += "; "
|
||||||
except TypeError:
|
except TypeError as e:
|
||||||
e = get_exception()
|
self.module.fail_json(msg="Invalid statements found: %s" % to_native(e),
|
||||||
self.module.fail_json(msg="Invalid statements found: %s" % e)
|
exception=traceback.format_exc())
|
||||||
|
|
||||||
if len(stmt_join) > 0:
|
if len(stmt_join) > 0:
|
||||||
msg.obj.append(('statements', stmt_join))
|
msg.obj.append(('statements', stmt_join))
|
||||||
|
@ -238,9 +226,8 @@ class OmapiHostManager:
|
||||||
self.module.fail_json(msg="Failed to add host, ensure authentication and host parameters "
|
self.module.fail_json(msg="Failed to add host, ensure authentication and host parameters "
|
||||||
"are valid.")
|
"are valid.")
|
||||||
self.module.exit_json(changed=True, lease=self.unpack_facts(response.obj))
|
self.module.exit_json(changed=True, lease=self.unpack_facts(response.obj))
|
||||||
except OmapiError:
|
except OmapiError as e:
|
||||||
e = get_exception()
|
self.module.fail_json(msg="OMAPI error: %s" % to_native(e), exception=traceback.format_exc())
|
||||||
self.module.fail_json(msg="OMAPI error: %s" % e)
|
|
||||||
# Forge update message
|
# Forge update message
|
||||||
else:
|
else:
|
||||||
response_obj = self.unpack_facts(host_response.obj)
|
response_obj = self.unpack_facts(host_response.obj)
|
||||||
|
@ -276,9 +263,8 @@ class OmapiHostManager:
|
||||||
self.module.fail_json(msg="Failed to modify host, ensure authentication and host parameters "
|
self.module.fail_json(msg="Failed to modify host, ensure authentication and host parameters "
|
||||||
"are valid.")
|
"are valid.")
|
||||||
self.module.exit_json(changed=True)
|
self.module.exit_json(changed=True)
|
||||||
except OmapiError:
|
except OmapiError as e:
|
||||||
e = get_exception()
|
self.module.fail_json(msg="OMAPI error: %s" % to_native(e), exception=traceback.format_exc())
|
||||||
self.module.fail_json(msg="OMAPI error: %s" % e)
|
|
||||||
|
|
||||||
def remove_host(self):
|
def remove_host(self):
|
||||||
try:
|
try:
|
||||||
|
@ -286,9 +272,8 @@ class OmapiHostManager:
|
||||||
self.module.exit_json(changed=True)
|
self.module.exit_json(changed=True)
|
||||||
except OmapiErrorNotFound:
|
except OmapiErrorNotFound:
|
||||||
self.module.exit_json()
|
self.module.exit_json()
|
||||||
except OmapiError:
|
except OmapiError as e:
|
||||||
e = get_exception()
|
self.module.fail_json(msg="OMAPI error: %s" % to_native(e), exception=traceback.format_exc())
|
||||||
self.module.fail_json(msg="OMAPI error: %s" % e)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
@ -323,9 +308,9 @@ def main():
|
||||||
host_manager.setup_host()
|
host_manager.setup_host()
|
||||||
elif module.params['state'] == 'absent':
|
elif module.params['state'] == 'absent':
|
||||||
host_manager.remove_host()
|
host_manager.remove_host()
|
||||||
except ValueError:
|
except ValueError as e:
|
||||||
e = get_exception()
|
module.fail_json(msg="OMAPI input value error: %s" % to_native(e), exception=traceback.format_exc())
|
||||||
module.fail_json(msg="OMAPI input value error: %s" % e)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,19 +1,10 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
# This file is part of Networklore's snmp library for Ansible
|
# This file is part of Networklore's snmp library for Ansible
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# The module is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
from __future__ import absolute_import, division, print_function
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
__metaclass__ = type
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# The module is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
|
@ -97,10 +88,6 @@ EXAMPLES = '''
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import binascii
|
import binascii
|
||||||
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils._text import to_text
|
|
||||||
|
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -109,6 +96,10 @@ try:
|
||||||
except:
|
except:
|
||||||
has_pysnmp = False
|
has_pysnmp = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils._text import to_text
|
||||||
|
|
||||||
|
|
||||||
class DefineOid(object):
|
class DefineOid(object):
|
||||||
|
|
||||||
def __init__(self,dotprefix=False):
|
def __init__(self,dotprefix=False):
|
||||||
|
|
|
@ -23,7 +23,6 @@ metaclass3=$(find ./lib/ansible/modules -path ./lib/ansible/modules/windows -pru
|
||||||
-o -path ./lib/ansible/modules/packaging -prune \
|
-o -path ./lib/ansible/modules/packaging -prune \
|
||||||
-o -path ./lib/ansible/modules/notification -prune \
|
-o -path ./lib/ansible/modules/notification -prune \
|
||||||
-o -path ./lib/ansible/modules/network -prune \
|
-o -path ./lib/ansible/modules/network -prune \
|
||||||
-o -path ./lib/ansible/modules/net_tools -prune \
|
|
||||||
-o -path ./lib/ansible/modules/monitoring -prune \
|
-o -path ./lib/ansible/modules/monitoring -prune \
|
||||||
-o -path ./lib/ansible/modules/identity -prune \
|
-o -path ./lib/ansible/modules/identity -prune \
|
||||||
-o -path ./lib/ansible/modules/files -prune \
|
-o -path ./lib/ansible/modules/files -prune \
|
||||||
|
@ -32,7 +31,6 @@ metaclass3=$(find ./lib/ansible/modules -path ./lib/ansible/modules/windows -pru
|
||||||
-o -path ./lib/ansible/modules/cloud/rackspace -prune \
|
-o -path ./lib/ansible/modules/cloud/rackspace -prune \
|
||||||
-o -path ./lib/ansible/modules/cloud/ovirt -prune \
|
-o -path ./lib/ansible/modules/cloud/ovirt -prune \
|
||||||
-o -path ./lib/ansible/modules/cloud/openstack -prune \
|
-o -path ./lib/ansible/modules/cloud/openstack -prune \
|
||||||
-o -path ./lib/ansible/modules/cloud/misc -prune \
|
|
||||||
-o -path ./lib/ansible/modules/cloud/google -prune \
|
-o -path ./lib/ansible/modules/cloud/google -prune \
|
||||||
-o -path ./lib/ansible/modules/cloud/cloudstack -prune \
|
-o -path ./lib/ansible/modules/cloud/cloudstack -prune \
|
||||||
-o -path ./lib/ansible/modules/cloud/centurylink -prune \
|
-o -path ./lib/ansible/modules/cloud/centurylink -prune \
|
||||||
|
@ -44,7 +42,6 @@ future3=$(find ./lib/ansible/modules -path ./lib/ansible/modules/windows -prune
|
||||||
-o -path ./lib/ansible/modules/packaging -prune \
|
-o -path ./lib/ansible/modules/packaging -prune \
|
||||||
-o -path ./lib/ansible/modules/notification -prune \
|
-o -path ./lib/ansible/modules/notification -prune \
|
||||||
-o -path ./lib/ansible/modules/network -prune \
|
-o -path ./lib/ansible/modules/network -prune \
|
||||||
-o -path ./lib/ansible/modules/net_tools -prune \
|
|
||||||
-o -path ./lib/ansible/modules/monitoring -prune \
|
-o -path ./lib/ansible/modules/monitoring -prune \
|
||||||
-o -path ./lib/ansible/modules/identity -prune \
|
-o -path ./lib/ansible/modules/identity -prune \
|
||||||
-o -path ./lib/ansible/modules/files -prune \
|
-o -path ./lib/ansible/modules/files -prune \
|
||||||
|
@ -53,7 +50,6 @@ future3=$(find ./lib/ansible/modules -path ./lib/ansible/modules/windows -prune
|
||||||
-o -path ./lib/ansible/modules/cloud/rackspace -prune \
|
-o -path ./lib/ansible/modules/cloud/rackspace -prune \
|
||||||
-o -path ./lib/ansible/modules/cloud/ovirt -prune \
|
-o -path ./lib/ansible/modules/cloud/ovirt -prune \
|
||||||
-o -path ./lib/ansible/modules/cloud/openstack -prune \
|
-o -path ./lib/ansible/modules/cloud/openstack -prune \
|
||||||
-o -path ./lib/ansible/modules/cloud/misc -prune \
|
|
||||||
-o -path ./lib/ansible/modules/cloud/google -prune \
|
-o -path ./lib/ansible/modules/cloud/google -prune \
|
||||||
-o -path ./lib/ansible/modules/cloud/cloudstack -prune \
|
-o -path ./lib/ansible/modules/cloud/cloudstack -prune \
|
||||||
-o -path ./lib/ansible/modules/cloud/centurylink -prune \
|
-o -path ./lib/ansible/modules/cloud/centurylink -prune \
|
||||||
|
@ -61,24 +57,23 @@ future3=$(find ./lib/ansible/modules -path ./lib/ansible/modules/windows -prune
|
||||||
-o -name '*.py' -type f -size +0c -exec egrep -HL 'from __future__ import (?absolute_import, division, print_function)?' '{}' '+')
|
-o -name '*.py' -type f -size +0c -exec egrep -HL 'from __future__ import (?absolute_import, division, print_function)?' '{}' '+')
|
||||||
|
|
||||||
# Ordered by approximate work, lowest to highest
|
# Ordered by approximate work, lowest to highest
|
||||||
# cloud/misc
|
# cloud/google *
|
||||||
# cloud/google
|
# identity !
|
||||||
# identity
|
# source_control *i
|
||||||
# cloud/source_control
|
# cloud/centurylink *
|
||||||
# cloud/centurylink
|
# database ;; break up *!
|
||||||
# database ;; break up
|
# cloud/rackspace *
|
||||||
# net-tools
|
# cloud/vmware *i
|
||||||
# cloud/rackspace
|
# files !
|
||||||
# cloud/vmware
|
# cloud/openstack *
|
||||||
# files
|
# monitoring *!
|
||||||
# cloud/openstack
|
# notification *!
|
||||||
# monitoring
|
# cloud/cloudstack *
|
||||||
# cloud/notification
|
|
||||||
# cloud/cloudstack
|
|
||||||
# cloud/ovirt
|
# cloud/ovirt
|
||||||
# cloud/packaging ;; breakup
|
# packaging ;; breakup *!
|
||||||
# cloud/amazon
|
# cloud/amazon *i
|
||||||
# network ;; break up
|
# network ;; break up *!
|
||||||
|
# ( * == import* fixes, ! == many get_exception fixes, i == a few get_exception fixes)
|
||||||
### TODO:
|
### TODO:
|
||||||
### - module_utils
|
### - module_utils
|
||||||
### - contrib/
|
### - contrib/
|
||||||
|
|
Loading…
Reference in a new issue