mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Remove wildcard imports
Made the following changes: * Removed wildcard imports * Replaced long form of GPL header with short form * Removed get_exception usage * Added from __future__ boilerplate * Adjust division operator to // where necessary For the following files: * web_infrastructure modules * system modules * linode, lxc, lxd, atomic, cloudscale, dimensiondata, ovh, packet, profitbricks, pubnub, smartos, softlayer, univention modules * compat dirs (disabled as its used intentionally)
This commit is contained in:
parent
f6d7fc548e
commit
4e6cce354e
185 changed files with 1657 additions and 3459 deletions
|
@ -30,9 +30,13 @@ import sys
|
|||
# is the same as the python3 stdlib mock library
|
||||
|
||||
try:
|
||||
# Allow wildcard import because we really do want to import all of mock's
|
||||
# symbols into this compat shim
|
||||
# pylint: disable=wildcard-import
|
||||
from unittest.mock import *
|
||||
except ImportError:
|
||||
# Python 2
|
||||
# pylint: disable=wildcard-import
|
||||
try:
|
||||
from mock import *
|
||||
except ImportError:
|
||||
|
|
|
@ -25,7 +25,9 @@ Compat module for Python2.7's unittest module
|
|||
|
||||
import sys
|
||||
|
||||
# Python 2.6
|
||||
# Allow wildcard import because we really do want to import all of
|
||||
# unittests's symbols into this compat shim
|
||||
# pylint: disable=wildcard-import
|
||||
if sys.version_info < (2, 7):
|
||||
try:
|
||||
# Need unittest2 on python2.6
|
||||
|
|
|
@ -152,7 +152,7 @@ except ImportError:
|
|||
HAS_F5SDK = False
|
||||
|
||||
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.six import iteritems, with_metaclass
|
||||
|
||||
|
||||
|
|
|
@ -1,20 +1,12 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# 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/>.
|
||||
# Copyright: Ansible Project
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -109,8 +101,8 @@ msg:
|
|||
# import module snippets
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils._text import to_native
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils._text import to_native
|
||||
|
||||
|
||||
def do_install(module, mode, rootfs, container, image, values_list, backend):
|
||||
|
@ -206,7 +198,7 @@ def main():
|
|||
)
|
||||
|
||||
if module.params['values'] is not None and module.params['mode'] == 'default':
|
||||
module.fail_json(msg="values is supported only with user or system mode", err=err)
|
||||
module.fail_json(msg="values is supported only with user or system mode")
|
||||
|
||||
# Verify that the platform supports atomic command
|
||||
rc, out, err = module.run_command('atomic -v', check_rc=False)
|
||||
|
|
|
@ -1,20 +1,12 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# 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 licenses
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
# Copyright: Ansible Project
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -62,9 +54,11 @@ msg:
|
|||
type: string
|
||||
sample: 'Already on latest'
|
||||
'''
|
||||
import os
|
||||
import traceback
|
||||
|
||||
# import module snippets
|
||||
from ansible.module_utils.basic import AnsibleModule, os
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils._text import to_native
|
||||
|
||||
|
||||
def core(module):
|
||||
|
@ -106,7 +100,7 @@ def main():
|
|||
try:
|
||||
core(module)
|
||||
except Exception as e:
|
||||
module.fail_json(msg=str(e))
|
||||
module.fail_json(msg=to_native(e), exception=traceback.format_exc())
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -1,20 +1,12 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# 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/>.
|
||||
# Copyright: Ansible Project
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -84,10 +76,10 @@ msg:
|
|||
type: string
|
||||
sample: [u'Using default tag: latest ...']
|
||||
'''
|
||||
import traceback
|
||||
|
||||
|
||||
# import module snippets
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils._text import to_native
|
||||
|
||||
|
||||
def do_upgrade(module, image):
|
||||
|
@ -179,7 +171,7 @@ def main():
|
|||
try:
|
||||
core(module)
|
||||
except Exception as e:
|
||||
module.fail_json(msg=str(e))
|
||||
module.fail_json(msg=to_native(e), exception=traceback.format_exc())
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -2,21 +2,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# (c) 2017, Gaudenz Steinlin <gaudenz.steinlin@cloudscale.ch>
|
||||
#
|
||||
# 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/>.
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -221,15 +211,16 @@ anti_affinity_with:
|
|||
sample: []
|
||||
'''
|
||||
|
||||
from datetime import datetime, timedelta
|
||||
import json
|
||||
import os
|
||||
from datetime import datetime, timedelta
|
||||
from time import sleep
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.six.moves.urllib.parse import urlencode
|
||||
from ansible.module_utils.urls import fetch_url
|
||||
|
||||
|
||||
API_URL = 'https://api.cloudscale.ch/v1/'
|
||||
TIMEOUT_WAIT = 30
|
||||
ALLOWED_STATES = ('running',
|
||||
|
@ -237,6 +228,7 @@ ALLOWED_STATES = ('running',
|
|||
'absent',
|
||||
)
|
||||
|
||||
|
||||
class AnsibleCloudscaleServer(object):
|
||||
|
||||
def __init__(self, module, api_token):
|
||||
|
|
|
@ -2,25 +2,16 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (c) 2016 Dimension Data
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# Authors:
|
||||
# - Aimon Bustardo <aimon.bustardo@dimensiondata.com>
|
||||
# - Bert Diwa <Lamberto.Diwa@dimensiondata.com>
|
||||
# - Adam Friedman <tintoy@tintoy.io>
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -117,11 +108,8 @@ network:
|
|||
type: boolean
|
||||
sample: false
|
||||
'''
|
||||
import traceback
|
||||
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.dimensiondata import DimensionDataModule, DimensionDataAPIException
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
try:
|
||||
from libcloud.compute.base import NodeLocation
|
||||
|
||||
|
@ -129,6 +117,10 @@ try:
|
|||
except ImportError:
|
||||
HAS_LIBCLOUD = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.dimensiondata import DimensionDataModule, DimensionDataAPIException
|
||||
from ansible.module_utils._text import to_native
|
||||
|
||||
|
||||
class DimensionDataNetworkModule(DimensionDataModule):
|
||||
"""
|
||||
|
@ -251,11 +243,10 @@ class DimensionDataNetworkModule(DimensionDataModule):
|
|||
self.module.params['service_plan'],
|
||||
description=self.description
|
||||
)
|
||||
except DimensionDataAPIException:
|
||||
api_exception = get_exception()
|
||||
except DimensionDataAPIException as e:
|
||||
|
||||
self.module.fail_json(
|
||||
msg="Failed to create new network: %s" % str(api_exception)
|
||||
msg="Failed to create new network: %s" % to_native(e), exception=traceback.format_exc()
|
||||
)
|
||||
|
||||
return None
|
||||
|
@ -282,11 +273,9 @@ class DimensionDataNetworkModule(DimensionDataModule):
|
|||
"Unexpected failure deleting network with id %s", network.id
|
||||
)
|
||||
|
||||
except DimensionDataAPIException:
|
||||
api_exception = get_exception()
|
||||
|
||||
except DimensionDataAPIException as e:
|
||||
self.module.fail_json(
|
||||
msg="Failed to delete network: %s" % str(api_exception)
|
||||
msg="Failed to delete network: %s" % to_native(e), exception=traceback.format_exc()
|
||||
)
|
||||
|
||||
def _wait_for_network_state(self, net_id, state_to_wait_for):
|
||||
|
@ -298,11 +287,10 @@ class DimensionDataNetworkModule(DimensionDataModule):
|
|||
self.module.params['wait_time'],
|
||||
net_id
|
||||
)
|
||||
except DimensionDataAPIException:
|
||||
api_exception = get_exception()
|
||||
|
||||
except DimensionDataAPIException as e:
|
||||
self.module.fail_json(
|
||||
msg='Network did not reach % state in time: %s' % (state_to_wait_for, api_exception.msg)
|
||||
msg='Network did not reach % state in time: %s' % (state_to_wait_for, to_native(e)),
|
||||
exception=traceback.format_exc()
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -1,18 +1,10 @@
|
|||
#!/usr/bin/python
|
||||
# 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/>.
|
||||
# Copyright: Ansible Project
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -274,8 +266,8 @@ EXAMPLES = '''
|
|||
state: restarted
|
||||
'''
|
||||
|
||||
import time
|
||||
import os
|
||||
import time
|
||||
|
||||
try:
|
||||
import pycurl
|
||||
|
@ -283,13 +275,14 @@ try:
|
|||
except ImportError:
|
||||
HAS_PYCURL = False
|
||||
|
||||
|
||||
try:
|
||||
from linode import api as linode_api
|
||||
HAS_LINODE = True
|
||||
except ImportError:
|
||||
HAS_LINODE = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
|
||||
def randompass():
|
||||
'''
|
||||
|
@ -694,8 +687,6 @@ def main():
|
|||
payment_term, password, private_ip, ssh_pub_key, swap, wait,
|
||||
wait_timeout, watchdog, **kwargs)
|
||||
|
||||
# import module snippets
|
||||
from ansible.module_utils.basic import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -2,21 +2,10 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# (c) 2014, Kevin Carter <kevin.carter@rackspace.com>
|
||||
#
|
||||
# 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/>.
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
|
@ -446,7 +435,6 @@ except ImportError:
|
|||
else:
|
||||
HAS_LXC = True
|
||||
|
||||
# import module bits
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.parsing.convert_bool import BOOLEANS_FALSE, BOOLEANS_TRUE
|
||||
from ansible.module_utils.six.moves import xrange
|
||||
|
|
|
@ -2,21 +2,10 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# (c) 2016, Hiroaki Nakamura <hnakamur@gmail.com>
|
||||
#
|
||||
# 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/>.
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
|
@ -249,10 +238,14 @@ actions:
|
|||
type: list
|
||||
sample: '["create", "start"]'
|
||||
'''
|
||||
|
||||
import datetime
|
||||
import os
|
||||
import time
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.lxd import LXDClient, LXDClientException
|
||||
|
||||
|
||||
# LXD_ANSIBLE_STATES is a map of states that contain values of methods used
|
||||
# when a particular state is evoked.
|
||||
LXD_ANSIBLE_STATES = {
|
||||
|
@ -276,16 +269,6 @@ CONFIG_PARAMS = [
|
|||
'architecture', 'config', 'devices', 'ephemeral', 'profiles', 'source'
|
||||
]
|
||||
|
||||
try:
|
||||
callable(all)
|
||||
except NameError:
|
||||
# For python <2.5
|
||||
# This definition is copied from https://docs.python.org/2/library/functions.html#all
|
||||
def all(iterable):
|
||||
for element in iterable:
|
||||
if not element:
|
||||
return False
|
||||
return True
|
||||
|
||||
class LXDContainerManagement(object):
|
||||
def __init__(self, module):
|
||||
|
@ -389,7 +372,7 @@ class LXDContainerManagement(object):
|
|||
|
||||
@staticmethod
|
||||
def _has_all_ipv4_addresses(addresses):
|
||||
return len(addresses) > 0 and all([len(v) > 0 for v in addresses.values()])
|
||||
return len(addresses) > 0 and all(len(v) > 0 for v in addresses.values())
|
||||
|
||||
def _get_addresses(self):
|
||||
try:
|
||||
|
@ -608,7 +591,6 @@ def main():
|
|||
lxd_manage = LXDContainerManagement(module=module)
|
||||
lxd_manage.run()
|
||||
|
||||
# import module bits
|
||||
from ansible.module_utils.basic import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -2,21 +2,10 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# (c) 2016, Hiroaki Nakamura <hnakamur@gmail.com>
|
||||
#
|
||||
# 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/>.
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
|
@ -177,8 +166,11 @@ actions:
|
|||
'''
|
||||
|
||||
import os
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.lxd import LXDClient, LXDClientException
|
||||
|
||||
|
||||
# PROFILE_STATES is a list for states supported
|
||||
PROFILES_STATES = [
|
||||
'present', 'absent'
|
||||
|
@ -189,6 +181,7 @@ CONFIG_PARAMS = [
|
|||
'config', 'description', 'devices'
|
||||
]
|
||||
|
||||
|
||||
class LXDProfileManagement(object):
|
||||
def __init__(self, module):
|
||||
"""Management of LXC containers via Ansible.
|
||||
|
@ -371,7 +364,6 @@ def main():
|
|||
lxd_manage = LXDProfileManagement(module=module)
|
||||
lxd_manage.run()
|
||||
|
||||
# import module bits
|
||||
from ansible.module_utils.basic import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -1,18 +1,12 @@
|
|||
#!/usr/bin/python
|
||||
# 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/>.
|
||||
|
||||
# Copyright: Ansible Project
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
@ -113,6 +107,7 @@ RETURN = '''
|
|||
'''
|
||||
|
||||
import time
|
||||
|
||||
try:
|
||||
import ovh
|
||||
import ovh.exceptions
|
||||
|
@ -121,6 +116,9 @@ try:
|
|||
except ImportError:
|
||||
HAS_OVH = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
|
||||
def getOvhClient(ansibleModule):
|
||||
endpoint = ansibleModule.params.get('endpoint')
|
||||
application_key = ansibleModule.params.get('application_key')
|
||||
|
@ -309,8 +307,6 @@ def main():
|
|||
|
||||
module.exit_json(changed=moduleChanged)
|
||||
|
||||
# import module snippets
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -3,20 +3,11 @@
|
|||
# (c) 2016, Matt Baldwin <baldwin@stackpointcloud.com>
|
||||
# (c) 2016, Thibaud Morel l'Horset <teebes@gmail.com>
|
||||
#
|
||||
# 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/>.
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -212,19 +203,18 @@ devices:
|
|||
|
||||
|
||||
import os
|
||||
import re
|
||||
import time
|
||||
import uuid
|
||||
import re
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
HAS_PACKET_SDK = True
|
||||
|
||||
try:
|
||||
import packet
|
||||
except ImportError:
|
||||
HAS_PACKET_SDK = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
|
||||
NAME_RE = '({0}|{0}{1}*{0})'.format('[a-zA-Z0-9]','[a-zA-Z0-9\-]')
|
||||
HOSTNAME_RE = '({0}\.)*{0}$'.format(NAME_RE)
|
||||
|
@ -567,6 +557,5 @@ def main():
|
|||
module.fail_json(msg='failed to set machine state %s, error: %s' % (state,str(e)))
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -1,20 +1,10 @@
|
|||
#!/usr/bin/python
|
||||
# Copyright 2016 Tomas Karasek <tom.to.the.k@gmail.com>
|
||||
#
|
||||
# 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/>.
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -112,8 +102,6 @@ import uuid
|
|||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
HAS_PACKET_SDK = True
|
||||
|
||||
|
||||
try:
|
||||
import packet
|
||||
except ImportError:
|
||||
|
|
|
@ -1,18 +1,10 @@
|
|||
#!/usr/bin/python
|
||||
# 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/>.
|
||||
# Copyright: Ansible Project
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
|
|
@ -1,18 +1,10 @@
|
|||
#!/usr/bin/python
|
||||
# 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/>.
|
||||
# Copyright: Ansible Project
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -87,17 +79,17 @@ EXAMPLES = '''
|
|||
'''
|
||||
|
||||
import re
|
||||
import uuid
|
||||
import time
|
||||
import sys
|
||||
|
||||
HAS_PB_SDK = True
|
||||
|
||||
try:
|
||||
from profitbricks.client import ProfitBricksService, Datacenter
|
||||
except ImportError:
|
||||
HAS_PB_SDK = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
|
||||
LOCATIONS = ['us/las',
|
||||
'de/fra',
|
||||
'de/fkb']
|
||||
|
@ -151,8 +143,6 @@ def create_datacenter(module, profitbricks):
|
|||
description = module.params.get('description')
|
||||
wait = module.params.get('wait')
|
||||
wait_timeout = int(module.params.get('wait_timeout'))
|
||||
virtual_datacenters = []
|
||||
|
||||
|
||||
i = Datacenter(
|
||||
name=name,
|
||||
|
@ -260,7 +250,6 @@ def main():
|
|||
except Exception as e:
|
||||
module.fail_json(msg='failed to set datacenter state: %s' % str(e))
|
||||
|
||||
from ansible.module_utils.basic import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -1,18 +1,10 @@
|
|||
#!/usr/bin/python
|
||||
# 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/>.
|
||||
# Copyright: Ansible Project
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -97,12 +89,14 @@ import uuid
|
|||
import time
|
||||
|
||||
HAS_PB_SDK = True
|
||||
|
||||
try:
|
||||
from profitbricks.client import ProfitBricksService, NIC
|
||||
except ImportError:
|
||||
HAS_PB_SDK = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
|
||||
uuid_match = re.compile(
|
||||
'[\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12}', re.I)
|
||||
|
||||
|
@ -291,7 +285,6 @@ def main():
|
|||
except Exception as e:
|
||||
module.fail_json(msg='failed to set nic state: %s' % str(e))
|
||||
|
||||
from ansible.module_utils.basic import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -1,18 +1,10 @@
|
|||
#!/usr/bin/python
|
||||
# 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/>.
|
||||
# Copyright: Ansible Project
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -144,7 +136,6 @@ import time
|
|||
import traceback
|
||||
|
||||
HAS_PB_SDK = True
|
||||
|
||||
try:
|
||||
from profitbricks.client import ProfitBricksService, Volume
|
||||
except ImportError:
|
||||
|
|
|
@ -1,18 +1,10 @@
|
|||
#!/usr/bin/python
|
||||
# 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/>.
|
||||
# Copyright: Ansible Project
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -91,16 +83,17 @@ EXAMPLES = '''
|
|||
'''
|
||||
|
||||
import re
|
||||
import uuid
|
||||
import time
|
||||
|
||||
HAS_PB_SDK = True
|
||||
|
||||
try:
|
||||
from profitbricks.client import ProfitBricksService, Volume
|
||||
from profitbricks.client import ProfitBricksService
|
||||
except ImportError:
|
||||
HAS_PB_SDK = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
|
||||
uuid_match = re.compile(
|
||||
'[\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12}', re.I)
|
||||
|
||||
|
@ -263,7 +256,6 @@ def main():
|
|||
except Exception as e:
|
||||
module.fail_json(msg='failed to set volume_attach state: %s' % str(e))
|
||||
|
||||
from ansible.module_utils.basic import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -6,18 +6,10 @@
|
|||
# http://www.pubnub.com/
|
||||
# http://www.pubnub.com/terms
|
||||
#
|
||||
# This program 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 program 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 program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
|
@ -232,11 +224,6 @@ module_cache:
|
|||
import copy
|
||||
import os
|
||||
|
||||
# Import module snippets
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
# noinspection PyProtectedMember
|
||||
from ansible.module_utils._text import *
|
||||
|
||||
try:
|
||||
# Import PubNub BLOCKS client.
|
||||
from pubnub_blocks_client import User, Account, Owner, Application, Keyset
|
||||
|
@ -254,6 +241,9 @@ except ImportError:
|
|||
EventHandler = None
|
||||
exceptions = None
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils._text import to_text
|
||||
|
||||
|
||||
def pubnub_user(module):
|
||||
"""Create and configure user model if it possible.
|
||||
|
|
|
@ -2,22 +2,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# (c) 2016, 2017 Jasper Lievisse Adriaanse <j@jasper.la>
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -124,9 +113,10 @@ state:
|
|||
sample: 'present'
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
import re
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
# Shortcut for the imgadm(1M) command. While imgadm(1M) supports a
|
||||
# -E option to return any errors in JSON, the generated JSON does not play well
|
||||
# with the JSON parsers of Python. The returned message contains '\n' as part of
|
||||
|
|
|
@ -2,22 +2,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# (c) 2015, Adam Števko <adam.stevko@gmail.com>
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -63,10 +52,9 @@ RETURN = '''
|
|||
# this module returns ansible_facts
|
||||
'''
|
||||
|
||||
try:
|
||||
import json
|
||||
except ImportError:
|
||||
import simplejson as json
|
||||
import json
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
|
||||
class ImageFacts(object):
|
||||
|
@ -118,7 +106,6 @@ def main():
|
|||
|
||||
module.exit_json(ansible_facts=data)
|
||||
|
||||
from ansible.module_utils.basic import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -2,22 +2,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# (c) 2017, Jasper Lievisse Adriaanse <j@jasper.la>
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -346,15 +335,12 @@ state:
|
|||
sample: 'running'
|
||||
'''
|
||||
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import tempfile
|
||||
import traceback
|
||||
|
||||
try:
|
||||
import json
|
||||
except ImportError:
|
||||
import simplejson as json
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils._text import to_native
|
||||
|
@ -464,9 +450,8 @@ def new_vm(module, uuid, vm_state):
|
|||
except Exception as e:
|
||||
# Since the payload may contain sensitive information, fail hard
|
||||
# if we cannot remove the file so the operator knows about it.
|
||||
module.fail_json(
|
||||
msg='Could not remove temporary JSON payload file {0}'.format(payload_file),
|
||||
exception=traceback.format_exc())
|
||||
module.fail_json(msg='Could not remove temporary JSON payload file {0}: {1}'.format(payload_file, to_native(e)),
|
||||
exception=traceback.format_exc())
|
||||
|
||||
return changed, vm_uuid
|
||||
|
||||
|
@ -544,8 +529,7 @@ def create_payload(module, uuid):
|
|||
fh.write(vmdef_json)
|
||||
fh.close()
|
||||
except Exception as e:
|
||||
module.fail_json(
|
||||
msg='Could not save JSON payload', exception=traceback.format_exc())
|
||||
module.fail_json(msg='Could not save JSON payload: %s' % to_native(e), exception=traceback.format_exc())
|
||||
|
||||
return fname
|
||||
|
||||
|
|
|
@ -1,18 +1,10 @@
|
|||
#!/usr/bin/python
|
||||
# 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/>.
|
||||
# Copyright: Ansible Project
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
|
|
@ -3,22 +3,11 @@
|
|||
|
||||
# Copyright (c) 2016, Adfinis SyGroup AG
|
||||
# Tobias Rueetschi <tobias.ruetschi@adfinis-sygroup.ch>
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -82,16 +71,6 @@ EXAMPLES = '''
|
|||
|
||||
RETURN = '''# '''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.univention_umc import (
|
||||
umc_module_for_add,
|
||||
umc_module_for_edit,
|
||||
ldap_search,
|
||||
base_dn,
|
||||
config,
|
||||
uldap,
|
||||
)
|
||||
|
||||
HAVE_UNIVENTION = False
|
||||
try:
|
||||
from univention.admin.handlers.dns import (
|
||||
|
@ -102,6 +81,16 @@ try:
|
|||
except ImportError:
|
||||
pass
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.univention_umc import (
|
||||
umc_module_for_add,
|
||||
umc_module_for_edit,
|
||||
ldap_search,
|
||||
base_dn,
|
||||
config,
|
||||
uldap,
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
module = AnsibleModule(
|
||||
|
|
|
@ -3,22 +3,11 @@
|
|||
|
||||
# Copyright (c) 2016, Adfinis SyGroup AG
|
||||
# Tobias Rueetschi <tobias.ruetschi@adfinis-sygroup.ch>
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
|
|
@ -3,22 +3,11 @@
|
|||
|
||||
# Copyright (c) 2016, Adfinis SyGroup AG
|
||||
# Tobias Rueetschi <tobias.ruetschi@adfinis-sygroup.ch>
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
|
|
@ -3,22 +3,11 @@
|
|||
|
||||
# Copyright (c) 2016, Adfinis SyGroup AG
|
||||
# Tobias Rueetschi <tobias.ruetschi@adfinis-sygroup.ch>
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
|
|
@ -3,22 +3,11 @@
|
|||
|
||||
# Copyright (c) 2016, Adfinis SyGroup AG
|
||||
# Tobias Rueetschi <tobias.ruetschi@adfinis-sygroup.ch>
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -344,8 +333,10 @@ EXAMPLES = '''
|
|||
|
||||
RETURN = '''# '''
|
||||
|
||||
from datetime import date
|
||||
import crypt
|
||||
from datetime import date
|
||||
from dateutil.relativedelta import relativedelta
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.univention_umc import (
|
||||
umc_module_for_add,
|
||||
|
@ -353,7 +344,6 @@ from ansible.module_utils.univention_umc import (
|
|||
ldap_search,
|
||||
base_dn,
|
||||
)
|
||||
from dateutil.relativedelta import relativedelta
|
||||
|
||||
|
||||
def main():
|
||||
|
|
|
@ -1,21 +1,11 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
# (c) 2016, Eric D Helms <ericdhelms@gmail.com>
|
||||
#
|
||||
# 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/>.
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -71,15 +61,19 @@ EXAMPLES = '''
|
|||
|
||||
RETURN = '''# '''
|
||||
|
||||
import datetime
|
||||
import traceback
|
||||
|
||||
try:
|
||||
from nailgun import entities, entity_fields
|
||||
from nailgun import entities
|
||||
from nailgun.config import ServerConfig
|
||||
HAS_NAILGUN_PACKAGE = True
|
||||
except:
|
||||
HAS_NAILGUN_PACKAGE = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils._text import to_native
|
||||
|
||||
|
||||
class NailGun(object):
|
||||
def __init__(self, server, entities, module):
|
||||
self._server = server
|
||||
|
@ -144,7 +138,8 @@ def main():
|
|||
org = entities.Organization(server)
|
||||
org.search()
|
||||
except Exception as e:
|
||||
module.fail_json(msg="Failed to connect to Foreman server: %s " % e)
|
||||
module.fail_json(msg="Failed to connect to Foreman server: %s " % to_native(e),
|
||||
exception=traceback.format_exc())
|
||||
|
||||
if entity == 'organization':
|
||||
ng.organization(params)
|
||||
|
@ -152,8 +147,6 @@ def main():
|
|||
else:
|
||||
module.fail_json(changed=False, result="Unsupported entity supplied")
|
||||
|
||||
# import module snippets
|
||||
from ansible.module_utils.basic import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -1,21 +1,11 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
# (c) 2016, Eric D Helms <ericdhelms@gmail.com>
|
||||
#
|
||||
# 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/>.
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -139,6 +129,8 @@ EXAMPLES = '''
|
|||
RETURN = '''# '''
|
||||
|
||||
import datetime
|
||||
import os
|
||||
import traceback
|
||||
|
||||
try:
|
||||
from nailgun import entities, entity_fields, entity_mixins
|
||||
|
@ -147,6 +139,9 @@ try:
|
|||
except:
|
||||
HAS_NAILGUN_PACKAGE = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils._text import to_native
|
||||
|
||||
|
||||
class NailGun(object):
|
||||
def __init__(self, server, entities, module):
|
||||
|
@ -242,13 +237,13 @@ class NailGun(object):
|
|||
files={'content': content}
|
||||
)
|
||||
return True
|
||||
except Exception:
|
||||
e = get_exception()
|
||||
except Exception as e:
|
||||
|
||||
if "Import is the same as existing data" in e.message:
|
||||
return False
|
||||
else:
|
||||
self._module.fail_json(msg="Manifest import failed with %s" % e)
|
||||
self._module.fail_json(msg="Manifest import failed with %s" % to_native(e),
|
||||
exception=traceback.format_exc())
|
||||
|
||||
def product(self, params):
|
||||
org = self.find_organization(params['organization'])
|
||||
|
@ -519,8 +514,6 @@ def main():
|
|||
|
||||
module.exit_json(changed=result, result="%s updated" % entity)
|
||||
|
||||
# import module snippets
|
||||
from ansible.module_utils.basic import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -2,21 +2,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2012 Dag Wieers <dag@wieers.com>
|
||||
#
|
||||
# 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/>.
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -113,10 +103,8 @@ RETURN = '''
|
|||
# Default return values
|
||||
'''
|
||||
|
||||
|
||||
import time
|
||||
import warnings
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
try:
|
||||
import hpilo
|
||||
|
@ -124,6 +112,8 @@ try:
|
|||
except ImportError:
|
||||
HAS_HPILO = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
|
||||
# Suppress warnings from hpilo
|
||||
warnings.simplefilter('ignore')
|
||||
|
@ -213,5 +203,6 @@ def main():
|
|||
|
||||
module.exit_json(changed=changed, power=power_status, **status)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -2,21 +2,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2012 Dag Wieers <dag@wieers.com>
|
||||
#
|
||||
# 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/>.
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -131,7 +121,6 @@ hw_uuid:
|
|||
|
||||
import re
|
||||
import warnings
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
try:
|
||||
import hpilo
|
||||
|
@ -139,6 +128,8 @@ try:
|
|||
except ImportError:
|
||||
HAS_HPILO = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
|
||||
# Suppress warnings from hpilo
|
||||
warnings.simplefilter('ignore')
|
||||
|
|
|
@ -2,21 +2,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# (c) 2012, Dag Wieers <dag@wieers.com>
|
||||
#
|
||||
# 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/>.
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -102,5 +92,6 @@ def main():
|
|||
|
||||
module.exit_json(changed=changed, stdout=stdout, stderr=stderr)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -1,21 +1,11 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
# (c) 2017, Dag Wieers <dag@wieers.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
|
||||
|
||||
# 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',
|
||||
'status': ['preview'],
|
||||
|
@ -228,15 +218,10 @@ output:
|
|||
errorDescr="XML PARSING ERROR: Element 'computeRackUnit', attribute 'admin_Power': The attribute 'admin_Power' is not allowed.\n"/>
|
||||
'''
|
||||
|
||||
|
||||
import atexit
|
||||
import itertools
|
||||
import os
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
from ansible.module_utils.urls import fetch_url
|
||||
|
||||
try:
|
||||
import lxml.etree
|
||||
HAS_LXML_ETREE = True
|
||||
|
@ -249,6 +234,9 @@ try:
|
|||
except ImportError:
|
||||
HAS_XMLJSON_COBRA = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.urls import fetch_url
|
||||
|
||||
|
||||
def imc_response(module, rawoutput, rawinput=''):
|
||||
''' Handle IMC returned data '''
|
||||
|
|
|
@ -1,20 +1,12 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# 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/>.
|
||||
# Copyright: Ansible Project
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -126,7 +118,7 @@ try:
|
|||
except ImportError:
|
||||
command = None
|
||||
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
|
||||
def main():
|
||||
|
|
|
@ -1,20 +1,12 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# 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/>.
|
||||
# Copyright: Ansible Project
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -90,7 +82,7 @@ try:
|
|||
except ImportError:
|
||||
command = None
|
||||
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
|
||||
def main():
|
||||
|
|
|
@ -2,19 +2,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# (c) 2016, Hugh Ma <Hugh.Ma@flextronics.com>
|
||||
#
|
||||
# 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/>.
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -110,12 +102,10 @@ stdout_lines:
|
|||
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import tempfile
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.six.moves.urllib.parse import urlencode
|
||||
from ansible.module_utils.urls import fetch_url, ConnectionError
|
||||
from ansible.module_utils.urls import fetch_url
|
||||
|
||||
|
||||
class StackiHost(object):
|
||||
|
@ -194,10 +184,10 @@ class StackiHost(object):
|
|||
|
||||
def stack_sync(self):
|
||||
|
||||
res = self.do_request(self.module, self.endpoint, payload=json.dumps({ "cmd": "sync config"}),
|
||||
self.do_request(self.module, self.endpoint, payload=json.dumps({ "cmd": "sync config"}),
|
||||
headers=self.header, method="POST")
|
||||
|
||||
res = self.do_request(self.module, self.endpoint, payload=json.dumps({"cmd": "sync host config"}),
|
||||
self.do_request(self.module, self.endpoint, payload=json.dumps({"cmd": "sync host config"}),
|
||||
headers=self.header, method="POST")
|
||||
|
||||
|
||||
|
@ -208,7 +198,7 @@ class StackiHost(object):
|
|||
|
||||
data['cmd'] = "set host boot {0} action=install" \
|
||||
.format(self.hostname)
|
||||
res = self.do_request(self.module, self.endpoint, payload=json.dumps(data),
|
||||
self.do_request(self.module, self.endpoint, payload=json.dumps(data),
|
||||
headers=self.header, method="POST")
|
||||
changed = True
|
||||
|
||||
|
@ -224,7 +214,7 @@ class StackiHost(object):
|
|||
|
||||
data['cmd'] = "add host {0} rack={1} rank={2} appliance={3}"\
|
||||
.format(self.hostname, self.rack, self.rank, self.appliance)
|
||||
res = self.do_request(self.module, self.endpoint, payload=json.dumps(data),
|
||||
self.do_request(self.module, self.endpoint, payload=json.dumps(data),
|
||||
headers=self.header, method="POST")
|
||||
|
||||
self.stack_sync()
|
||||
|
@ -239,7 +229,7 @@ class StackiHost(object):
|
|||
|
||||
data['cmd'] = "remove host {0}"\
|
||||
.format(self.hostname)
|
||||
res = self.do_request(self.module, self.endpoint, payload=json.dumps(data),
|
||||
self.do_request(self.module, self.endpoint, payload=json.dumps(data),
|
||||
headers=self.header, method="POST")
|
||||
|
||||
self.stack_sync()
|
||||
|
|
|
@ -2,21 +2,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# (c) 2016, Dag Wieers <dag@wieers.com>
|
||||
#
|
||||
# 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/>.
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -70,11 +60,12 @@ EXAMPLES = r'''
|
|||
RETURN = r'''
|
||||
# Default return values
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
import socket
|
||||
import struct
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils._text import to_native
|
||||
|
||||
|
||||
def wakeonlan(module, mac, broadcast, port):
|
||||
|
@ -110,10 +101,9 @@ def wakeonlan(module, mac, broadcast, port):
|
|||
|
||||
try:
|
||||
sock.sendto(data, (broadcast, port))
|
||||
except socket.error:
|
||||
e = get_exception()
|
||||
except socket.error as e:
|
||||
sock.close()
|
||||
module.fail_json(msg=str(e))
|
||||
module.fail_json(msg=to_native(e), exception=traceback.format_exc())
|
||||
|
||||
sock.close()
|
||||
|
||||
|
|
|
@ -2,21 +2,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# (c) 2016, Gregory Shulov (gregory.shulov@gmail.com)
|
||||
#
|
||||
# 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/>.
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -59,6 +49,8 @@ options:
|
|||
required: true
|
||||
extends_documentation_fragment:
|
||||
- infinibox
|
||||
requirements:
|
||||
- munch
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
|
@ -91,15 +83,14 @@ EXAMPLES = '''
|
|||
|
||||
RETURN = '''
|
||||
'''
|
||||
|
||||
HAS_INFINISDK = True
|
||||
try:
|
||||
from infinisdk import InfiniBox, core
|
||||
from munch import unmunchify
|
||||
HAS_MUNCH = True
|
||||
except ImportError:
|
||||
HAS_INFINISDK = False
|
||||
HAS_MUNCH = False
|
||||
|
||||
from ansible.module_utils.infinibox import *
|
||||
from munch import unmunchify
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.infinibox import HAS_INFINISDK, api_wrapper, get_system, infinibox_argument_spec
|
||||
|
||||
|
||||
def transform(d):
|
||||
|
@ -178,6 +169,8 @@ def main():
|
|||
|
||||
if not HAS_INFINISDK:
|
||||
module.fail_json(msg='infinisdk is required for this module')
|
||||
if not HAS_MUNCH:
|
||||
module.fail_json(msg='the python munch library is required for this module')
|
||||
|
||||
state = module.params['state']
|
||||
system = get_system(module)
|
||||
|
@ -195,7 +188,5 @@ def main():
|
|||
module.exit_json(changed=False)
|
||||
|
||||
|
||||
# Import Ansible Utilities
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -2,21 +2,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# (c) 2016, Gregory Shulov (gregory.shulov@gmail.com)
|
||||
#
|
||||
# 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/>.
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -62,6 +52,8 @@ options:
|
|||
required: true
|
||||
extends_documentation_fragment:
|
||||
- infinibox
|
||||
requirements:
|
||||
- munch
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
|
@ -92,14 +84,14 @@ EXAMPLES = '''
|
|||
RETURN = '''
|
||||
'''
|
||||
|
||||
HAS_INFINISDK = True
|
||||
try:
|
||||
from infinisdk import InfiniBox, core
|
||||
from munch import Munch, unmunchify
|
||||
HAS_MUNCH = True
|
||||
except ImportError:
|
||||
HAS_INFINISDK = False
|
||||
HAS_MUNCH = False
|
||||
|
||||
from ansible.module_utils.infinibox import *
|
||||
from munch import Munch, unmunchify
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.infinibox import HAS_INFINISDK, api_wrapper, get_system, infinibox_argument_spec
|
||||
|
||||
|
||||
def transform(d):
|
||||
|
@ -195,6 +187,8 @@ def main():
|
|||
|
||||
if not HAS_INFINISDK:
|
||||
module.fail_json(msg='infinisdk is required for this module')
|
||||
if not HAS_MUNCH:
|
||||
module.fail_json(msg='the python munch library is required for this module')
|
||||
|
||||
system = get_system(module)
|
||||
export = get_export(module, system)
|
||||
|
@ -204,7 +198,6 @@ def main():
|
|||
else:
|
||||
delete_client(module, export)
|
||||
|
||||
# Import Ansible Utilities
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -2,21 +2,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# (c) 2016, Gregory Shulov (gregory.shulov@gmail.com)
|
||||
#
|
||||
# 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/>.
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -52,6 +42,8 @@ options:
|
|||
required: true
|
||||
extends_documentation_fragment:
|
||||
- infinibox
|
||||
requirements:
|
||||
- capacity
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
|
@ -69,14 +61,14 @@ EXAMPLES = '''
|
|||
RETURN = '''
|
||||
'''
|
||||
|
||||
HAS_INFINISDK = True
|
||||
try:
|
||||
from infinisdk import InfiniBox, core
|
||||
from capacity import KiB, Capacity
|
||||
HAS_CAPACITY = True
|
||||
except ImportError:
|
||||
HAS_INFINISDK = False
|
||||
HAS_CAPACITY = False
|
||||
|
||||
from ansible.module_utils.infinibox import *
|
||||
from capacity import KiB, Capacity
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.infinibox import HAS_INFINISDK, api_wrapper, get_system, infinibox_argument_spec
|
||||
|
||||
|
||||
@api_wrapper
|
||||
|
@ -145,6 +137,8 @@ def main():
|
|||
|
||||
if not HAS_INFINISDK:
|
||||
module.fail_json(msg='infinisdk is required for this module')
|
||||
if not HAS_CAPACITY:
|
||||
module.fail_json(msg='The capacity python library is required for this module')
|
||||
|
||||
if module.params['size']:
|
||||
try:
|
||||
|
@ -170,7 +164,5 @@ def main():
|
|||
module.exit_json(changed=False)
|
||||
|
||||
|
||||
# Import Ansible Utilities
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -2,21 +2,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# (c) 2016, Gregory Shulov (gregory.shulov@gmail.com)
|
||||
#
|
||||
# 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/>.
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -84,14 +74,8 @@ EXAMPLES = '''
|
|||
RETURN = '''
|
||||
'''
|
||||
|
||||
HAS_INFINISDK = True
|
||||
try:
|
||||
from infinisdk import InfiniBox, core
|
||||
except ImportError:
|
||||
HAS_INFINISDK = False
|
||||
|
||||
from ansible.module_utils.infinibox import *
|
||||
from collections import Counter
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.infinibox import HAS_INFINISDK, api_wrapper, get_system, infinibox_argument_spec
|
||||
|
||||
|
||||
@api_wrapper
|
||||
|
@ -125,7 +109,6 @@ def create_host(module, system):
|
|||
@api_wrapper
|
||||
def update_host(module, host):
|
||||
changed = False
|
||||
name = module.params['name']
|
||||
module.exit_json(changed=changed)
|
||||
|
||||
|
||||
|
@ -173,7 +156,5 @@ def main():
|
|||
create_host(module, system)
|
||||
|
||||
|
||||
# Import Ansible Utilities
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -2,21 +2,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# (c) 2016, Gregory Shulov (gregory.shulov@gmail.com)
|
||||
#
|
||||
# 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/>.
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -64,6 +54,8 @@ notes:
|
|||
- Infinibox Admin level access is required for pool modifications
|
||||
extends_documentation_fragment:
|
||||
- infinibox
|
||||
requirements:
|
||||
- capacity
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
|
@ -88,14 +80,14 @@ EXAMPLES = '''
|
|||
RETURN = '''
|
||||
'''
|
||||
|
||||
HAS_INFINISDK = True
|
||||
try:
|
||||
from infinisdk import InfiniBox, core
|
||||
from capacity import KiB, Capacity
|
||||
HAS_CAPACITY = True
|
||||
except ImportError:
|
||||
HAS_INFINISDK = False
|
||||
HAS_CAPACITY = False
|
||||
|
||||
from ansible.module_utils.infinibox import *
|
||||
from capacity import KiB, Capacity
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.infinibox import HAS_INFINISDK, api_wrapper, get_system, infinibox_argument_spec
|
||||
|
||||
|
||||
@api_wrapper
|
||||
|
@ -187,6 +179,8 @@ def main():
|
|||
|
||||
if not HAS_INFINISDK:
|
||||
module.fail_json(msg='infinisdk is required for this module')
|
||||
if not HAS_CAPACITY:
|
||||
module.fail_json(msg='The capacity python library is required for this module')
|
||||
|
||||
if module.params['size']:
|
||||
try:
|
||||
|
@ -214,7 +208,5 @@ def main():
|
|||
module.exit_json(changed=False)
|
||||
|
||||
|
||||
# Import Ansible Utilities
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -2,21 +2,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# (c) 2016, Gregory Shulov (gregory.shulov@gmail.com)
|
||||
#
|
||||
# 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/>.
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -52,6 +42,8 @@ options:
|
|||
required: true
|
||||
extends_documentation_fragment:
|
||||
- infinibox
|
||||
requirements:
|
||||
- capacity
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
|
@ -69,14 +61,14 @@ EXAMPLES = '''
|
|||
RETURN = '''
|
||||
'''
|
||||
|
||||
HAS_INFINISDK = True
|
||||
try:
|
||||
from infinisdk import InfiniBox, core
|
||||
from capacity import KiB, Capacity
|
||||
HAS_CAPACITY = True
|
||||
except ImportError:
|
||||
HAS_INFINISDK = False
|
||||
HAS_CAPACITY = False
|
||||
|
||||
from ansible.module_utils.infinibox import *
|
||||
from capacity import KiB, Capacity
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.infinibox import HAS_INFINISDK, api_wrapper, get_system, infinibox_argument_spec
|
||||
|
||||
|
||||
@api_wrapper
|
||||
|
@ -170,7 +162,5 @@ def main():
|
|||
module.exit_json(changed=False)
|
||||
|
||||
|
||||
# Import Ansible Utilities
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -1,22 +1,12 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# (c) 2017, NetApp, Inc
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
@ -80,9 +70,10 @@ EXAMPLES = """
|
|||
RETURN = """
|
||||
|
||||
"""
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
from ansible.module_utils._text import to_native
|
||||
import ansible.module_utils.netapp as netapp_utils
|
||||
|
||||
|
||||
|
@ -140,13 +131,12 @@ class NetAppCDOTAggregate(object):
|
|||
try:
|
||||
result = self.server.invoke_successfully(aggr_get_iter,
|
||||
enable_tunneling=False)
|
||||
except netapp_utils.zapi.NaApiError:
|
||||
except netapp_utils.zapi.NaApiError as e:
|
||||
# Error 13040 denotes an aggregate not being found.
|
||||
e = get_exception()
|
||||
if str(e.code) == "13040":
|
||||
if to_native(e.code) == "13040":
|
||||
return False
|
||||
else:
|
||||
self.module.fail_json(exception=str(e))
|
||||
self.module.fail_json(msg=to_native(e), exception=traceback.format_exc())
|
||||
|
||||
if (result.get_child_by_name('num-records') and
|
||||
int(result.get_child_content('num-records')) >= 1):
|
||||
|
@ -162,10 +152,9 @@ class NetAppCDOTAggregate(object):
|
|||
try:
|
||||
self.server.invoke_successfully(aggr_create,
|
||||
enable_tunneling=False)
|
||||
except netapp_utils.zapi.NaApiError:
|
||||
err = get_exception()
|
||||
self.module.fail_json(msg="Error provisioning aggregate %s." % self.name,
|
||||
exception=str(err))
|
||||
except netapp_utils.zapi.NaApiError as e:
|
||||
self.module.fail_json(msg="Error provisioning aggregate %s: %s" % (self.name, to_native(e)),
|
||||
exception=traceback.format_exc())
|
||||
|
||||
def delete_aggr(self):
|
||||
aggr_destroy = netapp_utils.zapi.NaElement.create_node_with_children(
|
||||
|
@ -174,10 +163,9 @@ class NetAppCDOTAggregate(object):
|
|||
try:
|
||||
self.server.invoke_successfully(aggr_destroy,
|
||||
enable_tunneling=False)
|
||||
except netapp_utils.zapi.NaApiError:
|
||||
err = get_exception()
|
||||
self.module.fail_json(msg="Error removing aggregate %s." % self.name,
|
||||
exception=str(err))
|
||||
except netapp_utils.zapi.NaApiError as e:
|
||||
self.module.fail_json(msg="Error removing aggregate %s: %s" % (self.name, to_native(e)),
|
||||
exception=traceback.format_exc())
|
||||
|
||||
def rename_aggregate(self):
|
||||
aggr_rename = netapp_utils.zapi.NaElement.create_node_with_children(
|
||||
|
@ -188,10 +176,9 @@ class NetAppCDOTAggregate(object):
|
|||
try:
|
||||
self.server.invoke_successfully(aggr_rename,
|
||||
enable_tunneling=False)
|
||||
except netapp_utils.zapi.NaApiError:
|
||||
err = get_exception()
|
||||
self.module.fail_json(msg="Error renaming aggregate %s." % self.name,
|
||||
exception=str(err))
|
||||
except netapp_utils.zapi.NaApiError as e:
|
||||
self.module.fail_json(msg="Error renaming aggregate %s: %s" % (self.name, to_native(e)),
|
||||
exception=traceback.format_exc())
|
||||
|
||||
def apply(self):
|
||||
changed = False
|
||||
|
@ -237,5 +224,6 @@ def main():
|
|||
v = NetAppCDOTAggregate()
|
||||
v.apply()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -1,22 +1,12 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# (c) 2017, NetApp, Inc
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
@ -135,11 +125,13 @@ EXAMPLES = """
|
|||
RETURN = """
|
||||
|
||||
"""
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
from ansible.module_utils._text import to_native
|
||||
import ansible.module_utils.netapp as netapp_utils
|
||||
|
||||
|
||||
HAS_NETAPP_LIB = netapp_utils.has_netapp_lib()
|
||||
|
||||
|
||||
|
@ -184,10 +176,9 @@ class NetAppCDOTLicense(object):
|
|||
try:
|
||||
result = self.server.invoke_successfully(license_status,
|
||||
enable_tunneling=False)
|
||||
except netapp_utils.zapi.NaApiError:
|
||||
err = get_exception()
|
||||
self.module.fail_json(msg="Error checking license status",
|
||||
exception=str(err))
|
||||
except netapp_utils.zapi.NaApiError as e:
|
||||
self.module.fail_json(msg="Error checking license status: %s" %
|
||||
to_native(e), exception=traceback.format_exc())
|
||||
|
||||
return_dictionary = {}
|
||||
license_v2_status = result.get_child_by_name('license-v2-status')
|
||||
|
@ -216,10 +207,9 @@ class NetAppCDOTLicense(object):
|
|||
try:
|
||||
self.server.invoke_successfully(license_delete,
|
||||
enable_tunneling=False)
|
||||
except netapp_utils.zapi.NaApiError:
|
||||
err = get_exception()
|
||||
self.module.fail_json(msg="Error removing license",
|
||||
exception=str(err))
|
||||
except netapp_utils.zapi.NaApiError as e:
|
||||
self.module.fail_json(msg="Error removing license %s" %
|
||||
to_native(e), exception=traceback.format_exc())
|
||||
|
||||
def remove_unused_licenses(self):
|
||||
"""
|
||||
|
@ -229,10 +219,9 @@ class NetAppCDOTLicense(object):
|
|||
try:
|
||||
self.server.invoke_successfully(remove_unused,
|
||||
enable_tunneling=False)
|
||||
except netapp_utils.zapi.NaApiError:
|
||||
err = get_exception()
|
||||
self.module.fail_json(msg="Error removing unused licenses",
|
||||
exception=str(err))
|
||||
except netapp_utils.zapi.NaApiError as e:
|
||||
self.module.fail_json(msg="Error removing unused licenses: %s" %
|
||||
to_native(e), exception=traceback.format_exc())
|
||||
|
||||
def remove_expired_licenses(self):
|
||||
"""
|
||||
|
@ -242,10 +231,9 @@ class NetAppCDOTLicense(object):
|
|||
try:
|
||||
self.server.invoke_successfully(remove_expired,
|
||||
enable_tunneling=False)
|
||||
except netapp_utils.zapi.NaApiError:
|
||||
err = get_exception()
|
||||
self.module.fail_json(msg="Error removing expired licenses",
|
||||
exception=str(err))
|
||||
except netapp_utils.zapi.NaApiError as e:
|
||||
self.module.fail_json(msg="Error removing expired licenses: %s" %
|
||||
to_native(e), exception=traceback.format_exc())
|
||||
|
||||
def update_licenses(self):
|
||||
"""
|
||||
|
@ -281,10 +269,9 @@ class NetAppCDOTLicense(object):
|
|||
try:
|
||||
self.server.invoke_successfully(license_add,
|
||||
enable_tunneling=False)
|
||||
except netapp_utils.zapi.NaApiError:
|
||||
err = get_exception()
|
||||
self.module.fail_json(msg="Error adding licenses",
|
||||
exception=str(err))
|
||||
except netapp_utils.zapi.NaApiError as e:
|
||||
self.module.fail_json(msg="Error adding licenses: %s" %
|
||||
to_native(e), exception=traceback.format_exc())
|
||||
|
||||
def apply(self):
|
||||
changed = False
|
||||
|
|
|
@ -1,22 +1,12 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# (c) 2017, NetApp, Inc
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
@ -119,9 +109,10 @@ EXAMPLES = """
|
|||
RETURN = """
|
||||
|
||||
"""
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
from ansible.module_utils._text import to_native
|
||||
import ansible.module_utils.netapp as netapp_utils
|
||||
|
||||
HAS_NETAPP_LIB = netapp_utils.has_netapp_lib()
|
||||
|
@ -273,10 +264,9 @@ class NetAppCDOTLUN(object):
|
|||
|
||||
try:
|
||||
self.server.invoke_successfully(lun_create, enable_tunneling=True)
|
||||
except netapp_utils.zapi.NaApiError:
|
||||
err = get_exception()
|
||||
self.module.fail_json(msg="Error provisioning lun %s of size %s" % (self.name, self.size),
|
||||
exception=str(err))
|
||||
except netapp_utils.zapi.NaApiError as e:
|
||||
self.module.fail_json(msg="Error provisioning lun %s of size %s: %s" % (self.name, self.size, to_native(e)),
|
||||
exception=traceback.format_exc())
|
||||
|
||||
def delete_lun(self):
|
||||
"""
|
||||
|
@ -292,10 +282,9 @@ class NetAppCDOTLUN(object):
|
|||
|
||||
try:
|
||||
self.server.invoke_successfully(lun_delete, enable_tunneling=True)
|
||||
except netapp_utils.zapi.NaApiError:
|
||||
err = get_exception()
|
||||
self.module.fail_json(msg="Error deleting lun %s" % path,
|
||||
exception=str(err))
|
||||
except netapp_utils.zapi.NaApiError as e:
|
||||
self.module.fail_json(msg="Error deleting lun %s: %s" % (path, to_native(e)),
|
||||
exception=traceback.format_exc())
|
||||
|
||||
def resize_lun(self):
|
||||
"""
|
||||
|
@ -312,9 +301,8 @@ class NetAppCDOTLUN(object):
|
|||
'force': str(self.force_resize)})
|
||||
try:
|
||||
self.server.invoke_successfully(lun_resize, enable_tunneling=True)
|
||||
except netapp_utils.zapi.NaApiError:
|
||||
e = get_exception()
|
||||
if str(e.code) == "9042":
|
||||
except netapp_utils.zapi.NaApiError as e:
|
||||
if to_native(e.code) == "9042":
|
||||
# Error 9042 denotes the new LUN size being the same as the
|
||||
# old LUN size. This happens when there's barely any difference
|
||||
# in the two sizes. For example, from 8388608 bytes to
|
||||
|
@ -323,9 +311,8 @@ class NetAppCDOTLUN(object):
|
|||
# larger unit (MB/GB/TB).
|
||||
return False
|
||||
else:
|
||||
err = get_exception()
|
||||
self.module.fail_json(msg="Error resizing lun %s" % path,
|
||||
exception=str(err))
|
||||
self.module.fail_json(msg="Error resizing lun %s: %s" % (path, to_native(e)),
|
||||
exception=traceback.format_exc())
|
||||
|
||||
return True
|
||||
|
||||
|
@ -381,5 +368,6 @@ def main():
|
|||
v = NetAppCDOTLUN()
|
||||
v.apply()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -1,22 +1,12 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# (c) 2017, NetApp, Inc
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
@ -84,11 +74,13 @@ EXAMPLES = """
|
|||
RETURN = """
|
||||
|
||||
"""
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
from ansible.module_utils._text import to_native
|
||||
import ansible.module_utils.netapp as netapp_utils
|
||||
|
||||
|
||||
HAS_NETAPP_LIB = netapp_utils.has_netapp_lib()
|
||||
|
||||
|
||||
|
@ -161,10 +153,9 @@ class NetAppCDOTQTree(object):
|
|||
try:
|
||||
self.server.invoke_successfully(qtree_create,
|
||||
enable_tunneling=True)
|
||||
except netapp_utils.zapi.NaApiError:
|
||||
err = get_exception()
|
||||
self.module.fail_json(msg="Error provisioning qtree %s." % self.name,
|
||||
exception=str(err))
|
||||
except netapp_utils.zapi.NaApiError as e:
|
||||
self.module.fail_json(msg="Error provisioning qtree %s: %s" % (self.name, to_native(e)),
|
||||
exception=traceback.format_exc())
|
||||
|
||||
def delete_qtree(self):
|
||||
path = '/vol/%s/%s' % (self.flexvol_name, self.name)
|
||||
|
@ -174,10 +165,9 @@ class NetAppCDOTQTree(object):
|
|||
try:
|
||||
self.server.invoke_successfully(qtree_delete,
|
||||
enable_tunneling=True)
|
||||
except netapp_utils.zapi.NaApiError:
|
||||
err = get_exception()
|
||||
self.module.fail_json(msg="Error deleting qtree %s." % path,
|
||||
exception=str(err))
|
||||
except netapp_utils.zapi.NaApiError as e:
|
||||
self.module.fail_json(msg="Error deleting qtree %s: %s" % (path, to_native(e)),
|
||||
exception=traceback.format_exc())
|
||||
|
||||
def rename_qtree(self):
|
||||
path = '/vol/%s/%s' % (self.flexvol_name, self.name)
|
||||
|
@ -189,10 +179,9 @@ class NetAppCDOTQTree(object):
|
|||
try:
|
||||
self.server.invoke_successfully(qtree_rename,
|
||||
enable_tunneling=True)
|
||||
except netapp_utils.zapi.NaApiError:
|
||||
err = get_exception()
|
||||
self.module.fail_json(msg="Error renaming qtree %s." % self.name,
|
||||
exception=str(err))
|
||||
except netapp_utils.zapi.NaApiError as e:
|
||||
self.module.fail_json(msg="Error renaming qtree %s: %s" % (self.name, to_native(e)),
|
||||
exception=traceback.format_exc())
|
||||
|
||||
def apply(self):
|
||||
changed = False
|
||||
|
@ -240,5 +229,6 @@ def main():
|
|||
v = NetAppCDOTQTree()
|
||||
v.apply()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -1,22 +1,12 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# (c) 2017, NetApp, Inc
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
@ -88,11 +78,13 @@ EXAMPLES = """
|
|||
RETURN = """
|
||||
|
||||
"""
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
from ansible.module_utils._text import to_native
|
||||
import ansible.module_utils.netapp as netapp_utils
|
||||
|
||||
|
||||
HAS_NETAPP_LIB = netapp_utils.has_netapp_lib()
|
||||
|
||||
|
||||
|
@ -182,11 +174,10 @@ class NetAppCDOTSVM(object):
|
|||
try:
|
||||
self.server.invoke_successfully(vserver_create,
|
||||
enable_tunneling=False)
|
||||
except netapp_utils.zapi.NaApiError:
|
||||
err = get_exception()
|
||||
self.module.fail_json(msg='Error provisioning SVM %s with root volume %s on aggregate %s'
|
||||
% (self.name, self.root_volume, self.root_volume_aggregate),
|
||||
exception=str(err))
|
||||
except netapp_utils.zapi.NaApiError as e:
|
||||
self.module.fail_json(msg='Error provisioning SVM %s with root volume %s on aggregate %s: %s'
|
||||
% (self.name, self.root_volume, self.root_volume_aggregate, to_native(e)),
|
||||
exception=traceback.format_exc())
|
||||
|
||||
def delete_vserver(self):
|
||||
vserver_delete = netapp_utils.zapi.NaElement.create_node_with_children(
|
||||
|
@ -195,11 +186,10 @@ class NetAppCDOTSVM(object):
|
|||
try:
|
||||
self.server.invoke_successfully(vserver_delete,
|
||||
enable_tunneling=False)
|
||||
except netapp_utils.zapi.NaApiError:
|
||||
err = get_exception()
|
||||
self.module.fail_json(msg='Error deleting SVM %s with root volume %s on aggregate %s'
|
||||
% (self.name, self.root_volume, self.root_volume_aggregate),
|
||||
exception=str(err))
|
||||
except netapp_utils.zapi.NaApiError as e:
|
||||
self.module.fail_json(msg='Error deleting SVM %s with root volume %s on aggregate %s: %s'
|
||||
% (self.name, self.root_volume, self.root_volume_aggregate, to_native(e)),
|
||||
exception=traceback.format_exc())
|
||||
|
||||
def rename_vserver(self):
|
||||
vserver_rename = netapp_utils.zapi.NaElement.create_node_with_children(
|
||||
|
@ -209,9 +199,9 @@ class NetAppCDOTSVM(object):
|
|||
try:
|
||||
self.server.invoke_successfully(vserver_rename,
|
||||
enable_tunneling=False)
|
||||
except netapp_utils.zapi.NaApiError:
|
||||
err = get_exception()
|
||||
self.module.fail_json(msg='Error renaming SVM %s' % self.name, exception=str(err))
|
||||
except netapp_utils.zapi.NaApiError as e:
|
||||
self.module.fail_json(msg='Error renaming SVM %s: %s' % (self.name, to_native(e)),
|
||||
exception=traceback.format_exc())
|
||||
|
||||
def apply(self):
|
||||
changed = False
|
||||
|
|
|
@ -1,22 +1,12 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# (c) 2017, NetApp, Inc
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
@ -110,11 +100,13 @@ EXAMPLES = """
|
|||
RETURN = """
|
||||
|
||||
"""
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
from ansible.module_utils._text import to_native
|
||||
import ansible.module_utils.netapp as netapp_utils
|
||||
|
||||
|
||||
HAS_NETAPP_LIB = netapp_utils.has_netapp_lib()
|
||||
|
||||
|
||||
|
@ -199,13 +191,13 @@ class NetAppCDOTUser(object):
|
|||
else:
|
||||
return False
|
||||
|
||||
except netapp_utils.zapi.NaApiError:
|
||||
e = get_exception()
|
||||
except netapp_utils.zapi.NaApiError as e:
|
||||
# Error 16034 denotes a user not being found.
|
||||
if str(e.code) == "16034":
|
||||
if to_native(e.code) == "16034":
|
||||
return False
|
||||
else:
|
||||
self.module.fail_json(msg='Error getting user %s' % self.name, exception=str(e))
|
||||
self.module.fail_json(msg='Error getting user %s: %s' % (self.name, to_native(e)),
|
||||
exception=traceback.format_exc())
|
||||
|
||||
def create_user(self):
|
||||
user_create = netapp_utils.zapi.NaElement.create_node_with_children(
|
||||
|
@ -221,9 +213,9 @@ class NetAppCDOTUser(object):
|
|||
try:
|
||||
self.server.invoke_successfully(user_create,
|
||||
enable_tunneling=False)
|
||||
except netapp_utils.zapi.NaApiError:
|
||||
err = get_exception()
|
||||
self.module.fail_json(msg='Error creating user %s' % self.name, exception=str(err))
|
||||
except netapp_utils.zapi.NaApiError as e:
|
||||
self.module.fail_json(msg='Error creating user %s: %s' % (self.name, to_native(e)),
|
||||
exception=traceback.format_exc())
|
||||
|
||||
def delete_user(self):
|
||||
user_delete = netapp_utils.zapi.NaElement.create_node_with_children(
|
||||
|
@ -236,9 +228,9 @@ class NetAppCDOTUser(object):
|
|||
try:
|
||||
self.server.invoke_successfully(user_delete,
|
||||
enable_tunneling=False)
|
||||
except netapp_utils.zapi.NaApiError:
|
||||
err = get_exception()
|
||||
self.module.fail_json(msg='Error removing user %s' % self.name, exception=str(err))
|
||||
except netapp_utils.zapi.NaApiError as e:
|
||||
self.module.fail_json(msg='Error removing user %s: %s' % (self.name, to_native(e)),
|
||||
exception=traceback.format_exc())
|
||||
|
||||
def change_password(self):
|
||||
"""
|
||||
|
@ -257,13 +249,12 @@ class NetAppCDOTUser(object):
|
|||
try:
|
||||
self.server.invoke_successfully(modify_password,
|
||||
enable_tunneling=True)
|
||||
except netapp_utils.zapi.NaApiError:
|
||||
e = get_exception()
|
||||
if str(e.code) == '13114':
|
||||
except netapp_utils.zapi.NaApiError as e:
|
||||
if to_native(e.code) == '13114':
|
||||
return False
|
||||
else:
|
||||
err = get_exception()
|
||||
self.module.fail_json(msg='Error setting password for user %s' % self.name, exception=str(err))
|
||||
self.module.fail_json(msg='Error setting password for user %s: %s' % (self.name, to_native(e)),
|
||||
exception=traceback.format_exc())
|
||||
|
||||
self.server.set_vserver(None)
|
||||
return True
|
||||
|
|
|
@ -1,22 +1,12 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# (c) 2017, NetApp, Inc
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
@ -84,11 +74,13 @@ EXAMPLES = """
|
|||
RETURN = """
|
||||
|
||||
"""
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
from ansible.module_utils._text import to_native
|
||||
import ansible.module_utils.netapp as netapp_utils
|
||||
|
||||
|
||||
HAS_NETAPP_LIB = netapp_utils.has_netapp_lib()
|
||||
|
||||
|
||||
|
@ -153,13 +145,13 @@ class NetAppCDOTUserRole(object):
|
|||
try:
|
||||
result = self.server.invoke_successfully(
|
||||
security_login_role_get_iter, enable_tunneling=False)
|
||||
except netapp_utils.zapi.NaApiError:
|
||||
e = get_exception()
|
||||
except netapp_utils.zapi.NaApiError as e:
|
||||
# Error 16031 denotes a role not being found.
|
||||
if str(e.code) == "16031":
|
||||
if to_native(e.code) == "16031":
|
||||
return False
|
||||
else:
|
||||
self.module.fail_json(msg='Error getting role %s' % self.name, exception=str(e))
|
||||
self.module.fail_json(msg='Error getting role %s: %s' % (self.name, to_native(e)),
|
||||
exception=traceback.format_exc())
|
||||
|
||||
if (result.get_child_by_name('num-records') and
|
||||
int(result.get_child_content('num-records')) >= 1):
|
||||
|
@ -179,9 +171,9 @@ class NetAppCDOTUserRole(object):
|
|||
try:
|
||||
self.server.invoke_successfully(role_create,
|
||||
enable_tunneling=False)
|
||||
except netapp_utils.zapi.NaApiError:
|
||||
err = get_exception()
|
||||
self.module.fail_json(msg='Error creating role %s' % self.name, exception=str(err))
|
||||
except netapp_utils.zapi.NaApiError as e:
|
||||
self.module.fail_json(msg='Error creating role %s: %s' % (self.name, to_native(e)),
|
||||
exception=traceback.format_exc())
|
||||
|
||||
def delete_role(self):
|
||||
role_delete = netapp_utils.zapi.NaElement.create_node_with_children(
|
||||
|
@ -193,9 +185,9 @@ class NetAppCDOTUserRole(object):
|
|||
try:
|
||||
self.server.invoke_successfully(role_delete,
|
||||
enable_tunneling=False)
|
||||
except netapp_utils.zapi.NaApiError:
|
||||
err = get_exception()
|
||||
self.module.fail_json(msg='Error removing role %s' % self.name, exception=str(err))
|
||||
except netapp_utils.zapi.NaApiError as e:
|
||||
self.module.fail_json(msg='Error removing role %s: %s' % (self.name, to_native(e)),
|
||||
exception=traceback.format_exc())
|
||||
|
||||
def apply(self):
|
||||
changed = False
|
||||
|
|
|
@ -1,22 +1,12 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# (c) 2017, NetApp, Inc
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
@ -114,11 +104,13 @@ RETURN = """
|
|||
|
||||
|
||||
"""
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
from ansible.module_utils._text import to_native
|
||||
import ansible.module_utils.netapp as netapp_utils
|
||||
|
||||
|
||||
HAS_NETAPP_LIB = netapp_utils.has_netapp_lib()
|
||||
|
||||
|
||||
|
@ -243,10 +235,9 @@ class NetAppCDOTVolume(object):
|
|||
try:
|
||||
self.server.invoke_successfully(volume_create,
|
||||
enable_tunneling=True)
|
||||
except netapp_utils.zapi.NaApiError:
|
||||
err = get_exception()
|
||||
self.module.fail_json(msg='Error provisioning volume %s of size %s' % (self.name, self.size),
|
||||
exception=str(err))
|
||||
except netapp_utils.zapi.NaApiError as e:
|
||||
self.module.fail_json(msg='Error provisioning volume %s of size %s: %s' % (self.name, self.size, to_native(e)),
|
||||
exception=traceback.format_exc())
|
||||
|
||||
def delete_volume(self):
|
||||
if self.is_infinite:
|
||||
|
@ -260,10 +251,9 @@ class NetAppCDOTVolume(object):
|
|||
try:
|
||||
self.server.invoke_successfully(volume_delete,
|
||||
enable_tunneling=True)
|
||||
except netapp_utils.zapi.NaApiError:
|
||||
err = get_exception()
|
||||
self.module.fail_json(msg='Error deleting volume %s' % self.name,
|
||||
exception=str(err))
|
||||
except netapp_utils.zapi.NaApiError as e:
|
||||
self.module.fail_json(msg='Error deleting volume %s: %s' % (self.name, to_native(e)),
|
||||
exception=traceback.format_exc())
|
||||
|
||||
def rename_volume(self):
|
||||
"""
|
||||
|
@ -284,10 +274,9 @@ class NetAppCDOTVolume(object):
|
|||
try:
|
||||
self.server.invoke_successfully(volume_rename,
|
||||
enable_tunneling=True)
|
||||
except netapp_utils.zapi.NaApiError:
|
||||
err = get_exception()
|
||||
self.module.fail_json(msg='Error renaming volume %s' % self.name,
|
||||
exception=str(err))
|
||||
except netapp_utils.zapi.NaApiError as e:
|
||||
self.module.fail_json(msg='Error renaming volume %s: %s' % (self.name, to_native(e)),
|
||||
exception=traceback.format_exc())
|
||||
|
||||
def resize_volume(self):
|
||||
"""
|
||||
|
@ -308,10 +297,9 @@ class NetAppCDOTVolume(object):
|
|||
try:
|
||||
self.server.invoke_successfully(volume_resize,
|
||||
enable_tunneling=True)
|
||||
except netapp_utils.zapi.NaApiError:
|
||||
err = get_exception()
|
||||
self.module.fail_json(msg='Error re-sizing volume %s' % self.name,
|
||||
exception=str(err))
|
||||
except netapp_utils.zapi.NaApiError as e:
|
||||
self.module.fail_json(msg='Error re-sizing volume %s: %s' % (self.name, to_native(e)),
|
||||
exception=traceback.format_exc())
|
||||
|
||||
def change_volume_state(self):
|
||||
"""
|
||||
|
@ -346,10 +334,10 @@ class NetAppCDOTVolume(object):
|
|||
try:
|
||||
self.server.invoke_successfully(volume_change_state,
|
||||
enable_tunneling=True)
|
||||
except netapp_utils.zapi.NaApiError:
|
||||
err = get_exception()
|
||||
self.module.fail_json(msg='Error changing the state of volume %s to %s' % (self.name, state_requested),
|
||||
exception=str(err))
|
||||
except netapp_utils.zapi.NaApiError as e:
|
||||
self.module.fail_json(msg='Error changing the state of volume %s to %s: %s' %
|
||||
(self.name, state_requested, to_native(e)),
|
||||
exception=traceback.format_exc())
|
||||
|
||||
def apply(self):
|
||||
changed = False
|
||||
|
|
|
@ -1,21 +1,11 @@
|
|||
#!/usr/bin/python
|
||||
# (c) 2016, NetApp, Inc
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
@ -122,15 +112,19 @@ msg:
|
|||
""" # NOQA
|
||||
|
||||
import json
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule, get_exception
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils._text import to_native
|
||||
from ansible.module_utils.netapp import request, eseries_host_argument_spec
|
||||
|
||||
|
||||
HEADERS = {
|
||||
"Content-Type": "application/json",
|
||||
"Accept": "application/json",
|
||||
}
|
||||
|
||||
|
||||
def has_match(module, ssid, api_url, api_pwd, api_usr, body):
|
||||
compare_keys = ['syncIntervalMinutes', 'syncWarnThresholdMinutes',
|
||||
'recoveryWarnThresholdMinutes', 'repoUtilizationWarnThreshold']
|
||||
|
@ -145,9 +139,8 @@ def has_match(module, ssid, api_url, api_pwd, api_usr, body):
|
|||
url = api_url + endpoint
|
||||
try:
|
||||
rc, data = request(url, url_username=api_usr, url_password=api_pwd, headers=HEADERS)
|
||||
except Exception:
|
||||
error = get_exception()
|
||||
module.exit_json(exception="Error finding a match. Message: %s" % str(error))
|
||||
except Exception as e:
|
||||
module.exit_json(msg="Error finding a match. Message: %s" % to_native(e), exception=traceback.format_exc())
|
||||
|
||||
for async_group in data:
|
||||
if async_group['label'] == desired_name:
|
||||
|
@ -174,9 +167,9 @@ def create_async(module, ssid, api_url, api_pwd, api_usr, body):
|
|||
try:
|
||||
rc, data = request(url, data=post_data, method='POST', url_username=api_usr, url_password=api_pwd,
|
||||
headers=HEADERS)
|
||||
except Exception:
|
||||
error = get_exception()
|
||||
module.exit_json(exception="Exception while creating aysnc mirror group. Message: %s" % str(error))
|
||||
except Exception as e:
|
||||
module.exit_json(msg="Exception while creating aysnc mirror group. Message: %s" % to_native(e),
|
||||
exception=traceback.format_exc())
|
||||
return data
|
||||
|
||||
|
||||
|
@ -195,9 +188,9 @@ def update_async(module, ssid, api_url, pwd, user, body, new_name, async_id):
|
|||
try:
|
||||
rc, data = request(url, data=post_data, method='POST', headers=HEADERS,
|
||||
url_username=user, url_password=pwd)
|
||||
except Exception:
|
||||
error = get_exception()
|
||||
module.exit_json(exception="Exception while updating async mirror group. Message: %s" % str(error))
|
||||
except Exception as e:
|
||||
module.exit_json(msg="Exception while updating async mirror group. Message: %s" % to_native(e),
|
||||
exception=traceback.format_exc())
|
||||
|
||||
return data
|
||||
|
||||
|
@ -208,9 +201,9 @@ def remove_amg(module, ssid, api_url, pwd, user, async_id):
|
|||
try:
|
||||
rc, data = request(url, method='DELETE', url_username=user, url_password=pwd,
|
||||
headers=HEADERS)
|
||||
except Exception:
|
||||
error = get_exception()
|
||||
module.exit_json(exception="Exception while removing async mirror group. Message: %s" % str(error))
|
||||
except Exception as e:
|
||||
module.exit_json(msg="Exception while removing async mirror group. Message: %s" % to_native(e),
|
||||
exception=traceback.format_exc())
|
||||
|
||||
return
|
||||
|
||||
|
|
|
@ -1,22 +1,12 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# (c) 2016, NetApp, Inc
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
@ -90,13 +80,14 @@ msg:
|
|||
sample: "No Async Mirror Group with the name."
|
||||
"""
|
||||
import json
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.api import basic_auth_argument_spec
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
from ansible.module_utils.urls import open_url
|
||||
from ansible.module_utils.six.moves.urllib.error import HTTPError
|
||||
from ansible.module_utils._text import to_native
|
||||
from ansible.module_utils.urls import open_url
|
||||
|
||||
|
||||
HEADERS = {
|
||||
"Content-Type": "application/json",
|
||||
|
@ -112,9 +103,8 @@ def request(url, data=None, headers=None, method='GET', use_proxy=True,
|
|||
force=force, last_mod_time=last_mod_time, timeout=timeout, validate_certs=validate_certs,
|
||||
url_username=url_username, url_password=url_password, http_agent=http_agent,
|
||||
force_basic_auth=force_basic_auth)
|
||||
except HTTPError:
|
||||
err = get_exception()
|
||||
r = err.fp
|
||||
except HTTPError as e:
|
||||
r = e.fp
|
||||
|
||||
try:
|
||||
raw_data = r.read()
|
||||
|
@ -167,21 +157,21 @@ def update_amg(module, ssid, api_url, api_usr, api_pwd, body, amg_id):
|
|||
try:
|
||||
request(url, data=post_data, method='POST', url_username=api_usr,
|
||||
url_password=api_pwd, headers=HEADERS)
|
||||
except:
|
||||
err = get_exception()
|
||||
except Exception as e:
|
||||
module.fail_json(
|
||||
msg="Failed to change role of AMG. Id [%s]. AMG Id [%s]. Error [%s]" % (ssid, amg_id, str(err)))
|
||||
msg="Failed to change role of AMG. Id [%s]. AMG Id [%s]. Error [%s]" % (ssid, amg_id, to_native(e)),
|
||||
exception=traceback.format_exc())
|
||||
|
||||
status_endpoint = 'storage-systems/%s/async-mirrors/%s' % (ssid, amg_id)
|
||||
status_url = api_url + status_endpoint
|
||||
try:
|
||||
rc, status = request(status_url, method='GET', url_username=api_usr,
|
||||
url_password=api_pwd, headers=HEADERS)
|
||||
except:
|
||||
err = get_exception()
|
||||
except Exception as e:
|
||||
module.fail_json(
|
||||
msg="Failed to check status of AMG after role reversal. " +
|
||||
"Id [%s]. AMG Id [%s]. Error [%s]" % (ssid, amg_id, str(err)))
|
||||
msg="Failed to check status of AMG after role reversal. "
|
||||
"Id [%s]. AMG Id [%s]. Error [%s]" % (ssid, amg_id, to_native(e)),
|
||||
exception=traceback.format_exc())
|
||||
|
||||
# Here we wait for the role reversal to complete
|
||||
if 'roleChangeProgress' in status:
|
||||
|
@ -189,11 +179,11 @@ def update_amg(module, ssid, api_url, api_usr, api_pwd, body, amg_id):
|
|||
try:
|
||||
rc, status = request(status_url, method='GET',
|
||||
url_username=api_usr, url_password=api_pwd, headers=HEADERS)
|
||||
except:
|
||||
err = get_exception()
|
||||
except Exception as e:
|
||||
module.fail_json(
|
||||
msg="Failed to check status of AMG after role reversal. " +
|
||||
"Id [%s]. AMG Id [%s]. Error [%s]" % (ssid, amg_id, str(err)))
|
||||
msg="Failed to check status of AMG after role reversal. "
|
||||
"Id [%s]. AMG Id [%s]. Error [%s]" % (ssid, amg_id, to_native(e)),
|
||||
exception=traceback.format_exc())
|
||||
return status
|
||||
|
||||
|
||||
|
|
|
@ -1,22 +1,12 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# (c) 2016, NetApp, Inc
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
@ -133,10 +123,8 @@ import json
|
|||
|
||||
from ansible.module_utils.api import basic_auth_argument_spec
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
from ansible.module_utils.urls import open_url
|
||||
from ansible.module_utils.six.moves.urllib.error import HTTPError
|
||||
from ansible.module_utils.urls import open_url
|
||||
|
||||
|
||||
def request(url, data=None, headers=None, method='GET', use_proxy=True,
|
||||
|
@ -147,9 +135,8 @@ def request(url, data=None, headers=None, method='GET', use_proxy=True,
|
|||
force=force, last_mod_time=last_mod_time, timeout=timeout, validate_certs=validate_certs,
|
||||
url_username=url_username, url_password=url_password, http_agent=http_agent,
|
||||
force_basic_auth=force_basic_auth)
|
||||
except HTTPError:
|
||||
err = get_exception()
|
||||
r = err.fp
|
||||
except HTTPError as e:
|
||||
r = e.fp
|
||||
|
||||
try:
|
||||
raw_data = r.read()
|
||||
|
|
|
@ -1,22 +1,12 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# (c) 2016, NetApp, Inc
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
@ -96,13 +86,13 @@ msg:
|
|||
sample: "Password Updated Successfully"
|
||||
'''
|
||||
import json
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.api import basic_auth_argument_spec
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
from ansible.module_utils.urls import open_url
|
||||
from ansible.module_utils.six.moves.urllib.error import HTTPError
|
||||
from ansible.module_utils._text import to_native
|
||||
from ansible.module_utils.urls import open_url
|
||||
|
||||
|
||||
HEADERS = {
|
||||
|
@ -119,9 +109,8 @@ def request(url, data=None, headers=None, method='GET', use_proxy=True,
|
|||
force=force, last_mod_time=last_mod_time, timeout=timeout, validate_certs=validate_certs,
|
||||
url_username=url_username, url_password=url_password, http_agent=http_agent,
|
||||
force_basic_auth=force_basic_auth)
|
||||
except HTTPError:
|
||||
err = get_exception()
|
||||
r = err.fp
|
||||
except HTTPError as e:
|
||||
r = e.fp
|
||||
|
||||
try:
|
||||
raw_data = r.read()
|
||||
|
@ -173,10 +162,9 @@ def get_pwd_status(module, ssid, api_url, user, pwd):
|
|||
try:
|
||||
rc, data = request(url, headers=HEADERS, url_username=user, url_password=pwd)
|
||||
return data['readOnlyPasswordSet'], data['adminPasswordSet']
|
||||
except HTTPError:
|
||||
error = get_exception()
|
||||
except HTTPError as e:
|
||||
module.fail_json(msg="There was an issue with connecting, please check that your "
|
||||
"endpoint is properly defined and your credentials are correct: %s" % str(error))
|
||||
"endpoint is properly defined and your credentials are correct: %s" % to_native(e))
|
||||
|
||||
|
||||
def update_storage_system_pwd(module, ssid, pwd, api_url, api_usr, api_pwd):
|
||||
|
@ -186,9 +174,8 @@ def update_storage_system_pwd(module, ssid, pwd, api_url, api_usr, api_pwd):
|
|||
try:
|
||||
rc, data = request(url, data=post_body, method='POST', headers=HEADERS, url_username=api_usr,
|
||||
url_password=api_pwd)
|
||||
except:
|
||||
err = get_exception()
|
||||
module.fail_json(msg="Failed to update system password. Id [%s]. Error [%s]" % (ssid, str(err)))
|
||||
except Exception as e:
|
||||
module.fail_json(msg="Failed to update system password. Id [%s]. Error [%s]" % (ssid, to_native(e)))
|
||||
return data
|
||||
|
||||
|
||||
|
@ -205,15 +192,14 @@ def set_password(module, ssid, api_url, user, pwd, current_password=None, new_pa
|
|||
try:
|
||||
rc, data = request(url, method='POST', data=post_body, headers=HEADERS, url_username=user, url_password=pwd,
|
||||
ignore_errors=True)
|
||||
except:
|
||||
err = get_exception()
|
||||
module.fail_json(msg="Failed to set system password. Id [%s]. Error [%s]" % (ssid, str(err)))
|
||||
except Exception as e:
|
||||
module.fail_json(msg="Failed to set system password. Id [%s]. Error [%s]" % (ssid, to_native(e)), exception=traceback.format_exc())
|
||||
|
||||
if rc == 422:
|
||||
post_body = json.dumps(dict(currentAdminPassword='', adminPassword=set_admin, newPassword=new_password))
|
||||
try:
|
||||
rc, data = request(url, method='POST', data=post_body, headers=HEADERS, url_username=user, url_password=pwd)
|
||||
except Exception:
|
||||
except:
|
||||
module.fail_json(msg="Wrong or no admin password supplied. Please update your playbook and try again")
|
||||
|
||||
update_data = update_storage_system_pwd(module, ssid, new_password, api_url, user, pwd)
|
||||
|
|
|
@ -1,22 +1,12 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# (c) 2016, NetApp, Inc
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
@ -75,7 +65,8 @@ msg:
|
|||
import json
|
||||
|
||||
from ansible.module_utils.api import basic_auth_argument_spec
|
||||
from ansible.module_utils.basic import AnsibleModule, get_exception
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils._text import to_native
|
||||
from ansible.module_utils.urls import open_url
|
||||
from ansible.module_utils.six.moves.urllib.error import HTTPError
|
||||
|
||||
|
@ -88,9 +79,8 @@ def request(url, data=None, headers=None, method='GET', use_proxy=True,
|
|||
force=force, last_mod_time=last_mod_time, timeout=timeout, validate_certs=validate_certs,
|
||||
url_username=url_username, url_password=url_password, http_agent=http_agent,
|
||||
force_basic_auth=force_basic_auth)
|
||||
except HTTPError:
|
||||
err = get_exception()
|
||||
r = err.fp
|
||||
except HTTPError as e:
|
||||
r = e.fp
|
||||
|
||||
try:
|
||||
raw_data = r.read()
|
||||
|
@ -141,10 +131,9 @@ def main():
|
|||
(rc, resp) = request(api_url + "/storage-systems/%s/graph" % ssid,
|
||||
headers=dict(Accept="application/json"),
|
||||
url_username=api_usr, url_password=api_pwd, validate_certs=validate_certs)
|
||||
except:
|
||||
error = get_exception()
|
||||
except Exception as e:
|
||||
module.fail_json(
|
||||
msg="Failed to obtain facts from storage array with id [%s]. Error [%s]" % (ssid, str(error)))
|
||||
msg="Failed to obtain facts from storage array with id [%s]. Error [%s]" % (ssid, to_native(e)))
|
||||
|
||||
facts['snapshot_images'] = [
|
||||
dict(
|
||||
|
|
|
@ -1,22 +1,12 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# (c) 2016, NetApp, Inc
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
|
|
@ -1,22 +1,12 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# (c) 2016, NetApp, Inc
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
|
|
@ -2,23 +2,12 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# (c) 2016, NetApp, Inc
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
@ -139,10 +128,9 @@ HEADERS = {
|
|||
import json
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
|
||||
from ansible.module_utils.urls import open_url
|
||||
from ansible.module_utils.six.moves.urllib.error import HTTPError
|
||||
from ansible.module_utils._text import to_native
|
||||
from ansible.module_utils.urls import open_url
|
||||
|
||||
|
||||
def request(url, data=None, headers=None, method='GET', use_proxy=True,
|
||||
|
@ -153,9 +141,8 @@ def request(url, data=None, headers=None, method='GET', use_proxy=True,
|
|||
force=force, last_mod_time=last_mod_time, timeout=timeout, validate_certs=validate_certs,
|
||||
url_username=url_username, url_password=url_password, http_agent=http_agent,
|
||||
force_basic_auth=force_basic_auth)
|
||||
except HTTPError:
|
||||
err = get_exception()
|
||||
r = err.fp
|
||||
except HTTPError as e:
|
||||
r = e.fp
|
||||
|
||||
try:
|
||||
raw_data = r.read()
|
||||
|
@ -194,9 +181,8 @@ def get_hostgroups(module, ssid, api_url, user, pwd):
|
|||
try:
|
||||
rc, data = request(url, headers=HEADERS, url_username=user, url_password=pwd)
|
||||
return rc, data
|
||||
except HTTPError:
|
||||
err = get_exception()
|
||||
module.fail_json(msg="Failed to get host groups. Id [%s]. Error [%s]." % (ssid, str(err)))
|
||||
except HTTPError as e:
|
||||
module.fail_json(msg="Failed to get host groups. Id [%s]. Error [%s]." % (ssid, to_native(e)))
|
||||
|
||||
|
||||
def get_hostref(module, ssid, name, api_url, user, pwd):
|
||||
|
@ -204,9 +190,8 @@ def get_hostref(module, ssid, name, api_url, user, pwd):
|
|||
url = api_url + all_hosts
|
||||
try:
|
||||
rc, data = request(url, method='GET', headers=HEADERS, url_username=user, url_password=pwd)
|
||||
except Exception:
|
||||
err = get_exception()
|
||||
module.fail_json(msg="Failed to get hosts. Id [%s]. Error [%s]." % (ssid, str(err)))
|
||||
except Exception as e:
|
||||
module.fail_json(msg="Failed to get hosts. Id [%s]. Error [%s]." % (ssid, to_native(e)))
|
||||
|
||||
for host in data:
|
||||
if host['name'] == name:
|
||||
|
@ -230,9 +215,8 @@ def create_hostgroup(module, ssid, name, api_url, user, pwd, hosts=None):
|
|||
post_data = json.dumps(dict(name=name, hosts=hostrefs))
|
||||
try:
|
||||
rc, data = request(url, method='POST', data=post_data, headers=HEADERS, url_username=user, url_password=pwd)
|
||||
except Exception:
|
||||
err = get_exception()
|
||||
module.fail_json(msg="Failed to create host group. Id [%s]. Error [%s]." % (ssid, str(err)))
|
||||
except Exception as e:
|
||||
module.fail_json(msg="Failed to create host group. Id [%s]. Error [%s]." % (ssid, to_native(e)))
|
||||
|
||||
return rc, data
|
||||
|
||||
|
@ -255,10 +239,9 @@ def update_hostgroup(module, ssid, name, api_url, user, pwd, hosts=None, new_nam
|
|||
|
||||
try:
|
||||
rc, data = request(url, method='POST', data=post_data, headers=HEADERS, url_username=user, url_password=pwd)
|
||||
except Exception:
|
||||
err = get_exception()
|
||||
except Exception as e:
|
||||
module.fail_json(msg="Failed to update host group. Group [%s]. Id [%s]. Error [%s]." % (gid, ssid,
|
||||
str(err)))
|
||||
to_native(e)))
|
||||
|
||||
return rc, data
|
||||
|
||||
|
@ -269,9 +252,8 @@ def delete_hostgroup(module, ssid, group_id, api_url, user, pwd):
|
|||
# TODO: Loop through hosts, do mapping to href, make new list to pass to data
|
||||
try:
|
||||
rc, data = request(url, method='DELETE', headers=HEADERS, url_username=user, url_password=pwd)
|
||||
except Exception:
|
||||
err = get_exception()
|
||||
module.fail_json(msg="Failed to delete host group. Group [%s]. Id [%s]. Error [%s]." % (group_id, ssid, str(err)))
|
||||
except Exception as e:
|
||||
module.fail_json(msg="Failed to delete host group. Group [%s]. Id [%s]. Error [%s]." % (group_id, ssid, to_native(e)))
|
||||
|
||||
return rc, data
|
||||
|
||||
|
@ -294,24 +276,22 @@ def get_hosts_in_group(module, ssid, group_name, api_url, user, pwd):
|
|||
g_url = api_url + all_groups
|
||||
try:
|
||||
g_rc, g_data = request(g_url, method='GET', headers=HEADERS, url_username=user, url_password=pwd)
|
||||
except Exception:
|
||||
err = get_exception()
|
||||
except Exception as e:
|
||||
module.fail_json(
|
||||
msg="Failed in first step getting hosts from group. Group: [%s]. Id [%s]. Error [%s]." % (group_name,
|
||||
ssid,
|
||||
str(err)))
|
||||
to_native(e)))
|
||||
|
||||
all_hosts = 'storage-systems/%s/hosts' % ssid
|
||||
h_url = api_url + all_hosts
|
||||
try:
|
||||
h_rc, h_data = request(h_url, method='GET', headers=HEADERS, url_username=user, url_password=pwd)
|
||||
except Exception:
|
||||
err = get_exception()
|
||||
except Exception as e:
|
||||
module.fail_json(
|
||||
msg="Failed in second step getting hosts from group. Group: [%s]. Id [%s]. Error [%s]." % (
|
||||
group_name,
|
||||
ssid,
|
||||
str(err)))
|
||||
to_native(e)))
|
||||
|
||||
hosts_in_group = []
|
||||
|
||||
|
@ -371,9 +351,8 @@ def main():
|
|||
if not exists:
|
||||
try:
|
||||
rc, data = create_hostgroup(module, ssid, name, api_url, user, pwd, hosts)
|
||||
except Exception:
|
||||
err = get_exception()
|
||||
module.fail_json(msg="Failed to create a host group. Id [%s]. Error [%s]." % (ssid, str(err)))
|
||||
except Exception as e:
|
||||
module.fail_json(msg="Failed to create a host group. Id [%s]. Error [%s]." % (ssid, to_native(e)))
|
||||
|
||||
hosts = get_hosts_in_group(module, ssid, name, api_url, user, pwd)
|
||||
module.exit_json(changed=True, hosts=hosts, **data)
|
||||
|
@ -389,10 +368,9 @@ def main():
|
|||
if set(current_hosts) != set(hosts):
|
||||
try:
|
||||
rc, data = update_hostgroup(module, ssid, name, api_url, user, pwd, hosts, new_name)
|
||||
except Exception:
|
||||
err = get_exception()
|
||||
except Exception as e:
|
||||
module.fail_json(
|
||||
msg="Failed to update host group. Group: [%s]. Id [%s]. Error [%s]." % (name, ssid, str(err)))
|
||||
msg="Failed to update host group. Group: [%s]. Id [%s]. Error [%s]." % (name, ssid, to_native(e)))
|
||||
module.exit_json(changed=True, hosts=hosts, **data)
|
||||
else:
|
||||
for group in group_data:
|
||||
|
@ -404,10 +382,9 @@ def main():
|
|||
hg_id = get_hostgroup_id(module, ssid, name, api_url, user, pwd)
|
||||
try:
|
||||
rc, data = delete_hostgroup(module, ssid, hg_id, api_url, user, pwd)
|
||||
except Exception:
|
||||
err = get_exception()
|
||||
except Exception as e:
|
||||
module.fail_json(
|
||||
msg="Failed to delete host group. Group: [%s]. Id [%s]. Error [%s]." % (name, ssid, str(err)))
|
||||
msg="Failed to delete host group. Group: [%s]. Id [%s]. Error [%s]." % (name, ssid, to_native(e)))
|
||||
|
||||
module.exit_json(changed=True, msg="Host Group deleted")
|
||||
else:
|
||||
|
|
|
@ -1,22 +1,11 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# (c) 2016, NetApp, Inc
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
|
|
@ -1,22 +1,12 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# (c) 2016, NetApp, Inc
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
|
|
@ -1,22 +1,12 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# (c) 2016, NetApp, Inc
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
|
|
@ -1,22 +1,12 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# (c) 2016, NetApp, Inc
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
|
|
@ -1,22 +1,12 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# (c) 2016, NetApp, Inc
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
|
|
@ -1,21 +1,11 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# (c) 2016, NetApp, Inc
|
||||
#
|
||||
# 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/>.
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -409,7 +399,7 @@ class NetAppESeriesStoragePool(object):
|
|||
if raid_level in [None, 'raid0']:
|
||||
return disk_size_bytes * disk_count
|
||||
if raid_level == 'raid1':
|
||||
return (disk_size_bytes * disk_count) / 2
|
||||
return (disk_size_bytes * disk_count) // 2
|
||||
if raid_level in ['raid3', 'raid5']:
|
||||
return (disk_size_bytes * disk_count) - disk_size_bytes
|
||||
if raid_level in ['raid6', 'raidDiskPool']:
|
||||
|
|
|
@ -1,22 +1,11 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# (c) 2016, NetApp, Inc
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
|
|
@ -1,22 +1,12 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# (c) 2016, NetApp, Inc
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
|
|
@ -1,22 +1,12 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# (c) 2017, NetApp, Inc
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
@ -115,11 +105,13 @@ EXAMPLES = """
|
|||
RETURN = """
|
||||
|
||||
"""
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
from ansible.module_utils._text import to_native
|
||||
import ansible.module_utils.netapp as netapp_utils
|
||||
|
||||
|
||||
HAS_SF_SDK = netapp_utils.has_sf_sdk()
|
||||
|
||||
|
||||
|
@ -188,17 +180,17 @@ class SolidFireAccount(object):
|
|||
initiator_secret=self.initiator_secret,
|
||||
target_secret=self.target_secret,
|
||||
attributes=self.attributes)
|
||||
except:
|
||||
err = get_exception()
|
||||
self.module.fail_json(msg='Error creating account %s' % self.name, exception=str(err))
|
||||
except Exception as e:
|
||||
self.module.fail_json(msg='Error creating account %s: %s)' % (self.name, to_native(e)),
|
||||
exception=traceback.format_exc())
|
||||
|
||||
def delete_account(self):
|
||||
try:
|
||||
self.sfe.remove_account(account_id=self.account_id)
|
||||
|
||||
except:
|
||||
err = get_exception()
|
||||
self.module.fail_json(msg='Error deleting account %s' % self.account_id, exception=str(err))
|
||||
except Exception as e:
|
||||
self.module.fail_json(msg='Error deleting account %s: %s' % (self.account_id, to_native(e)),
|
||||
exception=traceback.format_exc())
|
||||
|
||||
def update_account(self):
|
||||
try:
|
||||
|
@ -209,9 +201,9 @@ class SolidFireAccount(object):
|
|||
target_secret=self.target_secret,
|
||||
attributes=self.attributes)
|
||||
|
||||
except:
|
||||
err = get_exception()
|
||||
self.module.fail_json(msg='Error updating account %s' % self.account_id, exception=str(err))
|
||||
except Exception as e:
|
||||
self.module.fail_json(msg='Error updating account %s: %s' % (self.account_id, to_native(e)),
|
||||
exception=traceback.format_exc())
|
||||
|
||||
def apply(self):
|
||||
changed = False
|
||||
|
|
|
@ -1,22 +1,12 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# (c) 2017, NetApp, Inc
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
@ -72,11 +62,13 @@ EXAMPLES = """
|
|||
RETURN = """
|
||||
|
||||
"""
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
from ansible.module_utils._text import to_native
|
||||
import ansible.module_utils.netapp as netapp_utils
|
||||
|
||||
|
||||
HAS_SF_SDK = netapp_utils.has_sf_sdk()
|
||||
|
||||
|
||||
|
@ -120,9 +112,8 @@ class SolidFireConnection(object):
|
|||
# Todo - Log details about the test
|
||||
return result
|
||||
|
||||
except:
|
||||
err = get_exception()
|
||||
self.module.fail_json(msg='Error checking connection to MVIP', exception=str(err))
|
||||
except Exception as e:
|
||||
self.module.fail_json(msg='Error checking connection to MVIP: %s' % to_native(e), exception=traceback.format_exc())
|
||||
return False
|
||||
|
||||
def check_svip_connection(self):
|
||||
|
@ -138,9 +129,8 @@ class SolidFireConnection(object):
|
|||
# Todo - Log details about the test
|
||||
return result
|
||||
|
||||
except:
|
||||
err = get_exception()
|
||||
self.module.fail_json(msg='Error checking connection to SVIP', exception=str(err))
|
||||
except Exception as e:
|
||||
self.module.fail_json(msg='Error checking connection to SVIP: %s' % to_native(e), exception=traceback.format_exc())
|
||||
return False
|
||||
|
||||
def check(self):
|
||||
|
|
|
@ -1,21 +1,11 @@
|
|||
#!/usr/bin/python
|
||||
# (c) 2017, NetApp, Inc
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
@ -141,13 +131,16 @@ schedule_id:
|
|||
returned: success
|
||||
type: string
|
||||
"""
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
from ansible.module_utils._text import to_native
|
||||
import ansible.module_utils.netapp as netapp_utils
|
||||
|
||||
|
||||
HAS_SF_SDK = netapp_utils.has_sf_sdk()
|
||||
|
||||
|
||||
class SolidFireSnapShotSchedule(object):
|
||||
|
||||
def __init__(self):
|
||||
|
@ -249,9 +242,9 @@ class SolidFireSnapShotSchedule(object):
|
|||
|
||||
self.create_schedule_result = self.sfe.create_schedule(schedule=sched)
|
||||
|
||||
except:
|
||||
err = get_exception()
|
||||
self.module.fail_json(msg='Error creating schedule %s' % self.name, exception=str(err))
|
||||
except Exception as e:
|
||||
self.module.fail_json(msg='Error creating schedule %s: %s' % (self.name, to_native(e)),
|
||||
exception=traceback.format_exc())
|
||||
|
||||
def delete_schedule(self):
|
||||
|
||||
|
@ -261,9 +254,9 @@ class SolidFireSnapShotSchedule(object):
|
|||
sched.to_be_deleted = True
|
||||
self.sfe.modify_schedule(schedule=sched)
|
||||
|
||||
except:
|
||||
err = get_exception()
|
||||
self.module.fail_json(msg='Error deleting schedule %s' % self.name, exception=str(err))
|
||||
except Exception as e:
|
||||
self.module.fail_json(msg='Error deleting schedule %s: %s' % (self.name, to_native(e)),
|
||||
exception=traceback.format_exc())
|
||||
|
||||
def update_schedule(self):
|
||||
|
||||
|
@ -300,9 +293,9 @@ class SolidFireSnapShotSchedule(object):
|
|||
# Make API call
|
||||
self.sfe.modify_schedule(schedule=sched)
|
||||
|
||||
except:
|
||||
err = get_exception()
|
||||
self.module.fail_json(msg='Error updating schedule %s' % self.name, exception=str(err))
|
||||
except Exception as e:
|
||||
self.module.fail_json(msg='Error updating schedule %s: %s' % (self.name, to_native(e)),
|
||||
exception=traceback.format_exc())
|
||||
|
||||
def apply(self):
|
||||
changed = False
|
||||
|
|
|
@ -1,22 +1,12 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# (c) 2017, NetApp, Inc
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
@ -117,10 +107,10 @@ RETURN = """
|
|||
|
||||
|
||||
"""
|
||||
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
from ansible.module_utils._text import to_native
|
||||
import ansible.module_utils.netapp as netapp_utils
|
||||
|
||||
HAS_SF_SDK = netapp_utils.has_sf_sdk()
|
||||
|
@ -188,19 +178,18 @@ class SolidFireVolumeAccessGroup(object):
|
|||
virtual_network_id=self.virtual_network_id,
|
||||
virtual_network_tags=self.virtual_network_tags,
|
||||
attributes=self.attributes)
|
||||
except:
|
||||
err = get_exception()
|
||||
self.module.fail_json(msg="Error creating volume access group %s" % self.name,
|
||||
exception=str(err))
|
||||
except Exception as e:
|
||||
self.module.fail_json(msg="Error creating volume access group %s: %s" %
|
||||
(self.name, to_native(e)), exception=traceback.format_exc())
|
||||
|
||||
def delete_volume_access_group(self):
|
||||
try:
|
||||
self.sfe.delete_volume_access_group(volume_access_group_id=self.volume_access_group_id)
|
||||
|
||||
except:
|
||||
err = get_exception()
|
||||
self.module.fail_json(msg="Error deleting volume access group %s" % self.volume_access_group_id,
|
||||
exception=str(err))
|
||||
except Exception as e:
|
||||
self.module.fail_json(msg="Error deleting volume access group %s: %s" %
|
||||
(self.volume_access_group_id, to_native(e)),
|
||||
exception=traceback.format_exc())
|
||||
|
||||
def update_volume_access_group(self):
|
||||
try:
|
||||
|
@ -211,10 +200,9 @@ class SolidFireVolumeAccessGroup(object):
|
|||
initiators=self.initiators,
|
||||
volumes=self.volumes,
|
||||
attributes=self.attributes)
|
||||
except:
|
||||
err = get_exception()
|
||||
self.module.fail_json(msg="Error updating volume access group %s" % self.volume_access_group_id,
|
||||
exception=str(err))
|
||||
except Exception as e:
|
||||
self.module.fail_json(msg="Error updating volume access group %s: %s" %
|
||||
(self.volume_access_group_id, to_native(e)), exception=traceback.format_exc())
|
||||
|
||||
def apply(self):
|
||||
changed = False
|
||||
|
|
|
@ -1,22 +1,12 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# (c) 2017, NetApp, Inc
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
|
|
@ -2,21 +2,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# (c) 2017, Simon Dodsley (simon@purestorage.com)
|
||||
#
|
||||
# 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/>.
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
|
|
@ -2,21 +2,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# (c) 2017, Simon Dodsley (simon@purestorage.com)
|
||||
#
|
||||
# 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/>.
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -84,16 +74,15 @@ EXAMPLES = '''
|
|||
RETURN = '''
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.pure import get_system, purefa_argument_spec
|
||||
|
||||
|
||||
HAS_PURESTORAGE = True
|
||||
try:
|
||||
from purestorage import purestorage
|
||||
except ImportError:
|
||||
HAS_PURESTORAGE = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.pure import get_system, purefa_argument_spec
|
||||
|
||||
|
||||
def human_to_bytes(size):
|
||||
"""Given a human-readable byte string (e.g. 2G, 30M),
|
||||
|
|
|
@ -2,22 +2,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# (c) 2013, Johan Wiren <johan.wiren.se@gmail.com>
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -93,9 +82,10 @@ EXAMPLES = '''
|
|||
state: absent
|
||||
'''
|
||||
|
||||
|
||||
import os
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
|
||||
class Zfs(object):
|
||||
|
||||
|
@ -275,8 +265,6 @@ def main():
|
|||
result['changed'] = zfs.changed
|
||||
module.exit_json(**result)
|
||||
|
||||
# import module snippets
|
||||
from ansible.module_utils.basic import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -2,22 +2,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# (c) 2016, Adam Števko <adam.stevko@gmail.com>
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -171,10 +160,11 @@ zfs_datasets:
|
|||
}
|
||||
'''
|
||||
|
||||
import os
|
||||
from collections import defaultdict
|
||||
from ansible.module_utils.six import iteritems
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.six import iteritems
|
||||
|
||||
|
||||
SUPPORTED_TYPES = ['all', 'filesystem', 'volume', 'snapshot', 'bookmark']
|
||||
|
||||
|
|
|
@ -2,22 +2,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# (c) 2016, Adam Števko <adam.stevko@gmail.com>
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -123,11 +112,12 @@ zfs_pools:
|
|||
}
|
||||
'''
|
||||
|
||||
import os
|
||||
from collections import defaultdict
|
||||
|
||||
from ansible.module_utils.six import iteritems
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
|
||||
class ZPoolFacts(object):
|
||||
def __init__(self, module):
|
||||
|
||||
|
|
|
@ -2,22 +2,12 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# (c) 2017, Joris Weijters <joris.weijters@gmail.com>
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
|
|
@ -2,21 +2,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# (c) 2016, Alain Dejoux <adejoux@djouxtech.net>
|
||||
#
|
||||
# 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/>.
|
||||
# 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_METADATA = {'status': ['preview'],
|
||||
'supported_by': 'community',
|
||||
|
|
|
@ -1,26 +1,13 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
Ansible module to manage symbolic link alternatives.
|
||||
(c) 2014, Gabe Mulley <gabe.mulley@gmail.com>
|
||||
(c) 2015, David Wittman <dwittman@gmail.com>
|
||||
# (c) 2014, Gabe Mulley <gabe.mulley@gmail.com>
|
||||
# (c) 2015, David Wittman <dwittman@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
|
||||
__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',
|
||||
'status': ['preview'],
|
||||
|
|
|
@ -2,21 +2,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# (c) 2014, Richard Isaacson <richard.c.isaacson@gmail.com>
|
||||
#
|
||||
# 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/>.
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -90,6 +80,8 @@ EXAMPLES = '''
|
|||
import os
|
||||
import tempfile
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
|
||||
def add_job(module, result, at_cmd, count, units, command, script_file):
|
||||
at_command = "%s -f %s now + %s %s" % (at_cmd, script_file, count, units)
|
||||
|
@ -209,8 +201,6 @@ def main():
|
|||
|
||||
module.exit_json(**result)
|
||||
|
||||
# import module snippets
|
||||
from ansible.module_utils.basic import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -1,25 +1,12 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
Ansible module to add authorized_keys for ssh logins.
|
||||
(c) 2012, Brad Olson <brado@movedbylight.com>
|
||||
# (c) 2012, Brad Olson <brado@movedbylight.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
|
||||
__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',
|
||||
'status': ['preview'],
|
||||
|
|
|
@ -2,21 +2,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# (c) 2017, Ted Trask <ttrask01@yahoo.com>
|
||||
#
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# 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/>.
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['stableinterface'],
|
||||
|
|
|
@ -2,22 +2,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# (c) 2016, Adam Števko <adam.stevko@gmail.com>
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
|
|
@ -2,22 +2,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# (c) 2014, Nate Coraor <nate@bx.psu.edu>
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -72,14 +61,11 @@ EXAMPLES = '''
|
|||
state: absent
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
|
||||
OPS = ( '=', '-', '+' )
|
||||
|
||||
# ==============================================================
|
||||
|
||||
import os
|
||||
import tempfile
|
||||
import re
|
||||
|
||||
class CapabilitiesModule(object):
|
||||
|
||||
|
@ -192,8 +178,5 @@ def main():
|
|||
CapabilitiesModule(module)
|
||||
|
||||
|
||||
# import module snippets
|
||||
from ansible.module_utils.basic import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -7,29 +7,11 @@
|
|||
# (c) 2015, Evan Kaufman <evan@digitalflophouse.com>
|
||||
# (c) 2015, Luca Berruti <nadirio@gmail.com>
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# Cron Plugin: The goal of this plugin is to provide an idempotent method for
|
||||
# setting up cron jobs on a host. The script will play well with other manually
|
||||
# entered crons. Each cron job entered will be preceded with a comment
|
||||
# describing the job so that it can be found later, which is required to be
|
||||
# present in order for this plugin to find/modify the job.
|
||||
#
|
||||
# This module is based on python-crontab by Martin Owens.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -235,17 +217,23 @@ EXAMPLES = '''
|
|||
'''
|
||||
|
||||
import os
|
||||
import pwd
|
||||
import re
|
||||
import tempfile
|
||||
import platform
|
||||
import pipes
|
||||
import pwd
|
||||
import re
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule, get_platform
|
||||
|
||||
|
||||
CRONCMD = "/usr/bin/crontab"
|
||||
|
||||
|
||||
class CronTabError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class CronTab(object):
|
||||
"""
|
||||
CronTab object to write time based crontab file
|
||||
|
@ -785,8 +773,6 @@ def main():
|
|||
# --- should never get here
|
||||
module.exit_json(msg="Unable to execute cron task.")
|
||||
|
||||
# import module snippets
|
||||
from ansible.module_utils.basic import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -3,18 +3,8 @@
|
|||
#
|
||||
# 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/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
#
|
||||
# Cronvar Plugin: The goal of this plugin is to provide an idempotent
|
||||
# method for set cron variable values. It should play well with the
|
||||
|
@ -26,6 +16,10 @@
|
|||
# This module is based on the crontab module.
|
||||
#
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
@ -113,19 +107,24 @@ EXAMPLES = '''
|
|||
'''
|
||||
|
||||
import os
|
||||
import re
|
||||
import tempfile
|
||||
import platform
|
||||
import pipes
|
||||
import platform
|
||||
import pwd
|
||||
import re
|
||||
import shlex
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
|
||||
CRONCMD = "/usr/bin/crontab"
|
||||
|
||||
|
||||
class CronVarError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class CronVar(object):
|
||||
"""
|
||||
CronVar object to write variables to crontabs.
|
||||
|
@ -160,7 +159,6 @@ class CronVar(object):
|
|||
self.lines = f.read().splitlines()
|
||||
f.close()
|
||||
except IOError:
|
||||
e = get_exception()
|
||||
# cron file does not exist
|
||||
return
|
||||
except:
|
||||
|
@ -217,7 +215,6 @@ class CronVar(object):
|
|||
os.unlink(self.cron_file)
|
||||
return True
|
||||
except OSError:
|
||||
e = get_exception()
|
||||
# cron file does not exist
|
||||
return False
|
||||
except:
|
||||
|
@ -234,7 +231,6 @@ class CronVar(object):
|
|||
raise CronVarError("Not a variable.")
|
||||
|
||||
def find_variable(self, name):
|
||||
comment = None
|
||||
for l in self.lines:
|
||||
try:
|
||||
(varname, value) = self.parse_for_var(l)
|
||||
|
@ -436,9 +432,6 @@ def main():
|
|||
|
||||
module.exit_json(**res_args)
|
||||
|
||||
# --- should never get here
|
||||
module.exit_json(msg="Unable to execute cronvar task.")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -2,21 +2,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# (c) 2014, Steve <yo@groks.org>
|
||||
#
|
||||
# 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/>.
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -95,8 +85,11 @@ EXAMPLES = '''
|
|||
when: "'/dev/mapper/luks-' in {{ item.device }}"
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
import os
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils._text import to_native
|
||||
|
||||
def main():
|
||||
|
||||
|
@ -142,10 +135,9 @@ def main():
|
|||
try:
|
||||
crypttab = Crypttab(path)
|
||||
existing_line = crypttab.match(name)
|
||||
except Exception:
|
||||
e = get_exception()
|
||||
module.fail_json(msg="failed to open and parse crypttab file: %s" % e,
|
||||
**module.params)
|
||||
except Exception as e:
|
||||
module.fail_json(msg="failed to open and parse crypttab file: %s" % to_native(e),
|
||||
exception=traceback.format_exc(), **module.params)
|
||||
|
||||
if 'present' in state and existing_line is None and backing_device is None:
|
||||
module.fail_json(msg="'backing_device' required to add a new entry",
|
||||
|
@ -375,5 +367,6 @@ class Options(dict):
|
|||
ret.append('%s=%s' % (k, v))
|
||||
return ','.join(ret)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -2,21 +2,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# (c) 2017, Branko Majic <branko@majic.rs>
|
||||
#
|
||||
# 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/>.
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
|
|
@ -1,25 +1,12 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
Ansible module to configure .deb packages.
|
||||
(c) 2014, Brian Coca <briancoca+ansible@gmail.com>
|
||||
# (c) 2014, Brian Coca <briancoca+ansible@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
|
||||
__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',
|
||||
'status': ['stableinterface'],
|
||||
|
@ -103,6 +90,9 @@ EXAMPLES = '''
|
|||
name: tzdata
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
|
||||
def get_selections(module, pkg):
|
||||
cmd = [module.get_bin_path('debconf-show', True), pkg]
|
||||
rc, out, err = module.run_command(' '.join(cmd))
|
||||
|
@ -191,8 +181,6 @@ def main():
|
|||
|
||||
module.exit_json(changed=changed, msg=msg, current=prev)
|
||||
|
||||
# import module snippets
|
||||
from ansible.module_utils.basic import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -2,22 +2,10 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
|
@ -46,6 +34,10 @@ EXAMPLES = '''
|
|||
# Example command-line invocation
|
||||
ansible www.example.net -m facter
|
||||
'''
|
||||
import json
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
|
||||
def main():
|
||||
module = AnsibleModule(
|
||||
|
@ -59,8 +51,6 @@ def main():
|
|||
rc, out, err = module.run_command(cmd, check_rc=True)
|
||||
module.exit_json(**json.loads(out))
|
||||
|
||||
# import module snippets
|
||||
from ansible.module_utils.basic import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -2,21 +2,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# (c) 2013, Alexander Bulimov <lazywolf0@gmail.com>
|
||||
#
|
||||
# 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/>.
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
@ -73,6 +63,10 @@ EXAMPLES = '''
|
|||
dev: /dev/sdb1
|
||||
opts: -cc
|
||||
'''
|
||||
import os
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
|
||||
def _get_dev_size(dev, module):
|
||||
""" Return size in bytes of device. Returns int """
|
||||
|
@ -264,7 +258,6 @@ def main():
|
|||
|
||||
module.exit_json(changed=changed)
|
||||
|
||||
# import module snippets
|
||||
from ansible.module_utils.basic import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -2,21 +2,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# (c) 2013, Adam Miller (maxamillion@fedoraproject.org)
|
||||
#
|
||||
# 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/>.
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
|
|
@ -3,20 +3,11 @@
|
|||
# (c) 2016, Kenneth D. Evensen <kevensen@redhat.com>
|
||||
# (c) 2017, Abhijeet Kasurde <akasurde@redhat.com>
|
||||
#
|
||||
# This file is part of Ansible (sort of)
|
||||
#
|
||||
# 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/>.
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['preview'],
|
||||
|
|
|
@ -3,21 +3,10 @@
|
|||
|
||||
# (c) 2014, Brian Coca <brian.coca+dev@gmail.com>
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
|
@ -100,9 +89,11 @@ EXAMPLES = '''
|
|||
var: getent_shadow
|
||||
|
||||
'''
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils._text import to_native
|
||||
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
|
||||
def main():
|
||||
module = AnsibleModule(
|
||||
|
@ -134,9 +125,8 @@ def main():
|
|||
|
||||
try:
|
||||
rc, out, err = module.run_command(cmd)
|
||||
except Exception:
|
||||
e = get_exception()
|
||||
module.fail_json(msg=str(e))
|
||||
except Exception as e:
|
||||
module.fail_json(msg=to_native(e), exception=traceback.format_exc())
|
||||
|
||||
msg = "Unexpected failure!"
|
||||
dbtree = 'getent_%s' % database
|
||||
|
|
|
@ -2,21 +2,10 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# (c) 2014, Taneli Leppä <taneli@crasman.fi>
|
||||
#
|
||||
# This file is part of Ansible (sort of)
|
||||
#
|
||||
# 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/>.
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
|
@ -182,14 +171,18 @@ EXAMPLES = """
|
|||
run_once: true
|
||||
"""
|
||||
|
||||
import shutil
|
||||
import time
|
||||
import re
|
||||
import socket
|
||||
from ansible.module_utils.pycompat24 import get_exception
|
||||
from ansible.module_utils.basic import *
|
||||
import time
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils._text import to_native
|
||||
|
||||
|
||||
glusterbin = ''
|
||||
|
||||
|
||||
def run_gluster(gargs, **kwargs):
|
||||
global glusterbin
|
||||
global module
|
||||
|
@ -198,10 +191,11 @@ def run_gluster(gargs, **kwargs):
|
|||
try:
|
||||
rc, out, err = module.run_command(args, **kwargs)
|
||||
if rc != 0:
|
||||
module.fail_json(msg='error running gluster (%s) command (rc=%d): %s' % (' '.join(args), rc, out or err))
|
||||
except Exception:
|
||||
e = get_exception()
|
||||
module.fail_json(msg='error running gluster (%s) command: %s' % (' '.join(args), str(e)))
|
||||
module.fail_json(msg='error running gluster (%s) command (rc=%d): %s' %
|
||||
(' '.join(args), rc, out or err), exception=traceback.format_exc())
|
||||
except Exception as e:
|
||||
module.fail_json(msg='error running gluster (%s) command: %s' % (' '.join(args),
|
||||
to_native(e)), exception=traceback.format_exc())
|
||||
return out
|
||||
|
||||
def run_gluster_nofail(gargs, **kwargs):
|
||||
|
@ -226,7 +220,6 @@ def run_gluster_yes(gargs):
|
|||
|
||||
def get_peers():
|
||||
out = run_gluster([ 'peer', 'status'])
|
||||
i = 0
|
||||
peers = {}
|
||||
hostname = None
|
||||
uuid = None
|
||||
|
@ -319,7 +312,6 @@ def probe(host, myhostname):
|
|||
out = run_gluster([ 'peer', 'probe', host ])
|
||||
if out.find('localhost') == -1 and not wait_for_peer(host):
|
||||
module.fail_json(msg='failed to probe peer %s on %s' % (host, myhostname))
|
||||
changed = True
|
||||
|
||||
def probe_all_peers(hosts, peers, myhostname):
|
||||
for host in hosts:
|
||||
|
@ -543,5 +535,6 @@ def main():
|
|||
|
||||
module.exit_json(changed=changed, ansible_facts=facts)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -2,21 +2,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# (c) 2012, Stephen Fromm <sfromm@gmail.com>
|
||||
#
|
||||
# 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/>.
|
||||
# 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_METADATA = {'metadata_version': '1.0',
|
||||
'status': ['stableinterface'],
|
||||
|
@ -66,7 +56,9 @@ EXAMPLES = '''
|
|||
'''
|
||||
|
||||
import grp
|
||||
import platform
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule, load_platform_subclass
|
||||
|
||||
|
||||
class Group(object):
|
||||
"""
|
||||
|
@ -355,7 +347,6 @@ class OpenBsdGroup(Group):
|
|||
def group_mod(self, **kwargs):
|
||||
cmd = [self.module.get_bin_path('groupmod', True)]
|
||||
info = self.group_info()
|
||||
cmd_len = len(cmd)
|
||||
if self.gid is not None and int(self.gid) != info[2]:
|
||||
cmd.append('-g')
|
||||
cmd.append('%d' % int(self.gid))
|
||||
|
@ -397,7 +388,6 @@ class NetBsdGroup(Group):
|
|||
def group_mod(self, **kwargs):
|
||||
cmd = [self.module.get_bin_path('groupmod', True)]
|
||||
info = self.group_info()
|
||||
cmd_len = len(cmd)
|
||||
if self.gid is not None and int(self.gid) != info[2]:
|
||||
cmd.append('-g')
|
||||
cmd.append('%d' % int(self.gid))
|
||||
|
@ -471,8 +461,6 @@ def main():
|
|||
|
||||
module.exit_json(**result)
|
||||
|
||||
# import module snippets
|
||||
from ansible.module_utils.basic import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue