remove wildcards and add boilerplate
* cloud/centurylink * source_control * cloud/google * notification * cloud/rackspace * cloud/vmware
This commit is contained in:
parent
21564cdb98
commit
4109a82d0a
135 changed files with 1343 additions and 2631 deletions
|
@ -1,23 +1,11 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright (c) 2015 CenturyLink
|
# Copyright (c) 2015 CenturyLink
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible.
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
#
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -150,7 +138,7 @@ else:
|
||||||
REQUESTS_FOUND = True
|
REQUESTS_FOUND = True
|
||||||
|
|
||||||
#
|
#
|
||||||
# Requires the clc-python-sdk.
|
# Requires the clc-python-sdk:
|
||||||
# sudo pip install clc-sdk
|
# sudo pip install clc-sdk
|
||||||
#
|
#
|
||||||
try:
|
try:
|
||||||
|
@ -357,5 +345,6 @@ def main():
|
||||||
clc_aa_policy = ClcAntiAffinityPolicy(module)
|
clc_aa_policy = ClcAntiAffinityPolicy(module)
|
||||||
clc_aa_policy.process_request()
|
clc_aa_policy.process_request()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -2,22 +2,11 @@
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright (c) 2015 CenturyLink
|
# Copyright (c) 2015 CenturyLink
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible.
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
#
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -179,6 +168,8 @@ policy:
|
||||||
|
|
||||||
__version__ = '${version}'
|
__version__ = '${version}'
|
||||||
|
|
||||||
|
import json
|
||||||
|
import os
|
||||||
from distutils.version import LooseVersion
|
from distutils.version import LooseVersion
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -201,6 +192,8 @@ except ImportError:
|
||||||
else:
|
else:
|
||||||
CLC_FOUND = True
|
CLC_FOUND = True
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
|
||||||
class ClcAlertPolicy:
|
class ClcAlertPolicy:
|
||||||
|
|
||||||
|
@ -537,6 +530,6 @@ def main():
|
||||||
clc_alert_policy = ClcAlertPolicy(module)
|
clc_alert_policy = ClcAlertPolicy(module)
|
||||||
clc_alert_policy.process_request()
|
clc_alert_policy.process_request()
|
||||||
|
|
||||||
from ansible.module_utils.basic import * # pylint: disable=W0614
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,23 +1,11 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright (c) 2015 CenturyLink
|
# Copyright (c) 2015 CenturyLink
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible.
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
#
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -99,6 +87,7 @@ server_ids:
|
||||||
|
|
||||||
__version__ = '${version}'
|
__version__ = '${version}'
|
||||||
|
|
||||||
|
import os
|
||||||
from distutils.version import LooseVersion
|
from distutils.version import LooseVersion
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -121,6 +110,8 @@ except ImportError:
|
||||||
else:
|
else:
|
||||||
CLC_FOUND = True
|
CLC_FOUND = True
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
|
||||||
class ClcBlueprintPackage:
|
class ClcBlueprintPackage:
|
||||||
|
|
||||||
|
@ -302,6 +293,6 @@ def main():
|
||||||
clc_blueprint_package = ClcBlueprintPackage(module)
|
clc_blueprint_package = ClcBlueprintPackage(module)
|
||||||
clc_blueprint_package.process_request()
|
clc_blueprint_package.process_request()
|
||||||
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,23 +1,11 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright (c) 2015 CenturyLink
|
# Copyright (c) 2015 CenturyLink
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible.
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
#
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -177,6 +165,7 @@ firewall_policy:
|
||||||
|
|
||||||
__version__ = '${version}'
|
__version__ = '${version}'
|
||||||
|
|
||||||
|
import os
|
||||||
import urlparse
|
import urlparse
|
||||||
from time import sleep
|
from time import sleep
|
||||||
from distutils.version import LooseVersion
|
from distutils.version import LooseVersion
|
||||||
|
@ -190,7 +179,6 @@ else:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import clc as clc_sdk
|
import clc as clc_sdk
|
||||||
from clc import CLCException
|
|
||||||
from clc import APIFailedResponse
|
from clc import APIFailedResponse
|
||||||
except ImportError:
|
except ImportError:
|
||||||
CLC_FOUND = False
|
CLC_FOUND = False
|
||||||
|
@ -198,6 +186,8 @@ except ImportError:
|
||||||
else:
|
else:
|
||||||
CLC_FOUND = True
|
CLC_FOUND = True
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
|
||||||
class ClcFirewallPolicy:
|
class ClcFirewallPolicy:
|
||||||
|
|
||||||
|
@ -597,6 +587,6 @@ def main():
|
||||||
clc_firewall = ClcFirewallPolicy(module)
|
clc_firewall = ClcFirewallPolicy(module)
|
||||||
clc_firewall.process_request()
|
clc_firewall.process_request()
|
||||||
|
|
||||||
from ansible.module_utils.basic import * # pylint: disable=W0614
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -2,22 +2,11 @@
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright (c) 2015 CenturyLink
|
# Copyright (c) 2015 CenturyLink
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible.
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
#
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
|
|
@ -1,23 +1,12 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright (c) 2015 CenturyLink
|
# Copyright (c) 2015 CenturyLink
|
||||||
#
|
#
|
||||||
# This file is part of Ansible.
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
#
|
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
from __future__ import absolute_import, division, print_function
|
||||||
# it under the terms of the GNU General Public License as published by
|
__metaclass__ = type
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
#
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -222,6 +211,8 @@ loadbalancer:
|
||||||
|
|
||||||
__version__ = '${version}'
|
__version__ = '${version}'
|
||||||
|
|
||||||
|
import json
|
||||||
|
import os
|
||||||
from time import sleep
|
from time import sleep
|
||||||
from distutils.version import LooseVersion
|
from distutils.version import LooseVersion
|
||||||
|
|
||||||
|
@ -245,6 +236,8 @@ except ImportError:
|
||||||
else:
|
else:
|
||||||
CLC_FOUND = True
|
CLC_FOUND = True
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
|
||||||
class ClcLoadBalancer:
|
class ClcLoadBalancer:
|
||||||
|
|
||||||
|
@ -941,6 +934,6 @@ def main():
|
||||||
clc_loadbalancer = ClcLoadBalancer(module)
|
clc_loadbalancer = ClcLoadBalancer(module)
|
||||||
clc_loadbalancer.process_request()
|
clc_loadbalancer.process_request()
|
||||||
|
|
||||||
from ansible.module_utils.basic import * # pylint: disable=W0614
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,23 +1,11 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright (c) 2015 CenturyLink
|
# Copyright (c) 2015 CenturyLink
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible.
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
#
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -330,6 +318,8 @@ servers:
|
||||||
|
|
||||||
__version__ = '${version}'
|
__version__ = '${version}'
|
||||||
|
|
||||||
|
import json
|
||||||
|
import os
|
||||||
from distutils.version import LooseVersion
|
from distutils.version import LooseVersion
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -353,6 +343,8 @@ except ImportError:
|
||||||
else:
|
else:
|
||||||
CLC_FOUND = True
|
CLC_FOUND = True
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
|
||||||
class ClcModifyServer:
|
class ClcModifyServer:
|
||||||
clc = clc_sdk
|
clc = clc_sdk
|
||||||
|
@ -977,6 +969,6 @@ def main():
|
||||||
clc_modify_server = ClcModifyServer(module)
|
clc_modify_server = ClcModifyServer(module)
|
||||||
clc_modify_server.process_request()
|
clc_modify_server.process_request()
|
||||||
|
|
||||||
from ansible.module_utils.basic import * # pylint: disable=W0614
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,23 +1,11 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright (c) 2015 CenturyLink
|
# Copyright (c) 2015 CenturyLink
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible.
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
#
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
|
|
@ -1,23 +1,11 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright (c) 2015 CenturyLink
|
# Copyright (c) 2015 CenturyLink
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible.
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
#
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -464,7 +452,9 @@ servers:
|
||||||
|
|
||||||
__version__ = '${version}'
|
__version__ = '${version}'
|
||||||
|
|
||||||
from time import sleep
|
import json
|
||||||
|
import os
|
||||||
|
import time
|
||||||
from distutils.version import LooseVersion
|
from distutils.version import LooseVersion
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -488,6 +478,8 @@ except ImportError:
|
||||||
else:
|
else:
|
||||||
CLC_FOUND = True
|
CLC_FOUND = True
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
|
||||||
class ClcServer:
|
class ClcServer:
|
||||||
clc = clc_sdk
|
clc = clc_sdk
|
||||||
|
@ -732,10 +724,8 @@ class ClcServer:
|
||||||
location = account.data.get('primaryDataCenter')
|
location = account.data.get('primaryDataCenter')
|
||||||
data_center = clc.v2.Datacenter(location)
|
data_center = clc.v2.Datacenter(location)
|
||||||
return data_center
|
return data_center
|
||||||
except CLCException as ex:
|
except CLCException:
|
||||||
module.fail_json(
|
module.fail_json(msg="Unable to find location: {0}".format(location))
|
||||||
msg=str(
|
|
||||||
"Unable to find location: {0}".format(location)))
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _find_alias(clc, module):
|
def _find_alias(clc, module):
|
||||||
|
@ -1565,7 +1555,7 @@ class ClcServer:
|
||||||
if retries == 0:
|
if retries == 0:
|
||||||
return module.fail_json(
|
return module.fail_json(
|
||||||
msg='Unable to reach the CLC API after 5 attempts')
|
msg='Unable to reach the CLC API after 5 attempts')
|
||||||
sleep(back_out)
|
time.sleep(back_out)
|
||||||
back_out *= 2
|
back_out *= 2
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -1588,6 +1578,6 @@ def main():
|
||||||
clc_server = ClcServer(module)
|
clc_server = ClcServer(module)
|
||||||
clc_server.process_request()
|
clc_server.process_request()
|
||||||
|
|
||||||
from ansible.module_utils.basic import * # pylint: disable=W0614
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,23 +1,11 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright (c) 2015 CenturyLink
|
# Copyright (c) 2015 CenturyLink
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible.
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
#
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -112,6 +100,7 @@ server_ids:
|
||||||
|
|
||||||
__version__ = '${version}'
|
__version__ = '${version}'
|
||||||
|
|
||||||
|
import os
|
||||||
from distutils.version import LooseVersion
|
from distutils.version import LooseVersion
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -134,6 +123,8 @@ except ImportError:
|
||||||
else:
|
else:
|
||||||
CLC_FOUND = True
|
CLC_FOUND = True
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
|
||||||
class ClcSnapshot:
|
class ClcSnapshot:
|
||||||
|
|
||||||
|
@ -413,6 +404,6 @@ def main():
|
||||||
clc_snapshot = ClcSnapshot(module)
|
clc_snapshot = ClcSnapshot(module)
|
||||||
clc_snapshot.process_request()
|
clc_snapshot.process_request()
|
||||||
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,18 +1,11 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
#
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
# Copyright: Ansible Project
|
||||||
# it under the terms of the GNU General Public License as published by
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
from __future__ import absolute_import, division, print_function
|
||||||
#
|
__metaclass__ = type
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -146,8 +139,6 @@ EXAMPLES = '''
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import urlparse
|
|
||||||
import hashlib
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import boto
|
import boto
|
||||||
|
@ -155,6 +146,9 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_BOTO = False
|
HAS_BOTO = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
|
||||||
def grant_check(module, gs, obj):
|
def grant_check(module, gs, obj):
|
||||||
try:
|
try:
|
||||||
acp = obj.get_acl()
|
acp = obj.get_acl()
|
||||||
|
@ -461,7 +455,5 @@ def main():
|
||||||
module.fail_json(msg="Bucket and Object parameters must be set", failed=True)
|
module.fail_json(msg="Bucket and Object parameters must be set", failed=True)
|
||||||
|
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -2,21 +2,10 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# Copyright (C) 2015 CallFire Inc.
|
# Copyright (C) 2015 CallFire Inc.
|
||||||
#
|
# 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
|
||||||
# This program is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# 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/>.
|
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
@ -333,6 +322,9 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_LIBCLOUD = False
|
HAS_LIBCLOUD = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.gcdns import gcdns_connect
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Constants
|
# Constants
|
||||||
|
@ -788,8 +780,5 @@ def main():
|
||||||
module.exit_json(changed=changed, diff=diff, **json_output)
|
module.exit_json(changed=changed, diff=diff, **json_output)
|
||||||
|
|
||||||
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.gcdns import *
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -2,21 +2,10 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# Copyright (C) 2015 CallFire Inc.
|
# Copyright (C) 2015 CallFire Inc.
|
||||||
#
|
# 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
|
||||||
# This program is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# 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/>.
|
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
@ -139,6 +128,9 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_LIBCLOUD = False
|
HAS_LIBCLOUD = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.gcdns import gcdns_connect
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Constants
|
# Constants
|
||||||
|
@ -379,8 +371,5 @@ def main():
|
||||||
module.exit_json(changed=changed, diff=diff, **json_output)
|
module.exit_json(changed=changed, diff=diff, **json_output)
|
||||||
|
|
||||||
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.gcdns import *
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,20 +1,10 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# Copyright 2013 Google Inc.
|
# Copyright 2013 Google Inc.
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -302,6 +292,12 @@ EXAMPLES = '''
|
||||||
|
|
||||||
import socket
|
import socket
|
||||||
|
|
||||||
|
try:
|
||||||
|
from ast import literal_eval
|
||||||
|
HAS_PYTHON26 = True
|
||||||
|
except ImportError:
|
||||||
|
HAS_PYTHON26 = False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import libcloud
|
import libcloud
|
||||||
from libcloud.compute.types import Provider
|
from libcloud.compute.types import Provider
|
||||||
|
@ -314,11 +310,10 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_LIBCLOUD = False
|
HAS_LIBCLOUD = False
|
||||||
|
|
||||||
try:
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ast import literal_eval
|
from ansible.module_utils.gce import gce_connect, unexpected_error_msg
|
||||||
HAS_PYTHON26 = True
|
from ansible.module_utils.gcp import get_valid_location
|
||||||
except ImportError:
|
from ansible.module_utils.six.moves import reduce
|
||||||
HAS_PYTHON26 = False
|
|
||||||
|
|
||||||
|
|
||||||
def get_instance_info(inst):
|
def get_instance_info(inst):
|
||||||
|
@ -390,7 +385,6 @@ def create_instances(module, gce, instance_names, number, lc_zone):
|
||||||
subnetwork = module.params.get('subnetwork')
|
subnetwork = module.params.get('subnetwork')
|
||||||
persistent_boot_disk = module.params.get('persistent_boot_disk')
|
persistent_boot_disk = module.params.get('persistent_boot_disk')
|
||||||
disks = module.params.get('disks')
|
disks = module.params.get('disks')
|
||||||
state = module.params.get('state')
|
|
||||||
tags = module.params.get('tags')
|
tags = module.params.get('tags')
|
||||||
ip_forward = module.params.get('ip_forward')
|
ip_forward = module.params.get('ip_forward')
|
||||||
external_ip = module.params.get('external_ip')
|
external_ip = module.params.get('external_ip')
|
||||||
|
@ -398,7 +392,6 @@ def create_instances(module, gce, instance_names, number, lc_zone):
|
||||||
preemptible = module.params.get('preemptible')
|
preemptible = module.params.get('preemptible')
|
||||||
disk_size = module.params.get('disk_size')
|
disk_size = module.params.get('disk_size')
|
||||||
service_account_permissions = module.params.get('service_account_permissions')
|
service_account_permissions = module.params.get('service_account_permissions')
|
||||||
service_account_email = module.params.get('service_account_email')
|
|
||||||
|
|
||||||
if external_ip == "none":
|
if external_ip == "none":
|
||||||
instance_external_ip = None
|
instance_external_ip = None
|
||||||
|
@ -657,19 +650,12 @@ def main():
|
||||||
|
|
||||||
gce = gce_connect(module)
|
gce = gce_connect(module)
|
||||||
|
|
||||||
image = module.params.get('image')
|
|
||||||
instance_names = module.params.get('instance_names')
|
instance_names = module.params.get('instance_names')
|
||||||
machine_type = module.params.get('machine_type')
|
|
||||||
metadata = module.params.get('metadata')
|
|
||||||
name = module.params.get('name')
|
name = module.params.get('name')
|
||||||
number = module.params.get('num_instances')
|
number = module.params.get('num_instances')
|
||||||
network = module.params.get('network')
|
|
||||||
subnetwork = module.params.get('subnetwork')
|
subnetwork = module.params.get('subnetwork')
|
||||||
persistent_boot_disk = module.params.get('persistent_boot_disk')
|
|
||||||
state = module.params.get('state')
|
state = module.params.get('state')
|
||||||
tags = module.params.get('tags')
|
|
||||||
zone = module.params.get('zone')
|
zone = module.params.get('zone')
|
||||||
ip_forward = module.params.get('ip_forward')
|
|
||||||
preemptible = module.params.get('preemptible')
|
preemptible = module.params.get('preemptible')
|
||||||
changed = False
|
changed = False
|
||||||
|
|
||||||
|
@ -745,9 +731,5 @@ class LazyDiskImage:
|
||||||
return self.image
|
return self.image
|
||||||
|
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.gce import *
|
|
||||||
from ansible.module_utils.gcp import get_valid_location
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,20 +1,10 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# Copyright 2017 Google Inc.
|
# Copyright 2017 Google Inc.
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -91,6 +81,12 @@ region:
|
||||||
USER_AGENT_VERSION = 'v1'
|
USER_AGENT_VERSION = 'v1'
|
||||||
USER_AGENT_PRODUCT = 'Ansible-gce_eip'
|
USER_AGENT_PRODUCT = 'Ansible-gce_eip'
|
||||||
|
|
||||||
|
try:
|
||||||
|
from ast import literal_eval
|
||||||
|
HAS_PYTHON26 = True
|
||||||
|
except ImportError:
|
||||||
|
HAS_PYTHON26 = False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import libcloud
|
import libcloud
|
||||||
from libcloud.compute.types import Provider
|
from libcloud.compute.types import Provider
|
||||||
|
@ -103,11 +99,9 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_LIBCLOUD = False
|
HAS_LIBCLOUD = False
|
||||||
|
|
||||||
try:
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ast import literal_eval
|
from ansible.module_utils.gcp import gcp_connect
|
||||||
HAS_PYTHON26 = True
|
|
||||||
except ImportError:
|
|
||||||
HAS_PYTHON26 = False
|
|
||||||
|
|
||||||
def get_address(gce, name, region):
|
def get_address(gce, name, region):
|
||||||
"""
|
"""
|
||||||
|
@ -226,8 +220,6 @@ def main():
|
||||||
json_output.update(params)
|
json_output.update(params)
|
||||||
module.exit_json(**json_output)
|
module.exit_json(**json_output)
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.gcp import gcp_connect
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,20 +1,10 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# Copyright 2015 Google Inc. All Rights Reserved.
|
# Copyright 2015 Google Inc. All Rights Reserved.
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
"""An Ansible module to utilize GCE image resources."""
|
"""An Ansible module to utilize GCE image resources."""
|
||||||
|
|
||||||
|
@ -230,5 +220,6 @@ def main():
|
||||||
|
|
||||||
module.exit_json(changed=changed, name=name)
|
module.exit_json(changed=changed, name=name)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,18 +1,10 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# This file is part of Ansible
|
# Copyright: Ansible Project
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
from __future__ import absolute_import, division, print_function
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
__metaclass__ = type
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -243,8 +235,12 @@ EXAMPLES = '''
|
||||||
RETURN = '''
|
RETURN = '''
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
import traceback
|
||||||
from ansible.module_utils.gce import gce_connect
|
try:
|
||||||
|
from ast import literal_eval
|
||||||
|
HAS_PYTHON26 = True
|
||||||
|
except ImportError:
|
||||||
|
HAS_PYTHON26 = False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import libcloud
|
import libcloud
|
||||||
|
@ -258,11 +254,9 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_LIBCLOUD = False
|
HAS_LIBCLOUD = False
|
||||||
|
|
||||||
try:
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ast import literal_eval
|
from ansible.module_utils.gce import gce_connect
|
||||||
HAS_PYTHON26 = True
|
from ansible.module_utils._text import to_native
|
||||||
except ImportError:
|
|
||||||
HAS_PYTHON26 = False
|
|
||||||
|
|
||||||
|
|
||||||
def get_info(inst):
|
def get_info(inst):
|
||||||
|
@ -294,7 +288,6 @@ def create_instance_template(module, gce):
|
||||||
subnetwork_region = module.params.get('subnetwork_region')
|
subnetwork_region = module.params.get('subnetwork_region')
|
||||||
can_ip_forward = module.params.get('can_ip_forward')
|
can_ip_forward = module.params.get('can_ip_forward')
|
||||||
external_ip = module.params.get('external_ip')
|
external_ip = module.params.get('external_ip')
|
||||||
service_account_email = module.params.get('service_account_email')
|
|
||||||
service_account_permissions = module.params.get(
|
service_account_permissions = module.params.get(
|
||||||
'service_account_permissions')
|
'service_account_permissions')
|
||||||
on_host_maintenance = module.params.get('on_host_maintenance')
|
on_host_maintenance = module.params.get('on_host_maintenance')
|
||||||
|
@ -303,7 +296,6 @@ def create_instance_template(module, gce):
|
||||||
tags = module.params.get('tags')
|
tags = module.params.get('tags')
|
||||||
metadata = module.params.get('metadata')
|
metadata = module.params.get('metadata')
|
||||||
description = module.params.get('description')
|
description = module.params.get('description')
|
||||||
disks = module.params.get('disks')
|
|
||||||
disks_gce_struct = module.params.get('disks_gce_struct')
|
disks_gce_struct = module.params.get('disks_gce_struct')
|
||||||
changed = False
|
changed = False
|
||||||
|
|
||||||
|
@ -467,8 +459,9 @@ def delete_instance_template(module, gce):
|
||||||
try:
|
try:
|
||||||
instance = gce.ex_get_instancetemplate(name)
|
instance = gce.ex_get_instancetemplate(name)
|
||||||
current_state = "present"
|
current_state = "present"
|
||||||
except GoogleBaseError as err:
|
except GoogleBaseError as e:
|
||||||
json_data = dict(msg='instance template not exists')
|
json_data = dict(msg='instance template not exists: %s' % to_native(e),
|
||||||
|
exception=traceback.format_exc())
|
||||||
|
|
||||||
if current_state == "present":
|
if current_state == "present":
|
||||||
rc = instance.destroy()
|
rc = instance.destroy()
|
||||||
|
@ -519,26 +512,26 @@ def check_if_system_state_would_be_changed(module, gce):
|
||||||
state = module.params.get("state")
|
state = module.params.get("state")
|
||||||
name = module.params.get("name")
|
name = module.params.get("name")
|
||||||
|
|
||||||
instance = None
|
|
||||||
try:
|
try:
|
||||||
instance = gce.ex_get_instancetemplate(name)
|
gce.ex_get_instancetemplate(name)
|
||||||
current_state = "present"
|
current_state = "present"
|
||||||
except GoogleBaseError as err:
|
except GoogleBaseError as e:
|
||||||
module.fail_json(msg='GCE get instancetemplate problem')
|
module.fail_json(msg='GCE get instancetemplate problem: %s' % to_native(e),
|
||||||
|
exception=traceback.format_exc())
|
||||||
|
|
||||||
if current_state != state:
|
if current_state != state:
|
||||||
changed = True
|
changed = True
|
||||||
|
|
||||||
if current_state == "absent":
|
if current_state == "absent":
|
||||||
if changed:
|
if changed:
|
||||||
output = 'instance template {} will be created'.format(name)
|
output = 'instance template {0} will be created'.format(name)
|
||||||
else:
|
else:
|
||||||
output = 'nothing to do for instance template {} '.format(name)
|
output = 'nothing to do for instance template {0} '.format(name)
|
||||||
if current_state == "present":
|
if current_state == "present":
|
||||||
if changed:
|
if changed:
|
||||||
output = 'instance template {} will be destroyed'.format(name)
|
output = 'instance template {0} will be destroyed'.format(name)
|
||||||
else:
|
else:
|
||||||
output = 'nothing to do for instance template {} '.format(name)
|
output = 'nothing to do for instance template {0} '.format(name)
|
||||||
|
|
||||||
return (changed, output)
|
return (changed, output)
|
||||||
|
|
||||||
|
@ -587,8 +580,8 @@ def main():
|
||||||
|
|
||||||
try:
|
try:
|
||||||
gce = gce_connect(module)
|
gce = gce_connect(module)
|
||||||
except GoogleBaseError as err:
|
except GoogleBaseError as e:
|
||||||
module.fail_json(msg='GCE Connexion failed')
|
module.fail_json(msg='GCE Connexion failed %s' % to_native(e), exception=traceback.format_exc())
|
||||||
|
|
||||||
if module.check_mode:
|
if module.check_mode:
|
||||||
(changed, output) = check_if_system_state_would_be_changed(module, gce)
|
(changed, output) = check_if_system_state_would_be_changed(module, gce)
|
||||||
|
|
|
@ -1,20 +1,10 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# Copyright 2017 Google Inc.
|
# Copyright 2017 Google Inc.
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -146,10 +136,10 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYTHON26 = False
|
HAS_PYTHON26 = False
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.gcp import check_params, get_google_api_client, GCPUtils
|
from ansible.module_utils.gcp import check_params, get_google_api_client, GCPUtils
|
||||||
|
|
||||||
|
|
||||||
UA_PRODUCT = 'ansible-gce_labels'
|
UA_PRODUCT = 'ansible-gce_labels'
|
||||||
UA_VERSION = '0.0.1'
|
UA_VERSION = '0.0.1'
|
||||||
GCE_API_VERSION = 'v1'
|
GCE_API_VERSION = 'v1'
|
||||||
|
@ -329,5 +319,6 @@ def main():
|
||||||
|
|
||||||
module.exit_json(**json_output)
|
module.exit_json(**json_output)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,20 +1,10 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# Copyright 2013 Google Inc.
|
# Copyright 2013 Google Inc.
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -174,6 +164,9 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_LIBCLOUD = False
|
HAS_LIBCLOUD = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.gce import USER_AGENT_PRODUCT, USER_AGENT_VERSION, gce_connect, unexpected_error_msg
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
|
@ -342,9 +335,6 @@ def main():
|
||||||
json_output['changed'] = changed
|
json_output['changed'] = changed
|
||||||
module.exit_json(**json_output)
|
module.exit_json(**json_output)
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.gce import *
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,20 +1,10 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# Copyright 2016 Google Inc.
|
# Copyright 2016 Google Inc.
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -272,7 +262,11 @@ updated_named_ports:
|
||||||
sample: true
|
sample: true
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import socket
|
try:
|
||||||
|
from ast import literal_eval
|
||||||
|
HAS_PYTHON26 = True
|
||||||
|
except ImportError:
|
||||||
|
HAS_PYTHON26 = False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import libcloud
|
import libcloud
|
||||||
|
@ -286,11 +280,8 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_LIBCLOUD = False
|
HAS_LIBCLOUD = False
|
||||||
|
|
||||||
try:
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ast import literal_eval
|
from ansible.module_utils.gce import gce_connect
|
||||||
HAS_PYTHON26 = True
|
|
||||||
except ImportError:
|
|
||||||
HAS_PYTHON26 = False
|
|
||||||
|
|
||||||
|
|
||||||
def _check_params(params, field_list):
|
def _check_params(params, field_list):
|
||||||
|
@ -902,8 +893,6 @@ def main():
|
||||||
json_output.update(params)
|
json_output.update(params)
|
||||||
module.exit_json(**json_output)
|
module.exit_json(**json_output)
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.gce import *
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,20 +1,10 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# Copyright 2013 Google Inc.
|
# Copyright 2013 Google Inc.
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -281,6 +271,10 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_LIBCLOUD = False
|
HAS_LIBCLOUD = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.gce import gce_connect, unexpected_error_msg
|
||||||
|
|
||||||
|
|
||||||
def format_allowed_section(allowed):
|
def format_allowed_section(allowed):
|
||||||
"""Format each section of the allowed list"""
|
"""Format each section of the allowed list"""
|
||||||
if allowed.count(":") == 0:
|
if allowed.count(":") == 0:
|
||||||
|
@ -552,9 +546,6 @@ def main():
|
||||||
json_output['changed'] = changed
|
json_output['changed'] = changed
|
||||||
module.exit_json(**json_output)
|
module.exit_json(**json_output)
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.gce import *
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,20 +1,10 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# Copyright 2013 Google Inc.
|
# Copyright 2013 Google Inc.
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -161,6 +151,9 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_LIBCLOUD = False
|
HAS_LIBCLOUD = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.gce import gce_connect, unexpected_error_msg
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
|
@ -318,9 +311,6 @@ def main():
|
||||||
json_output['changed'] = changed
|
json_output['changed'] = changed
|
||||||
module.exit_json(**json_output)
|
module.exit_json(**json_output)
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.gce import *
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,20 +1,12 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# This file is part of Ansible
|
# Copyright: Ansible Project
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
from __future__ import absolute_import, division, print_function
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
__metaclass__ = type
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -131,9 +123,6 @@ snapshots_absent:
|
||||||
sample: "[disk0-example-snapshot, disk1-example-snapshot]"
|
sample: "[disk0-example-snapshot, disk1-example-snapshot]"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible.module_utils.gce import gce_connect
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from libcloud.compute.types import Provider
|
from libcloud.compute.types import Provider
|
||||||
_ = Provider.GCE
|
_ = Provider.GCE
|
||||||
|
@ -141,6 +130,9 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_LIBCLOUD = False
|
HAS_LIBCLOUD = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.gce import gce_connect
|
||||||
|
|
||||||
|
|
||||||
def find_snapshot(volume, name):
|
def find_snapshot(volume, name):
|
||||||
'''
|
'''
|
||||||
|
|
|
@ -1,18 +1,11 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
#
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
# Copyright: Ansible Project
|
||||||
# it under the terms of the GNU General Public License as published by
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
from __future__ import absolute_import, division, print_function
|
||||||
#
|
__metaclass__ = type
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -130,6 +123,7 @@ except ImportError:
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.gce import gce_connect
|
from ansible.module_utils.gce import gce_connect
|
||||||
|
|
||||||
|
|
||||||
def _union_items(baselist, comparelist):
|
def _union_items(baselist, comparelist):
|
||||||
"""Combine two lists, removing duplicates."""
|
"""Combine two lists, removing duplicates."""
|
||||||
return list(set(baselist) | set(comparelist))
|
return list(set(baselist) | set(comparelist))
|
||||||
|
@ -145,7 +139,6 @@ def _get_changed_items(baselist, comparelist):
|
||||||
def modify_tags(gce, module, node, tags, state='present'):
|
def modify_tags(gce, module, node, tags, state='present'):
|
||||||
"""Modify tags on an instance."""
|
"""Modify tags on an instance."""
|
||||||
|
|
||||||
zone = node.extra['zone'].name
|
|
||||||
existing_tags = node.extra['tags']
|
existing_tags = node.extra['tags']
|
||||||
tags = [x.lower() for x in tags]
|
tags = [x.lower() for x in tags]
|
||||||
tags_changed = []
|
tags_changed = []
|
||||||
|
@ -236,5 +229,6 @@ def main():
|
||||||
else:
|
else:
|
||||||
module.exit_json(changed=changed, instance_name=instance_name, tags=tags_changed, zone=zone)
|
module.exit_json(changed=changed, instance_name=instance_name, tags=tags_changed, zone=zone)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,20 +1,10 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# Copyright 2017 Google Inc.
|
# Copyright 2017 Google Inc.
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -180,6 +170,11 @@ timeout:
|
||||||
sample: "myhttpport"
|
sample: "myhttpport"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
try:
|
||||||
|
from ast import literal_eval
|
||||||
|
HAS_PYTHON26 = True
|
||||||
|
except ImportError:
|
||||||
|
HAS_PYTHON26 = False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import libcloud
|
import libcloud
|
||||||
|
@ -193,13 +188,6 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_LIBCLOUD = False
|
HAS_LIBCLOUD = False
|
||||||
|
|
||||||
try:
|
|
||||||
from ast import literal_eval
|
|
||||||
HAS_PYTHON26 = True
|
|
||||||
except ImportError:
|
|
||||||
HAS_PYTHON26 = False
|
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.gce import gce_connect
|
from ansible.module_utils.gce import gce_connect
|
||||||
from ansible.module_utils.gcp import check_params
|
from ansible.module_utils.gcp import check_params
|
||||||
|
@ -416,5 +404,6 @@ def main():
|
||||||
json_output.update(params)
|
json_output.update(params)
|
||||||
module.exit_json(**json_output)
|
module.exit_json(**json_output)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,20 +1,10 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# Copyright 2017 Google Inc.
|
# Copyright 2017 Google Inc.
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -130,11 +120,10 @@ state:
|
||||||
sample: present
|
sample: present
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.gcp import get_google_api_client, GCPUtils
|
from ansible.module_utils.gcp import get_google_api_client, GCPUtils
|
||||||
|
|
||||||
|
|
||||||
USER_AGENT_PRODUCT = 'ansible-forwarding_rule'
|
USER_AGENT_PRODUCT = 'ansible-forwarding_rule'
|
||||||
USER_AGENT_VERSION = '0.0.1'
|
USER_AGENT_VERSION = '0.0.1'
|
||||||
|
|
||||||
|
@ -270,7 +259,7 @@ def update_global_forwarding_rule(client, forwarding_rule, params, name, project
|
||||||
"""
|
"""
|
||||||
gcp_dict = _build_global_forwarding_rule_dict(params, project_id)
|
gcp_dict = _build_global_forwarding_rule_dict(params, project_id)
|
||||||
|
|
||||||
ans = GCPUtils.are_params_equal(forwarding_rule, gcp_dict)
|
GCPUtils.are_params_equal(forwarding_rule, gcp_dict)
|
||||||
if forwarding_rule['target'] == gcp_dict['target']:
|
if forwarding_rule['target'] == gcp_dict['target']:
|
||||||
return (False, 'no update necessary')
|
return (False, 'no update necessary')
|
||||||
|
|
||||||
|
|
|
@ -1,20 +1,10 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# Copyright 2017 Google Inc.
|
# Copyright 2017 Google Inc.
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -197,10 +187,9 @@ healthcheck:
|
||||||
sample: { "name": "my-hc", "port": 443, "requestPath": "/foo" }
|
sample: { "name": "my-hc", "port": 443, "requestPath": "/foo" }
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.gcp import check_params, get_google_api_client, GCPUtils
|
from ansible.module_utils.gcp import get_google_api_client, GCPUtils
|
||||||
|
|
||||||
|
|
||||||
USER_AGENT_PRODUCT = 'ansible-healthcheck'
|
USER_AGENT_PRODUCT = 'ansible-healthcheck'
|
||||||
USER_AGENT_VERSION = '0.0.1'
|
USER_AGENT_VERSION = '0.0.1'
|
||||||
|
|
|
@ -1,20 +1,10 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# Copyright 2017 Google Inc.
|
# Copyright 2017 Google Inc.
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -96,11 +86,10 @@ target_proxy:
|
||||||
sample: { "name": "my-target-proxy", "urlMap": "..." }
|
sample: { "name": "my-target-proxy", "urlMap": "..." }
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.gcp import get_google_api_client, GCPUtils
|
from ansible.module_utils.gcp import get_google_api_client, GCPUtils
|
||||||
|
|
||||||
|
|
||||||
USER_AGENT_PRODUCT = 'ansible-target_proxy'
|
USER_AGENT_PRODUCT = 'ansible-target_proxy'
|
||||||
USER_AGENT_VERSION = '0.0.1'
|
USER_AGENT_VERSION = '0.0.1'
|
||||||
|
|
||||||
|
@ -227,7 +216,7 @@ def update_target_http_proxy(client, target_proxy, params, name, project_id):
|
||||||
"""
|
"""
|
||||||
gcp_dict = _build_target_proxy_dict(params, project_id)
|
gcp_dict = _build_target_proxy_dict(params, project_id)
|
||||||
|
|
||||||
ans = GCPUtils.are_params_equal(target_proxy, gcp_dict)
|
GCPUtils.are_params_equal(target_proxy, gcp_dict)
|
||||||
if target_proxy['urlMap'] == gcp_dict['urlMap']:
|
if target_proxy['urlMap'] == gcp_dict['urlMap']:
|
||||||
return (False, 'no update necessary')
|
return (False, 'no update necessary')
|
||||||
|
|
||||||
|
|
|
@ -1,20 +1,10 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# Copyright 2017 Google Inc.
|
# Copyright 2017 Google Inc.
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -146,8 +136,11 @@ url_map:
|
||||||
sample: { "name": "my-url-map", "hostRules": [...], "pathMatchers": [...] }
|
sample: { "name": "my-url-map", "hostRules": [...], "pathMatchers": [...] }
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
try:
|
||||||
from ast import literal_eval
|
from ast import literal_eval
|
||||||
|
HAS_PYTHON26 = True
|
||||||
|
except ImportError:
|
||||||
|
HAS_PYTHON26 = False
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.gcp import check_params, get_google_api_client, GCPUtils
|
from ansible.module_utils.gcp import check_params, get_google_api_client, GCPUtils
|
||||||
|
|
|
@ -1,20 +1,10 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# Copyright 2016 Google Inc.
|
# Copyright 2016 Google Inc.
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -186,9 +176,6 @@ topic:
|
||||||
type: str
|
type: str
|
||||||
sample: "mytopic"
|
sample: "mytopic"
|
||||||
'''
|
'''
|
||||||
CLOUD_CLIENT = 'google-cloud-pubsub'
|
|
||||||
CLOUD_CLIENT_MINIMUM_VERSION = '0.22.0'
|
|
||||||
CLOUD_CLIENT_USER_AGENT = 'ansible-pubsub-0.1'
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from ast import literal_eval
|
from ast import literal_eval
|
||||||
|
@ -202,6 +189,14 @@ try:
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
HAS_GOOGLE_CLOUD_PUBSUB = False
|
HAS_GOOGLE_CLOUD_PUBSUB = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.gcp import check_min_pkg_version, get_google_cloud_credentials
|
||||||
|
|
||||||
|
|
||||||
|
CLOUD_CLIENT = 'google-cloud-pubsub'
|
||||||
|
CLOUD_CLIENT_MINIMUM_VERSION = '0.22.0'
|
||||||
|
CLOUD_CLIENT_USER_AGENT = 'ansible-pubsub-0.1'
|
||||||
|
|
||||||
|
|
||||||
def publish_messages(message_list, topic):
|
def publish_messages(message_list, topic):
|
||||||
with topic.batch() as batch:
|
with topic.batch() as batch:
|
||||||
|
@ -336,8 +331,6 @@ def main():
|
||||||
json_output.update(mod_params)
|
json_output.update(mod_params)
|
||||||
module.exit_json(**json_output)
|
module.exit_json(**json_output)
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.gcp import *
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,20 +1,10 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# Copyright 2016 Google Inc.
|
# Copyright 2016 Google Inc.
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -100,6 +90,11 @@ try:
|
||||||
HAS_GOOGLE_CLOUD_PUBSUB = True
|
HAS_GOOGLE_CLOUD_PUBSUB = True
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
HAS_GOOGLE_CLOUD_PUBSUB = False
|
HAS_GOOGLE_CLOUD_PUBSUB = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.gcp import check_min_pkg_version, get_google_cloud_credentials
|
||||||
|
|
||||||
|
|
||||||
def list_func(data, member='name'):
|
def list_func(data, member='name'):
|
||||||
"""Used for state=list."""
|
"""Used for state=list."""
|
||||||
return [getattr(x, member) for x in data]
|
return [getattr(x, member) for x in data]
|
||||||
|
@ -148,8 +143,6 @@ def main():
|
||||||
json_output.update(mod_params)
|
json_output.update(mod_params)
|
||||||
module.exit_json(**json_output)
|
module.exit_json(**json_output)
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.gcp import *
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,20 +1,10 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# Copyright 2017 Google Inc.
|
# Copyright 2017 Google Inc.
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -141,6 +131,7 @@ from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.gcp import check_min_pkg_version, get_google_cloud_credentials
|
from ansible.module_utils.gcp import check_min_pkg_version, get_google_cloud_credentials
|
||||||
from ansible.module_utils.six import string_types
|
from ansible.module_utils.six import string_types
|
||||||
|
|
||||||
|
|
||||||
CLOUD_CLIENT = 'google-cloud-spanner'
|
CLOUD_CLIENT = 'google-cloud-spanner'
|
||||||
CLOUD_CLIENT_MINIMUM_VERSION = '0.23.0'
|
CLOUD_CLIENT_MINIMUM_VERSION = '0.23.0'
|
||||||
CLOUD_CLIENT_USER_AGENT = 'ansible-spanner-0.1'
|
CLOUD_CLIENT_USER_AGENT = 'ansible-spanner-0.1'
|
||||||
|
@ -178,7 +169,7 @@ def instance_update(instance):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
instance.update()
|
instance.update()
|
||||||
except ValueError as e:
|
except ValueError:
|
||||||
# The ValueError here is the one we 'expect'.
|
# The ValueError here is the one we 'expect'.
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -285,5 +276,6 @@ def main():
|
||||||
json_output.update(mod_params)
|
json_output.update(mod_params)
|
||||||
module.exit_json(**json_output)
|
module.exit_json(**json_output)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,21 +1,11 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# This file is part of Ansible
|
# Copyright: Ansible Project
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
from __future__ import absolute_import, division, print_function
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
__metaclass__ = type
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# This is a DOCUMENTATION stub specific to this module, it extends
|
|
||||||
# a documentation fragment located in ansible.utils.module_docs_fragments
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
@ -240,8 +230,8 @@ EXAMPLES = '''
|
||||||
register: rax
|
register: rax
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import os
|
|
||||||
import json
|
import json
|
||||||
|
import os
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,11 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# This file is part of Ansible
|
# Copyright: Ansible Project
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
from __future__ import absolute_import, division, print_function
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
__metaclass__ = type
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# This is a DOCUMENTATION stub specific to this module, it extends
|
|
||||||
# a documentation fragment located in ansible.utils.module_docs_fragments
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
@ -120,6 +110,10 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYRAX = False
|
HAS_PYRAX = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.rax import (VOLUME_STATUS, rax_argument_spec, rax_find_image, rax_find_volume,
|
||||||
|
rax_required_together, rax_to_dict, setup_rax_module)
|
||||||
|
|
||||||
|
|
||||||
def cloud_block_storage(module, state, name, description, meta, size,
|
def cloud_block_storage(module, state, name, description, meta, size,
|
||||||
snapshot_id, volume_type, wait, wait_timeout,
|
snapshot_id, volume_type, wait, wait_timeout,
|
||||||
|
@ -160,7 +154,7 @@ def cloud_block_storage(module, state, name, description, meta, size,
|
||||||
module.fail_json(msg='%s' % e.message)
|
module.fail_json(msg='%s' % e.message)
|
||||||
else:
|
else:
|
||||||
if wait:
|
if wait:
|
||||||
attempts = wait_timeout / 5
|
attempts = wait_timeout // 5
|
||||||
pyrax.utils.wait_for_build(volume, interval=5,
|
pyrax.utils.wait_for_build(volume, interval=5,
|
||||||
attempts=attempts)
|
attempts=attempts)
|
||||||
|
|
||||||
|
@ -233,11 +227,6 @@ def main():
|
||||||
snapshot_id, volume_type, wait, wait_timeout,
|
snapshot_id, volume_type, wait, wait_timeout,
|
||||||
image)
|
image)
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.rax import *
|
|
||||||
|
|
||||||
# invoke the module
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,21 +1,11 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# This file is part of Ansible
|
# Copyright: Ansible Project
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
from __future__ import absolute_import, division, print_function
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
__metaclass__ = type
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# This is a DOCUMENTATION stub specific to this module, it extends
|
|
||||||
# a documentation fragment located in ansible.utils.module_docs_fragments
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
@ -95,6 +85,16 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYRAX = False
|
HAS_PYRAX = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.rax import (NON_CALLABLES,
|
||||||
|
rax_argument_spec,
|
||||||
|
rax_find_server,
|
||||||
|
rax_find_volume,
|
||||||
|
rax_required_together,
|
||||||
|
rax_to_dict,
|
||||||
|
setup_rax_module,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def cloud_block_storage_attachments(module, state, volume, server, device,
|
def cloud_block_storage_attachments(module, state, volume, server, device,
|
||||||
wait, wait_timeout):
|
wait, wait_timeout):
|
||||||
|
@ -141,7 +141,7 @@ def cloud_block_storage_attachments(module, state, volume, server, device,
|
||||||
if volume.status == 'error':
|
if volume.status == 'error':
|
||||||
result['msg'] = '%s failed to build' % volume.id
|
result['msg'] = '%s failed to build' % volume.id
|
||||||
elif wait:
|
elif wait:
|
||||||
attempts = wait_timeout / 5
|
attempts = wait_timeout // 5
|
||||||
pyrax.utils.wait_until(volume, 'status', 'in-use',
|
pyrax.utils.wait_until(volume, 'status', 'in-use',
|
||||||
interval=5, attempts=attempts)
|
interval=5, attempts=attempts)
|
||||||
|
|
||||||
|
@ -219,11 +219,6 @@ def main():
|
||||||
cloud_block_storage_attachments(module, state, volume, server, device,
|
cloud_block_storage_attachments(module, state, volume, server, device,
|
||||||
wait, wait_timeout)
|
wait, wait_timeout)
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.rax import *
|
|
||||||
|
|
||||||
### invoke the module
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,21 +1,11 @@
|
||||||
#!/usr/bin/python -tt
|
#!/usr/bin/python -tt
|
||||||
# This file is part of Ansible
|
# Copyright: Ansible Project
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
from __future__ import absolute_import, division, print_function
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
__metaclass__ = type
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# This is a DOCUMENTATION stub specific to this module, it extends
|
|
||||||
# a documentation fragment located in ansible.utils.module_docs_fragments
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
@ -98,6 +88,9 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYRAX = False
|
HAS_PYRAX = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.rax import rax_argument_spec, rax_required_together, rax_to_dict, setup_rax_module
|
||||||
|
|
||||||
|
|
||||||
def find_instance(name):
|
def find_instance(name):
|
||||||
|
|
||||||
|
@ -258,11 +251,5 @@ def main():
|
||||||
rax_cdb(module, state, name, flavor, volume, cdb_type, cdb_version, wait, wait_timeout)
|
rax_cdb(module, state, name, flavor, volume, cdb_type, cdb_version, wait, wait_timeout)
|
||||||
|
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.rax import *
|
|
||||||
|
|
||||||
# invoke the module
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,21 +1,11 @@
|
||||||
#!/usr/bin/python -tt
|
#!/usr/bin/python -tt
|
||||||
# This file is part of Ansible
|
# Copyright: Ansible Project
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
from __future__ import absolute_import, division, print_function
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
__metaclass__ = type
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# This is a DOCUMENTATION stub specific to this module, it extends
|
|
||||||
# a documentation fragment located in ansible.utils.module_docs_fragments
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
@ -73,6 +63,9 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYRAX = False
|
HAS_PYRAX = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.rax import rax_argument_spec, rax_required_together, rax_to_dict, setup_rax_module
|
||||||
|
|
||||||
|
|
||||||
def find_database(instance, name):
|
def find_database(instance, name):
|
||||||
try:
|
try:
|
||||||
|
@ -172,11 +165,5 @@ def main():
|
||||||
rax_cdb_database(module, state, cdb_id, name, character_set, collate)
|
rax_cdb_database(module, state, cdb_id, name, character_set, collate)
|
||||||
|
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.rax import *
|
|
||||||
|
|
||||||
# invoke the module
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,21 +1,11 @@
|
||||||
#!/usr/bin/python -tt
|
#!/usr/bin/python -tt
|
||||||
# This file is part of Ansible
|
# Copyright: Ansible Project
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
from __future__ import absolute_import, division, print_function
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
__metaclass__ = type
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# This is a DOCUMENTATION stub specific to this module, it extends
|
|
||||||
# a documentation fragment located in ansible.utils.module_docs_fragments
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
@ -82,6 +72,10 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYRAX = False
|
HAS_PYRAX = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils._text import to_text
|
||||||
|
from ansible.module_utils.rax import rax_argument_spec, rax_required_together, rax_to_dict, setup_rax_module
|
||||||
|
|
||||||
|
|
||||||
def find_user(instance, name):
|
def find_user(instance, name):
|
||||||
try:
|
try:
|
||||||
|
@ -210,18 +204,12 @@ def main():
|
||||||
name = module.params.get('db_username')
|
name = module.params.get('db_username')
|
||||||
password = module.params.get('db_password')
|
password = module.params.get('db_password')
|
||||||
databases = module.params.get('databases')
|
databases = module.params.get('databases')
|
||||||
host = unicode(module.params.get('host'))
|
host = to_text(module.params.get('host'), errors='surrogate_or_strict')
|
||||||
state = module.params.get('state')
|
state = module.params.get('state')
|
||||||
|
|
||||||
setup_rax_module(module, pyrax)
|
setup_rax_module(module, pyrax)
|
||||||
rax_cdb_user(module, state, cdb_id, name, password, databases, host)
|
rax_cdb_user(module, state, cdb_id, name, password, databases, host)
|
||||||
|
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.rax import *
|
|
||||||
|
|
||||||
# invoke the module
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,21 +1,11 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# This file is part of Ansible
|
# Copyright: Ansible Project
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
from __future__ import absolute_import, division, print_function
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
__metaclass__ = type
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# This is a DOCUMENTATION stub specific to this module, it extends
|
|
||||||
# a documentation fragment located in ansible.utils.module_docs_fragments
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
@ -144,6 +134,15 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYRAX = False
|
HAS_PYRAX = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.rax import (CLB_ALGORITHMS,
|
||||||
|
CLB_PROTOCOLS,
|
||||||
|
rax_argument_spec,
|
||||||
|
rax_required_together,
|
||||||
|
rax_to_dict,
|
||||||
|
setup_rax_module,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def cloud_load_balancer(module, state, name, meta, algorithm, port, protocol,
|
def cloud_load_balancer(module, state, name, meta, algorithm, port, protocol,
|
||||||
vip_type, timeout, wait, wait_timeout, vip_id):
|
vip_type, timeout, wait, wait_timeout, vip_id):
|
||||||
|
@ -221,7 +220,7 @@ def cloud_load_balancer(module, state, name, meta, algorithm, port, protocol,
|
||||||
'be changed')
|
'be changed')
|
||||||
|
|
||||||
if wait:
|
if wait:
|
||||||
attempts = wait_timeout / 5
|
attempts = wait_timeout // 5
|
||||||
pyrax.utils.wait_for_build(balancer, interval=5, attempts=attempts)
|
pyrax.utils.wait_for_build(balancer, interval=5, attempts=attempts)
|
||||||
|
|
||||||
balancer.get()
|
balancer.get()
|
||||||
|
@ -251,7 +250,7 @@ def cloud_load_balancer(module, state, name, meta, algorithm, port, protocol,
|
||||||
instance = rax_to_dict(balancer, 'clb')
|
instance = rax_to_dict(balancer, 'clb')
|
||||||
|
|
||||||
if wait:
|
if wait:
|
||||||
attempts = wait_timeout / 5
|
attempts = wait_timeout // 5
|
||||||
pyrax.utils.wait_until(balancer, 'status', ('DELETED'),
|
pyrax.utils.wait_until(balancer, 'status', ('DELETED'),
|
||||||
interval=5, attempts=attempts)
|
interval=5, attempts=attempts)
|
||||||
else:
|
else:
|
||||||
|
@ -305,11 +304,5 @@ def main():
|
||||||
vip_type, timeout, wait, wait_timeout, vip_id)
|
vip_type, timeout, wait, wait_timeout, vip_id)
|
||||||
|
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.rax import *
|
|
||||||
|
|
||||||
### invoke the module
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,21 +1,11 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# This file is part of Ansible
|
# Copyright: Ansible Project
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
from __future__ import absolute_import, division, print_function
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
__metaclass__ = type
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# This is a DOCUMENTATION stub specific to this module, it extends
|
|
||||||
# a documentation fragment located in ansible.utils.module_docs_fragments
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
@ -121,12 +111,17 @@ EXAMPLES = '''
|
||||||
credentials: /path/to/credentials
|
credentials: /path/to/credentials
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import pyrax
|
import pyrax
|
||||||
HAS_PYRAX = True
|
HAS_PYRAX = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYRAX = False
|
HAS_PYRAX = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.rax import rax_argument_spec, rax_clb_node_to_dict, rax_required_together, setup_rax_module
|
||||||
|
|
||||||
|
|
||||||
def _activate_virtualenv(path):
|
def _activate_virtualenv(path):
|
||||||
path = os.path.expanduser(path)
|
path = os.path.expanduser(path)
|
||||||
|
@ -276,11 +271,5 @@ def main():
|
||||||
module.exit_json(changed=True, state=state, **kwargs)
|
module.exit_json(changed=True, state=state, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.rax import *
|
|
||||||
|
|
||||||
# invoke the module
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,21 +1,11 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# This file is part of Ansible
|
# Copyright: Ansible Project
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
from __future__ import absolute_import, division, print_function
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
__metaclass__ = type
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# This is a DOCUMENTATION stub specific to this module, it extends
|
|
||||||
# a documentation fragment located in ansible.utils.module_docs_fragments
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
@ -104,6 +94,14 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYRAX = False
|
HAS_PYRAX = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.rax import (rax_argument_spec,
|
||||||
|
rax_find_loadbalancer,
|
||||||
|
rax_required_together,
|
||||||
|
rax_to_dict,
|
||||||
|
setup_rax_module,
|
||||||
|
)
|
||||||
|
|
||||||
def cloud_load_balancer_ssl(module, loadbalancer, state, enabled, private_key,
|
def cloud_load_balancer_ssl(module, loadbalancer, state, enabled, private_key,
|
||||||
certificate, intermediate_certificate, secure_port,
|
certificate, intermediate_certificate, secure_port,
|
||||||
secure_traffic_only, https_redirect,
|
secure_traffic_only, https_redirect,
|
||||||
|
@ -121,7 +119,7 @@ def cloud_load_balancer_ssl(module, loadbalancer, state, enabled, private_key,
|
||||||
else:
|
else:
|
||||||
certificate = certificate.strip()
|
certificate = certificate.strip()
|
||||||
|
|
||||||
attempts = wait_timeout / 5
|
attempts = wait_timeout // 5
|
||||||
|
|
||||||
# Locate the load balancer.
|
# Locate the load balancer.
|
||||||
|
|
||||||
|
@ -268,8 +266,6 @@ def main():
|
||||||
https_redirect, wait, wait_timeout
|
https_redirect, wait, wait_timeout
|
||||||
)
|
)
|
||||||
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.rax import *
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,21 +1,11 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# This file is part of Ansible
|
# Copyright: Ansible Project
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
from __future__ import absolute_import, division, print_function
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
__metaclass__ = type
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# This is a DOCUMENTATION stub specific to this module, it extends
|
|
||||||
# a documentation fragment located in ansible.utils.module_docs_fragments
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
@ -77,6 +67,13 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYRAX = False
|
HAS_PYRAX = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.rax import (rax_argument_spec,
|
||||||
|
rax_required_together,
|
||||||
|
rax_to_dict,
|
||||||
|
setup_rax_module,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def rax_dns(module, comment, email, name, state, ttl):
|
def rax_dns(module, comment, email, name, state, ttl):
|
||||||
changed = False
|
changed = False
|
||||||
|
@ -170,11 +167,5 @@ def main():
|
||||||
rax_dns(module, comment, email, name, state, ttl)
|
rax_dns(module, comment, email, name, state, ttl)
|
||||||
|
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.rax import *
|
|
||||||
|
|
||||||
### invoke the module
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,21 +1,11 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# This file is part of Ansible
|
# Copyright: Ansible Project
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
from __future__ import absolute_import, division, print_function
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
__metaclass__ = type
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# This is a DOCUMENTATION stub specific to this module, it extends
|
|
||||||
# a documentation fragment located in ansible.utils.module_docs_fragments
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
@ -131,6 +121,15 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYRAX = False
|
HAS_PYRAX = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.rax import (rax_argument_spec,
|
||||||
|
rax_find_loadbalancer,
|
||||||
|
rax_find_server,
|
||||||
|
rax_required_together,
|
||||||
|
rax_to_dict,
|
||||||
|
setup_rax_module,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def rax_dns_record_ptr(module, data=None, comment=None, loadbalancer=None,
|
def rax_dns_record_ptr(module, data=None, comment=None, loadbalancer=None,
|
||||||
name=None, server=None, state='present', ttl=7200):
|
name=None, server=None, state='present', ttl=7200):
|
||||||
|
@ -345,11 +344,5 @@ def main():
|
||||||
record_type=record_type, state=state, ttl=ttl)
|
record_type=record_type, state=state, ttl=ttl)
|
||||||
|
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.rax import *
|
|
||||||
|
|
||||||
### invoke the module
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,21 +1,11 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# This file is part of Ansible
|
# Copyright: Ansible Project
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
from __future__ import absolute_import, division, print_function
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
__metaclass__ = type
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# This is a DOCUMENTATION stub specific to this module, it extends
|
|
||||||
# a documentation fragment located in ansible.utils.module_docs_fragments
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
@ -66,6 +56,13 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYRAX = False
|
HAS_PYRAX = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.rax import (rax_argument_spec,
|
||||||
|
rax_required_together,
|
||||||
|
rax_to_dict,
|
||||||
|
setup_rax_module,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def rax_facts(module, address, name, server_id):
|
def rax_facts(module, address, name, server_id):
|
||||||
changed = False
|
changed = False
|
||||||
|
@ -143,11 +140,5 @@ def main():
|
||||||
rax_facts(module, address, name, server_id)
|
rax_facts(module, address, name, server_id)
|
||||||
|
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.rax import *
|
|
||||||
|
|
||||||
### invoke the module
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,24 +1,12 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
# (c) 2013, Paul Durivage <paul.durivage@rackspace.com>
|
# (c) 2013, Paul Durivage <paul.durivage@rackspace.com>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible.
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# This is a DOCUMENTATION stub specific to this module, it extends
|
|
||||||
# a documentation fragment located in ansible.utils.module_docs_fragments
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
@ -163,6 +151,10 @@ try:
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
HAS_PYRAX = False
|
HAS_PYRAX = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.rax import rax_argument_spec, rax_required_together, setup_rax_module
|
||||||
|
|
||||||
|
|
||||||
EXIT_DICT = dict(success=True)
|
EXIT_DICT = dict(success=True)
|
||||||
META_PREFIX = 'x-container-meta-'
|
META_PREFIX = 'x-container-meta-'
|
||||||
|
|
||||||
|
@ -391,9 +383,5 @@ def main():
|
||||||
private, web_index, web_error)
|
private, web_index, web_error)
|
||||||
|
|
||||||
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.rax import *
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,24 +1,12 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
# (c) 2013, Paul Durivage <paul.durivage@rackspace.com>
|
# (c) 2013, Paul Durivage <paul.durivage@rackspace.com>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible.
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# This is a DOCUMENTATION stub specific to this module, it extends
|
|
||||||
# a documentation fragment located in ansible.utils.module_docs_fragments
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
@ -232,12 +220,18 @@ EXAMPLES = '''
|
||||||
type: meta
|
type: meta
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import pyrax
|
import pyrax
|
||||||
HAS_PYRAX = True
|
HAS_PYRAX = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYRAX = False
|
HAS_PYRAX = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.rax import rax_argument_spec, rax_required_together, setup_rax_module
|
||||||
|
|
||||||
|
|
||||||
EXIT_DICT = dict(success=False)
|
EXIT_DICT = dict(success=False)
|
||||||
META_PREFIX = 'x-object-meta-'
|
META_PREFIX = 'x-object-meta-'
|
||||||
|
|
||||||
|
@ -619,9 +613,5 @@ def main():
|
||||||
cloudfiles(module, container, src, dest, method, typ, meta, clear_meta, structure, expires)
|
cloudfiles(module, container, src, dest, method, typ, meta, clear_meta, structure, expires)
|
||||||
|
|
||||||
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.rax import *
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,21 +1,11 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# This file is part of Ansible
|
# Copyright: Ansible Project
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
from __future__ import absolute_import, division, print_function
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
__metaclass__ = type
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# This is a DOCUMENTATION stub specific to this module, it extends
|
|
||||||
# a documentation fragment located in ansible.utils.module_docs_fragments
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
@ -61,6 +51,10 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYRAX = False
|
HAS_PYRAX = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.rax import (rax_argument_spec, rax_required_together, rax_to_dict,
|
||||||
|
setup_rax_module)
|
||||||
|
|
||||||
|
|
||||||
def cloud_identity(module, state, identity):
|
def cloud_identity(module, state, identity):
|
||||||
instance = dict(
|
instance = dict(
|
||||||
|
@ -106,11 +100,6 @@ def main():
|
||||||
|
|
||||||
cloud_identity(module, state, pyrax.identity)
|
cloud_identity(module, state, pyrax.identity)
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.rax import *
|
|
||||||
|
|
||||||
# invoke the module
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,21 +1,11 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# This file is part of Ansible
|
# Copyright: Ansible Project
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
from __future__ import absolute_import, division, print_function
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
__metaclass__ = type
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# This is a DOCUMENTATION stub specific to this module, it extends
|
|
||||||
# a documentation fragment located in ansible.utils.module_docs_fragments
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
@ -88,6 +78,7 @@ EXAMPLES = '''
|
||||||
region: DFW
|
region: DFW
|
||||||
register: keypair
|
register: keypair
|
||||||
'''
|
'''
|
||||||
|
import os
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import pyrax
|
import pyrax
|
||||||
|
@ -95,6 +86,13 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYRAX = False
|
HAS_PYRAX = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.rax import (rax_argument_spec,
|
||||||
|
rax_required_together,
|
||||||
|
rax_to_dict,
|
||||||
|
setup_rax_module,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def rax_keypair(module, name, public_key, state):
|
def rax_keypair(module, name, public_key, state):
|
||||||
changed = False
|
changed = False
|
||||||
|
@ -171,11 +169,5 @@ def main():
|
||||||
rax_keypair(module, name, public_key, state)
|
rax_keypair(module, name, public_key, state)
|
||||||
|
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.rax import *
|
|
||||||
|
|
||||||
### invoke the module
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,21 +1,11 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# This file is part of Ansible
|
# Copyright: Ansible Project
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
from __future__ import absolute_import, division, print_function
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
__metaclass__ = type
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# This is a DOCUMENTATION stub specific to this module, it extends
|
|
||||||
# a documentation fragment located in ansible.utils.module_docs_fragments
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
|
|
@ -1,21 +1,11 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# This file is part of Ansible
|
# Copyright: Ansible Project
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
from __future__ import absolute_import, division, print_function
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
__metaclass__ = type
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# This is a DOCUMENTATION stub specific to this module, it extends
|
|
||||||
# a documentation fragment located in ansible.utils.module_docs_fragments
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
@ -107,6 +97,10 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYRAX = False
|
HAS_PYRAX = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.rax import rax_argument_spec, rax_required_together, setup_rax_module
|
||||||
|
|
||||||
|
|
||||||
def alarm(module, state, label, entity_id, check_id, notification_plan_id, criteria,
|
def alarm(module, state, label, entity_id, check_id, notification_plan_id, criteria,
|
||||||
disabled, metadata):
|
disabled, metadata):
|
||||||
|
|
||||||
|
@ -224,10 +218,5 @@ def main():
|
||||||
criteria, disabled, metadata)
|
criteria, disabled, metadata)
|
||||||
|
|
||||||
|
|
||||||
# Import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.rax import *
|
|
||||||
|
|
||||||
# Invoke the module.
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,21 +1,11 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# This file is part of Ansible
|
# Copyright: Ansible Project
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
from __future__ import absolute_import, division, print_function
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
__metaclass__ = type
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# This is a DOCUMENTATION stub specific to this module, it extends
|
|
||||||
# a documentation fragment located in ansible.utils.module_docs_fragments
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
@ -142,6 +132,10 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYRAX = False
|
HAS_PYRAX = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.rax import rax_argument_spec, rax_required_together, setup_rax_module
|
||||||
|
|
||||||
|
|
||||||
def cloud_check(module, state, entity_id, label, check_type,
|
def cloud_check(module, state, entity_id, label, check_type,
|
||||||
monitoring_zones_poll, target_hostname, target_alias, details,
|
monitoring_zones_poll, target_hostname, target_alias, details,
|
||||||
disabled, metadata, period, timeout):
|
disabled, metadata, period, timeout):
|
||||||
|
@ -310,10 +304,5 @@ def main():
|
||||||
disabled, metadata, period, timeout)
|
disabled, metadata, period, timeout)
|
||||||
|
|
||||||
|
|
||||||
# Import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.rax import *
|
|
||||||
|
|
||||||
# Invoke the module.
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,21 +1,11 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# This file is part of Ansible
|
# Copyright: Ansible Project
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
from __future__ import absolute_import, division, print_function
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
__metaclass__ = type
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# This is a DOCUMENTATION stub specific to this module, it extends
|
|
||||||
# a documentation fragment located in ansible.utils.module_docs_fragments
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
@ -86,6 +76,10 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYRAX = False
|
HAS_PYRAX = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.rax import rax_argument_spec, rax_required_together, setup_rax_module
|
||||||
|
|
||||||
|
|
||||||
def cloud_monitoring(module, state, label, agent_id, named_ip_addresses,
|
def cloud_monitoring(module, state, label, agent_id, named_ip_addresses,
|
||||||
metadata):
|
metadata):
|
||||||
|
|
||||||
|
@ -189,10 +183,6 @@ def main():
|
||||||
|
|
||||||
cloud_monitoring(module, state, label, agent_id, named_ip_addresses, metadata)
|
cloud_monitoring(module, state, label, agent_id, named_ip_addresses, metadata)
|
||||||
|
|
||||||
# Import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.rax import *
|
|
||||||
|
|
||||||
# Invoke the module.
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,21 +1,11 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# This file is part of Ansible
|
# Copyright: Ansible Project
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
from __future__ import absolute_import, division, print_function
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
__metaclass__ = type
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# This is a DOCUMENTATION stub specific to this module, it extends
|
|
||||||
# a documentation fragment located in ansible.utils.module_docs_fragments
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
@ -79,6 +69,10 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYRAX = False
|
HAS_PYRAX = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.rax import rax_argument_spec, rax_required_together, setup_rax_module
|
||||||
|
|
||||||
|
|
||||||
def notification(module, state, label, notification_type, details):
|
def notification(module, state, label, notification_type, details):
|
||||||
|
|
||||||
if len(label) < 1 or len(label) > 255:
|
if len(label) < 1 or len(label) > 255:
|
||||||
|
@ -173,10 +167,6 @@ def main():
|
||||||
|
|
||||||
notification(module, state, label, notification_type, details)
|
notification(module, state, label, notification_type, details)
|
||||||
|
|
||||||
# Import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.rax import *
|
|
||||||
|
|
||||||
# Invoke the module.
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,21 +1,11 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# This file is part of Ansible
|
# Copyright: Ansible Project
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
from __future__ import absolute_import, division, print_function
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
__metaclass__ = type
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# This is a DOCUMENTATION stub specific to this module, it extends
|
|
||||||
# a documentation fragment located in ansible.utils.module_docs_fragments
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
@ -83,6 +73,10 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYRAX = False
|
HAS_PYRAX = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.rax import rax_argument_spec, rax_required_together, setup_rax_module
|
||||||
|
|
||||||
|
|
||||||
def notification_plan(module, state, label, critical_state, warning_state, ok_state):
|
def notification_plan(module, state, label, critical_state, warning_state, ok_state):
|
||||||
|
|
||||||
if len(label) < 1 or len(label) > 255:
|
if len(label) < 1 or len(label) > 255:
|
||||||
|
@ -178,10 +172,6 @@ def main():
|
||||||
|
|
||||||
notification_plan(module, state, label, critical_state, warning_state, ok_state)
|
notification_plan(module, state, label, critical_state, warning_state, ok_state)
|
||||||
|
|
||||||
# Import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.rax import *
|
|
||||||
|
|
||||||
# Invoke the module.
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,21 +1,11 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# This file is part of Ansible
|
# Copyright: Ansible Project
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
from __future__ import absolute_import, division, print_function
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
__metaclass__ = type
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# This is a DOCUMENTATION stub specific to this module, it extends
|
|
||||||
# a documentation fragment located in ansible.utils.module_docs_fragments
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
@ -70,6 +60,9 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYRAX = False
|
HAS_PYRAX = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.rax import rax_argument_spec, rax_required_together, setup_rax_module
|
||||||
|
|
||||||
|
|
||||||
def cloud_network(module, state, label, cidr):
|
def cloud_network(module, state, label, cidr):
|
||||||
changed = False
|
changed = False
|
||||||
|
@ -143,11 +136,5 @@ def main():
|
||||||
cloud_network(module, state, label, cidr)
|
cloud_network(module, state, label, cidr)
|
||||||
|
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.rax import *
|
|
||||||
|
|
||||||
### invoke the module
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,21 +1,11 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# This file is part of Ansible
|
# Copyright: Ansible Project
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
from __future__ import absolute_import, division, print_function
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
__metaclass__ = type
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# This is a DOCUMENTATION stub specific to this module, it extends
|
|
||||||
# a documentation fragment located in ansible.utils.module_docs_fragments
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
@ -68,6 +58,9 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYRAX = False
|
HAS_PYRAX = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.rax import rax_argument_spec, rax_required_together, setup_rax_module
|
||||||
|
|
||||||
|
|
||||||
def cloud_queue(module, state, name):
|
def cloud_queue(module, state, name):
|
||||||
for arg in (state, name):
|
for arg in (state, name):
|
||||||
|
@ -144,11 +137,5 @@ def main():
|
||||||
cloud_queue(module, state, name)
|
cloud_queue(module, state, name)
|
||||||
|
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.rax import *
|
|
||||||
|
|
||||||
### invoke the module
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,21 +1,11 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# This file is part of Ansible
|
# Copyright: Ansible Project
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
from __future__ import absolute_import, division, print_function
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
__metaclass__ = type
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# This is a DOCUMENTATION stub specific to this module, it extends
|
|
||||||
# a documentation fragment located in ansible.utils.module_docs_fragments
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
|
|
@ -1,21 +1,11 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# This file is part of Ansible
|
# Copyright: Ansible Project
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
from __future__ import absolute_import, division, print_function
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
__metaclass__ = type
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# This is a DOCUMENTATION stub specific to this module, it extends
|
|
||||||
# a documentation fragment located in ansible.utils.module_docs_fragments
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
@ -129,6 +119,10 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYRAX = False
|
HAS_PYRAX = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.rax import (UUID, rax_argument_spec, rax_required_together, rax_to_dict,
|
||||||
|
setup_rax_module)
|
||||||
|
|
||||||
|
|
||||||
def rax_asp(module, at=None, change=0, cron=None, cooldown=300,
|
def rax_asp(module, at=None, change=0, cron=None, cooldown=300,
|
||||||
desired_capacity=0, is_percent=False, name=None,
|
desired_capacity=0, is_percent=False, name=None,
|
||||||
|
@ -280,11 +274,5 @@ def main():
|
||||||
state=state)
|
state=state)
|
||||||
|
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.rax import *
|
|
||||||
|
|
||||||
# invoke the module
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,21 +1,10 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
# Copyright (c) 2015 VMware, Inc. All Rights Reserved.
|
# Copyright (c) 2015 VMware, Inc. All Rights Reserved.
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
|
@ -76,11 +65,16 @@ except ImportError:
|
||||||
# protects against generating an exception at runtime
|
# protects against generating an exception at runtime
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.vca import VcaError, vca_argument_spec, vca_login
|
||||||
|
|
||||||
|
|
||||||
VALID_PROTO = ['Tcp', 'Udp', 'Icmp', 'Other', 'Any']
|
VALID_PROTO = ['Tcp', 'Udp', 'Icmp', 'Other', 'Any']
|
||||||
VALID_RULE_KEYS = ['policy', 'is_enable', 'enable_logging', 'description',
|
VALID_RULE_KEYS = ['policy', 'is_enable', 'enable_logging', 'description',
|
||||||
'dest_ip', 'dest_port', 'source_ip', 'source_port',
|
'dest_ip', 'dest_port', 'source_ip', 'source_port',
|
||||||
'protocol']
|
'protocol']
|
||||||
|
|
||||||
|
|
||||||
def protocol_to_tuple(protocol):
|
def protocol_to_tuple(protocol):
|
||||||
return (protocol.get_Tcp(),
|
return (protocol.get_Tcp(),
|
||||||
protocol.get_Udp(),
|
protocol.get_Udp(),
|
||||||
|
@ -237,14 +231,12 @@ def main():
|
||||||
if task:
|
if task:
|
||||||
vca.block_until_completed(task)
|
vca.block_until_completed(task)
|
||||||
|
|
||||||
result['rules_updated'] = count=len(updates)
|
result['rules_updated'] = len(updates)
|
||||||
result['rules_added'] = count=len(additions)
|
result['rules_added'] = len(additions)
|
||||||
result['rules_deleted'] = count=len(deletions)
|
result['rules_deleted'] = len(deletions)
|
||||||
|
|
||||||
return module.exit_json(**result)
|
return module.exit_json(**result)
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.vca import *
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,21 +1,10 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
# Copyright (c) 2015 VMware, Inc. All Rights Reserved.
|
# Copyright (c) 2015 VMware, Inc. All Rights Reserved.
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
|
@ -78,8 +67,9 @@ EXAMPLES = '''
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import time
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
import xmltodict
|
from ansible.module_utils.vca import VcaError, vca_argument_spec, vca_login
|
||||||
|
|
||||||
|
|
||||||
VALID_RULE_KEYS = ['rule_type', 'original_ip', 'original_port',
|
VALID_RULE_KEYS = ['rule_type', 'original_ip', 'original_port',
|
||||||
'translated_ip', 'translated_port', 'protocol']
|
'translated_ip', 'translated_port', 'protocol']
|
||||||
|
@ -142,7 +132,6 @@ def main():
|
||||||
module = AnsibleModule(argument_spec, supports_check_mode=True)
|
module = AnsibleModule(argument_spec, supports_check_mode=True)
|
||||||
|
|
||||||
vdc_name = module.params.get('vdc_name')
|
vdc_name = module.params.get('vdc_name')
|
||||||
state = module.params['state']
|
|
||||||
nat_rules = module.params['nat_rules']
|
nat_rules = module.params['nat_rules']
|
||||||
gateway_name = module.params['gateway_name']
|
gateway_name = module.params['gateway_name']
|
||||||
purge_rules = module.params['purge_rules']
|
purge_rules = module.params['purge_rules']
|
||||||
|
@ -212,9 +201,5 @@ def main():
|
||||||
module.exit_json(**result)
|
module.exit_json(**result)
|
||||||
|
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.vca import *
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,21 +1,10 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
# Copyright (c) 2015 Ansible, Inc.
|
# Copyright (c) 2015 Ansible, Inc.
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
|
@ -147,6 +136,9 @@ EXAMPLES = '''
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
from ansible.module_utils.vca import VcaAnsibleModule, VcaError
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_VAPP_OPERATION = 'noop'
|
DEFAULT_VAPP_OPERATION = 'noop'
|
||||||
|
|
||||||
VAPP_STATUS = {
|
VAPP_STATUS = {
|
||||||
|
@ -283,8 +275,6 @@ def main():
|
||||||
|
|
||||||
return module.exit(**result)
|
return module.exit(**result)
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.vca import *
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -2,21 +2,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2015, Joseph Callen <jcallen () csc.com>
|
# (c) 2015, Joseph Callen <jcallen () csc.com>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -83,6 +73,16 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYVMOMI = False
|
HAS_PYVMOMI = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.vmware import (HAS_PYVMOMI,
|
||||||
|
TaskError,
|
||||||
|
connect_to_api,
|
||||||
|
find_cluster_by_name_datacenter,
|
||||||
|
find_datacenter_by_name,
|
||||||
|
vmware_argument_spec,
|
||||||
|
wait_for_task
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class VMwareCluster(object):
|
class VMwareCluster(object):
|
||||||
def __init__(self, module):
|
def __init__(self, module):
|
||||||
|
@ -251,8 +251,6 @@ def main():
|
||||||
vmware_cluster = VMwareCluster(module)
|
vmware_cluster = VMwareCluster(module)
|
||||||
vmware_cluster.process_state()
|
vmware_cluster.process_state()
|
||||||
|
|
||||||
from ansible.module_utils.vmware import *
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -2,21 +2,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2015, Joseph Callen <jcallen () csc.com>
|
# (c) 2015, Joseph Callen <jcallen () csc.com>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -81,6 +71,10 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYVMOMI = False
|
HAS_PYVMOMI = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.vmware import (HAS_PYVMOMI, connect_to_api, find_datacenter_by_name,
|
||||||
|
vmware_argument_spec, wait_for_task)
|
||||||
|
|
||||||
|
|
||||||
def get_datacenter(context, module):
|
def get_datacenter(context, module):
|
||||||
try:
|
try:
|
||||||
|
@ -161,8 +155,6 @@ def main():
|
||||||
if state == 'absent':
|
if state == 'absent':
|
||||||
destroy_datacenter(context, module)
|
destroy_datacenter(context, module)
|
||||||
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.vmware import *
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -2,21 +2,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2015, Joseph Callen <jcallen () csc.com>
|
# (c) 2015, Joseph Callen <jcallen () csc.com>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -72,6 +62,9 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYVMOMI = False
|
HAS_PYVMOMI = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.vmware import HAS_PYVMOMI, connect_to_api, get_all_objs, vmware_argument_spec
|
||||||
|
|
||||||
|
|
||||||
def configure_dns(host_system, hostname, domainname, dns_servers):
|
def configure_dns(host_system, hostname, domainname, dns_servers):
|
||||||
|
|
||||||
|
@ -128,8 +121,5 @@ def main():
|
||||||
module.fail_json(msg=str(e))
|
module.fail_json(msg=str(e))
|
||||||
|
|
||||||
|
|
||||||
from ansible.module_utils.vmware import *
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -2,21 +2,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2015, Joseph Callen <jcallen () csc.com>
|
# (c) 2015, Joseph Callen <jcallen () csc.com>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -34,7 +24,7 @@ author: "Joseph Callen (@jcpowermac)"
|
||||||
notes:
|
notes:
|
||||||
- Tested on vSphere 5.5
|
- Tested on vSphere 5.5
|
||||||
requirements:
|
requirements:
|
||||||
- "python >= 2.6"
|
- "python >= 2.7"
|
||||||
- PyVmomi
|
- PyVmomi
|
||||||
options:
|
options:
|
||||||
esxi_hostname:
|
esxi_hostname:
|
||||||
|
@ -74,12 +64,21 @@ EXAMPLES = '''
|
||||||
'''
|
'''
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import collections
|
from collections import Counter
|
||||||
|
HAS_COLLECTIONS_COUNTER = True
|
||||||
|
except ImportError:
|
||||||
|
HAS_COLLECTIONS_COUNTER = False
|
||||||
|
|
||||||
|
try:
|
||||||
from pyVmomi import vim, vmodl
|
from pyVmomi import vim, vmodl
|
||||||
HAS_PYVMOMI = True
|
HAS_PYVMOMI = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYVMOMI = False
|
HAS_PYVMOMI = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.vmware import (HAS_PYVMOMI, connect_to_api, find_dvs_by_name,
|
||||||
|
find_hostsystem_by_name, vmware_argument_spec, wait_for_task)
|
||||||
|
|
||||||
|
|
||||||
class VMwareDvsHost(object):
|
class VMwareDvsHost(object):
|
||||||
def __init__(self, module):
|
def __init__(self, module):
|
||||||
|
@ -201,7 +200,7 @@ class VMwareDvsHost(object):
|
||||||
for pnicSpec in dvs_host_member.config.backing.pnicSpec:
|
for pnicSpec in dvs_host_member.config.backing.pnicSpec:
|
||||||
pnic_device.append(pnicSpec.pnicDevice)
|
pnic_device.append(pnicSpec.pnicDevice)
|
||||||
|
|
||||||
return collections.Counter(pnic_device) == collections.Counter(self.vmnics)
|
return Counter(pnic_device) == Counter(self.vmnics)
|
||||||
|
|
||||||
def check_dvs_host_state(self):
|
def check_dvs_host_state(self):
|
||||||
self.dv_switch = find_dvs_by_name(self.content, self.switch_name)
|
self.dv_switch = find_dvs_by_name(self.content, self.switch_name)
|
||||||
|
@ -244,11 +243,12 @@ def main():
|
||||||
if not HAS_PYVMOMI:
|
if not HAS_PYVMOMI:
|
||||||
module.fail_json(msg='pyvmomi is required for this module')
|
module.fail_json(msg='pyvmomi is required for this module')
|
||||||
|
|
||||||
|
if not HAS_COLLECTIONS_COUNTER:
|
||||||
|
module.fail_json(msg='collections.Counter from Python-2.7 is required for this module')
|
||||||
|
|
||||||
vmware_dvs_host = VMwareDvsHost(module)
|
vmware_dvs_host = VMwareDvsHost(module)
|
||||||
vmware_dvs_host.process_state()
|
vmware_dvs_host.process_state()
|
||||||
|
|
||||||
from ansible.module_utils.vmware import *
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -2,21 +2,12 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2015, Joseph Callen <jcallen () csc.com>
|
# (c) 2015, Joseph Callen <jcallen () csc.com>
|
||||||
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
#
|
#
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -85,6 +76,10 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYVMOMI = False
|
HAS_PYVMOMI = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.vmware import (HAS_PYVMOMI, connect_to_api, find_dvs_by_name, find_dvspg_by_name,
|
||||||
|
vmware_argument_spec, wait_for_task)
|
||||||
|
|
||||||
|
|
||||||
class VMwareDvsPortgroup(object):
|
class VMwareDvsPortgroup(object):
|
||||||
def __init__(self, module):
|
def __init__(self, module):
|
||||||
|
@ -196,8 +191,6 @@ def main():
|
||||||
vmware_dvs_portgroup = VMwareDvsPortgroup(module)
|
vmware_dvs_portgroup = VMwareDvsPortgroup(module)
|
||||||
vmware_dvs_portgroup.process_state()
|
vmware_dvs_portgroup.process_state()
|
||||||
|
|
||||||
from ansible.module_utils.vmware import *
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -2,21 +2,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2015, Joseph Callen <jcallen () csc.com>
|
# (c) 2015, Joseph Callen <jcallen () csc.com>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -100,6 +90,16 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYVMOMI = False
|
HAS_PYVMOMI = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.vmware import (HAS_PYVMOMI,
|
||||||
|
connect_to_api,
|
||||||
|
find_datacenter_by_name,
|
||||||
|
find_dvs_by_name,
|
||||||
|
vmware_argument_spec,
|
||||||
|
wait_for_task
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class VMwareDVSwitch(object):
|
class VMwareDVSwitch(object):
|
||||||
def __init__(self, module):
|
def __init__(self, module):
|
||||||
self.module = module
|
self.module = module
|
||||||
|
@ -206,8 +206,6 @@ def main():
|
||||||
vmware_dvswitch = VMwareDVSwitch(module)
|
vmware_dvswitch = VMwareDVSwitch(module)
|
||||||
vmware_dvswitch.process_state()
|
vmware_dvswitch.process_state()
|
||||||
|
|
||||||
from ansible.module_utils.vmware import *
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -2,21 +2,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# This module is also sponsored by E.T.A.I. (www.etai.fr)
|
# This module is also sponsored by E.T.A.I. (www.etai.fr)
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -311,18 +301,7 @@ instance:
|
||||||
sample: None
|
sample: None
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
import time
|
import time
|
||||||
from ansible.module_utils._text import to_text
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible.module_utils.vmware import connect_to_api, find_obj, gather_vm_facts, get_all_objs, compile_folder_path_for_object
|
|
||||||
from ansible.module_utils.vmware import serialize_spec, find_vm_by_id, vmware_argument_spec
|
|
||||||
|
|
||||||
|
|
||||||
try:
|
|
||||||
import json
|
|
||||||
except ImportError:
|
|
||||||
import simplejson as json
|
|
||||||
|
|
||||||
HAS_PYVMOMI = False
|
HAS_PYVMOMI = False
|
||||||
try:
|
try:
|
||||||
|
@ -333,6 +312,12 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils._text import to_text
|
||||||
|
from ansible.module_utils.vmware import (connect_to_api, find_obj, gather_vm_facts, get_all_objs,
|
||||||
|
compile_folder_path_for_object, serialize_spec, find_vm_by_id,
|
||||||
|
vmware_argument_spec)
|
||||||
|
|
||||||
|
|
||||||
class PyVmomiDeviceHelper(object):
|
class PyVmomiDeviceHelper(object):
|
||||||
""" This class is a helper to create easily VMWare Objects for PyVmomiHelper """
|
""" This class is a helper to create easily VMWare Objects for PyVmomiHelper """
|
||||||
|
@ -1033,7 +1018,6 @@ class PyVmomiHelper(object):
|
||||||
|
|
||||||
def autoselect_datastore(self):
|
def autoselect_datastore(self):
|
||||||
datastore = None
|
datastore = None
|
||||||
datastore_name = None
|
|
||||||
datastores = self.cache.get_all_objs(self.content, [vim.Datastore])
|
datastores = self.cache.get_all_objs(self.content, [vim.Datastore])
|
||||||
|
|
||||||
if datastores is None or len(datastores) == 0:
|
if datastores is None or len(datastores) == 0:
|
||||||
|
@ -1043,7 +1027,6 @@ class PyVmomiHelper(object):
|
||||||
for ds in datastores:
|
for ds in datastores:
|
||||||
if ds.summary.freeSpace > datastore_freespace:
|
if ds.summary.freeSpace > datastore_freespace:
|
||||||
datastore = ds
|
datastore = ds
|
||||||
datastore_name = datastore.name
|
|
||||||
datastore_freespace = ds.summary.freeSpace
|
datastore_freespace = ds.summary.freeSpace
|
||||||
|
|
||||||
return datastore
|
return datastore
|
||||||
|
@ -1512,5 +1495,6 @@ def main():
|
||||||
else:
|
else:
|
||||||
module.exit_json(**result)
|
module.exit_json(**result)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -2,21 +2,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# This module is also sponsored by E.T.A.I. (www.etai.fr)
|
# This module is also sponsored by E.T.A.I. (www.etai.fr)
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -96,16 +86,6 @@ instance:
|
||||||
sample: None
|
sample: None
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible.module_utils._text import to_text
|
|
||||||
from ansible.module_utils.vmware import connect_to_api, find_vm_by_id, gather_vm_facts, vmware_argument_spec
|
|
||||||
|
|
||||||
try:
|
|
||||||
import json
|
|
||||||
except ImportError:
|
|
||||||
import simplejson as json
|
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import pyVmomi
|
import pyVmomi
|
||||||
from pyVmomi import vim
|
from pyVmomi import vim
|
||||||
|
@ -114,6 +94,10 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYVMOMI = False
|
HAS_PYVMOMI = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils._text import to_text
|
||||||
|
from ansible.module_utils.vmware import connect_to_api, find_vm_by_id, gather_vm_facts, vmware_argument_spec
|
||||||
|
|
||||||
|
|
||||||
class PyVmomiHelper(object):
|
class PyVmomiHelper(object):
|
||||||
def __init__(self, module):
|
def __init__(self, module):
|
||||||
|
@ -175,5 +159,6 @@ def main():
|
||||||
msg += "%(uuid)s" % module.params
|
msg += "%(uuid)s" % module.params
|
||||||
module.fail_json(msg=msg)
|
module.fail_json(msg=msg)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,20 +1,11 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# This file is part of Ansible
|
# Copyright: Ansible Project
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
from __future__ import absolute_import, division, print_function
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
__metaclass__ = type
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
|
@ -76,10 +67,6 @@ RETURN = """
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible.module_utils._text import to_native
|
|
||||||
from ansible.module_utils.vmware import connect_to_api, gather_vm_facts, get_all_objs, compile_folder_path_for_object, vmware_argument_spec
|
|
||||||
|
|
||||||
|
|
||||||
HAS_PYVMOMI = False
|
HAS_PYVMOMI = False
|
||||||
try:
|
try:
|
||||||
|
@ -90,6 +77,11 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils._text import to_native
|
||||||
|
from ansible.module_utils.vmware import (connect_to_api, gather_vm_facts, get_all_objs,
|
||||||
|
compile_folder_path_for_object, vmware_argument_spec)
|
||||||
|
|
||||||
|
|
||||||
class PyVmomiHelper(object):
|
class PyVmomiHelper(object):
|
||||||
def __init__(self, module):
|
def __init__(self, module):
|
||||||
|
@ -258,5 +250,6 @@ def main():
|
||||||
msg += "%(uuid)s" % module.params
|
msg += "%(uuid)s" % module.params
|
||||||
module.fail_json(msg=msg)
|
module.fail_json(msg=msg)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -2,21 +2,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# This module is also sponsored by E.T.A.I. (www.etai.fr)
|
# This module is also sponsored by E.T.A.I. (www.etai.fr)
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -188,14 +178,6 @@ instance:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import time
|
import time
|
||||||
from ansible.module_utils._text import to_native
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible.module_utils.vmware import connect_to_api, vmware_argument_spec, find_vm_by_id
|
|
||||||
|
|
||||||
try:
|
|
||||||
import json
|
|
||||||
except ImportError:
|
|
||||||
import simplejson as json
|
|
||||||
|
|
||||||
HAS_PYVMOMI = False
|
HAS_PYVMOMI = False
|
||||||
try:
|
try:
|
||||||
|
@ -206,6 +188,10 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils._text import to_native
|
||||||
|
from ansible.module_utils.vmware import connect_to_api, vmware_argument_spec, find_vm_by_id
|
||||||
|
|
||||||
|
|
||||||
class PyVmomiHelper(object):
|
class PyVmomiHelper(object):
|
||||||
def __init__(self, module):
|
def __init__(self, module):
|
||||||
|
@ -358,5 +344,6 @@ def main():
|
||||||
else:
|
else:
|
||||||
module.exit_json(**result)
|
module.exit_json(**result)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -2,21 +2,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2015, Joseph Callen <jcallen () csc.com>
|
# (c) 2015, Joseph Callen <jcallen () csc.com>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -240,5 +230,6 @@ def main():
|
||||||
vmware_host = VMwareHost(module)
|
vmware_host = VMwareHost(module)
|
||||||
vmware_host.process_state()
|
vmware_host.process_state()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -3,21 +3,12 @@
|
||||||
|
|
||||||
# Copyright IBM Corp. 2016
|
# Copyright IBM Corp. 2016
|
||||||
# Author(s): Andreas Nafpliotis <nafpliot@de.ibm.com>
|
# Author(s): Andreas Nafpliotis <nafpliot@de.ibm.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',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -78,6 +69,9 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYVMOMI = False
|
HAS_PYVMOMI = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.vmware import HAS_PYVMOMI, connect_to_api, vmware_argument_spec
|
||||||
|
|
||||||
|
|
||||||
class VMwareLocalUserManager(object):
|
class VMwareLocalUserManager(object):
|
||||||
def __init__(self, module):
|
def __init__(self, module):
|
||||||
|
@ -139,7 +133,7 @@ class VMwareLocalUserManager(object):
|
||||||
account_spec = self.create_account_spec()
|
account_spec = self.create_account_spec()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
task = self.content.accountManager.CreateUser(account_spec)
|
self.content.accountManager.CreateUser(account_spec)
|
||||||
self.module.exit_json(changed=True)
|
self.module.exit_json(changed=True)
|
||||||
except vmodl.RuntimeFault as runtime_fault:
|
except vmodl.RuntimeFault as runtime_fault:
|
||||||
self.module.fail_json(msg=runtime_fault.msg)
|
self.module.fail_json(msg=runtime_fault.msg)
|
||||||
|
@ -150,7 +144,7 @@ class VMwareLocalUserManager(object):
|
||||||
account_spec = self.create_account_spec()
|
account_spec = self.create_account_spec()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
task = self.content.accountManager.UpdateUser(account_spec)
|
self.content.accountManager.UpdateUser(account_spec)
|
||||||
self.module.exit_json(changed=True)
|
self.module.exit_json(changed=True)
|
||||||
except vmodl.RuntimeFault as runtime_fault:
|
except vmodl.RuntimeFault as runtime_fault:
|
||||||
self.module.fail_json(msg=runtime_fault.msg)
|
self.module.fail_json(msg=runtime_fault.msg)
|
||||||
|
@ -160,7 +154,7 @@ class VMwareLocalUserManager(object):
|
||||||
|
|
||||||
def state_remove_user(self):
|
def state_remove_user(self):
|
||||||
try:
|
try:
|
||||||
task = self.content.accountManager.RemoveUser(self.local_user_name)
|
self.content.accountManager.RemoveUser(self.local_user_name)
|
||||||
self.module.exit_json(changed=True)
|
self.module.exit_json(changed=True)
|
||||||
except vmodl.RuntimeFault as runtime_fault:
|
except vmodl.RuntimeFault as runtime_fault:
|
||||||
self.module.fail_json(msg=runtime_fault.msg)
|
self.module.fail_json(msg=runtime_fault.msg)
|
||||||
|
@ -189,8 +183,6 @@ def main():
|
||||||
vmware_local_user_manager = VMwareLocalUserManager(module)
|
vmware_local_user_manager = VMwareLocalUserManager(module)
|
||||||
vmware_local_user_manager.process_state()
|
vmware_local_user_manager.process_state()
|
||||||
|
|
||||||
from ansible.module_utils.vmware import *
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -2,21 +2,10 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2015, VMware, Inc.
|
# (c) 2015, VMware, Inc.
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
|
@ -113,6 +102,10 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYVMOMI = False
|
HAS_PYVMOMI = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.vmware import (HAS_PYVMOMI, TaskError, connect_to_api, find_hostsystem_by_name,
|
||||||
|
vmware_argument_spec, wait_for_task)
|
||||||
|
|
||||||
|
|
||||||
def EnterMaintenanceMode(module, host):
|
def EnterMaintenanceMode(module, host):
|
||||||
|
|
||||||
|
@ -209,9 +202,5 @@ def main():
|
||||||
module.exit_json(**result)
|
module.exit_json(**result)
|
||||||
|
|
||||||
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.vmware import *
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -2,21 +2,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2015, Joseph Callen <jcallen () csc.com>
|
# (c) 2015, Joseph Callen <jcallen () csc.com>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -85,8 +75,10 @@ try:
|
||||||
HAS_PYVMOMI = True
|
HAS_PYVMOMI = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYVMOMI = False
|
HAS_PYVMOMI = False
|
||||||
from ansible.module_utils.vmware import vmware_argument_spec, find_dvs_by_name, find_hostsystem_by_name, connect_to_api, find_dvspg_by_name
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.vmware import (vmware_argument_spec, find_dvs_by_name, find_hostsystem_by_name,
|
||||||
|
connect_to_api, find_dvspg_by_name)
|
||||||
|
|
||||||
|
|
||||||
class VMwareMigrateVmk(object):
|
class VMwareMigrateVmk(object):
|
||||||
|
|
|
@ -2,21 +2,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2015, Joseph Callen <jcallen () csc.com>
|
# (c) 2015, Joseph Callen <jcallen () csc.com>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -91,6 +81,14 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYVMOMI = False
|
HAS_PYVMOMI = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.vmware import (HAS_PYVMOMI,
|
||||||
|
connect_to_api,
|
||||||
|
find_host_portgroup_by_name,
|
||||||
|
get_all_objs,
|
||||||
|
vmware_argument_spec,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def create_network_policy(promiscuous_mode, forged_transmits, mac_changes):
|
def create_network_policy(promiscuous_mode, forged_transmits, mac_changes):
|
||||||
|
|
||||||
|
@ -116,7 +114,7 @@ def create_port_group(host_system, portgroup_name, vlan_id, vswitch_name, networ
|
||||||
config.portgroup[0].spec.vswitchName = vswitch_name
|
config.portgroup[0].spec.vswitchName = vswitch_name
|
||||||
config.portgroup[0].spec.policy = network_policy
|
config.portgroup[0].spec.policy = network_policy
|
||||||
|
|
||||||
host_network_config_result = host_system.configManager.networkSystem.UpdateNetworkConfig(config, "modify")
|
host_system.configManager.networkSystem.UpdateNetworkConfig(config, "modify")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@ -161,8 +159,6 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e))
|
module.fail_json(msg=str(e))
|
||||||
|
|
||||||
from ansible.module_utils.vmware import *
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -2,21 +2,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2017, Davis Phillips davis.phillips@gmail.com
|
# (c) 2017, Davis Phillips davis.phillips@gmail.com
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'status': ['preview'],
|
ANSIBLE_METADATA = {'status': ['preview'],
|
||||||
'supported_by': 'community',
|
'supported_by': 'community',
|
||||||
|
@ -147,9 +137,9 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYVMOMI = False
|
HAS_PYVMOMI = False
|
||||||
|
|
||||||
from ansible.module_utils.vmware import get_all_objs, connect_to_api, vmware_argument_spec, find_datacenter_by_name, \
|
|
||||||
find_cluster_by_name_datacenter, wait_for_task
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.vmware import (get_all_objs, connect_to_api, vmware_argument_spec,
|
||||||
|
find_datacenter_by_name, find_cluster_by_name_datacenter, wait_for_task)
|
||||||
|
|
||||||
|
|
||||||
class VMwareResourcePool(object):
|
class VMwareResourcePool(object):
|
||||||
|
@ -265,8 +255,6 @@ class VMwareResourcePool(object):
|
||||||
|
|
||||||
def state_add_rp(self):
|
def state_add_rp(self):
|
||||||
changed = True
|
changed = True
|
||||||
result = None
|
|
||||||
root_resource_pool = None
|
|
||||||
|
|
||||||
rp_spec = vim.ResourceConfigSpec()
|
rp_spec = vim.ResourceConfigSpec()
|
||||||
cpu_alloc = vim.ResourceAllocationInfo()
|
cpu_alloc = vim.ResourceAllocationInfo()
|
||||||
|
@ -290,7 +278,7 @@ class VMwareResourcePool(object):
|
||||||
self.cluster_obj = find_cluster_by_name_datacenter(
|
self.cluster_obj = find_cluster_by_name_datacenter(
|
||||||
self.dc_obj, self.cluster)
|
self.dc_obj, self.cluster)
|
||||||
rootResourcePool = self.cluster_obj.resourcePool
|
rootResourcePool = self.cluster_obj.resourcePool
|
||||||
task = rootResourcePool.CreateResourcePool(self.resource_pool, rp_spec)
|
rootResourcePool.CreateResourcePool(self.resource_pool, rp_spec)
|
||||||
|
|
||||||
self.module.exit_json(changed=changed)
|
self.module.exit_json(changed=changed)
|
||||||
|
|
||||||
|
@ -337,5 +325,6 @@ def main():
|
||||||
vmware_rp = VMwareResourcePool(module)
|
vmware_rp = VMwareResourcePool(module)
|
||||||
vmware_rp.process_state()
|
vmware_rp.process_state()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -2,21 +2,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2015, Joseph Callen <jcallen () csc.com>
|
# (c) 2015, Joseph Callen <jcallen () csc.com>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -60,6 +50,9 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYVMOMI = False
|
HAS_PYVMOMI = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.vmware import HAS_PYVMOMI, connect_to_api, get_all_objs, vmware_argument_spec
|
||||||
|
|
||||||
|
|
||||||
def find_hostsystem(content):
|
def find_hostsystem(content):
|
||||||
host_system = get_all_objs(content, [vim.HostSystem])
|
host_system = get_all_objs(content, [vim.HostSystem])
|
||||||
|
@ -94,9 +87,6 @@ def main():
|
||||||
|
|
||||||
module.exit_json(changed=False, canonical=scsilun_canonical[target_lun_uuid[module.params['target_id']]])
|
module.exit_json(changed=False, canonical=scsilun_canonical[target_lun_uuid[module.params['target_id']]])
|
||||||
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.vmware import *
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
|
|
@ -2,21 +2,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2015, Joseph Callen <jcallen () csc.com>
|
# (c) 2015, Joseph Callen <jcallen () csc.com>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -55,6 +45,9 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYVMOMI = False
|
HAS_PYVMOMI = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.vmware import HAS_PYVMOMI, connect_to_api, get_all_objs, vmware_argument_spec
|
||||||
|
|
||||||
|
|
||||||
# https://github.com/vmware/pyvmomi-community-samples/blob/master/samples/getallvms.py
|
# https://github.com/vmware/pyvmomi-community-samples/blob/master/samples/getallvms.py
|
||||||
def get_all_virtual_machines(content):
|
def get_all_virtual_machines(content):
|
||||||
|
@ -106,8 +99,6 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e))
|
module.fail_json(msg=str(e))
|
||||||
|
|
||||||
from ansible.module_utils.vmware import *
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -2,21 +2,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2015, 2016 Ritesh Khadgaray <khadgaray () gmail.com>
|
# (c) 2015, 2016 Ritesh Khadgaray <khadgaray () gmail.com>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -140,8 +130,10 @@ try:
|
||||||
HAS_PYVMOMI = True
|
HAS_PYVMOMI = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYVMOMI = False
|
HAS_PYVMOMI = False
|
||||||
from ansible.module_utils.vmware import connect_to_api, find_cluster_by_name, find_datacenter_by_name, find_vm_by_id, vmware_argument_spec
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.vmware import (connect_to_api, find_cluster_by_name, find_datacenter_by_name,
|
||||||
|
find_vm_by_id, vmware_argument_spec)
|
||||||
|
|
||||||
|
|
||||||
# https://github.com/vmware/pyvmomi-community-samples/blob/master/samples/execute_program_in_vm.py
|
# https://github.com/vmware/pyvmomi-community-samples/blob/master/samples/execute_program_in_vm.py
|
||||||
|
@ -214,5 +206,6 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(changed=False, msg=str(e))
|
module.fail_json(changed=False, msg=str(e))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -2,21 +2,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2015, Joseph Callen <jcallen () csc.com>
|
# (c) 2015, Joseph Callen <jcallen () csc.com>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -65,6 +55,10 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYVMOMI = False
|
HAS_PYVMOMI = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.vmware import (HAS_PYVMOMI, connect_to_api, get_all_objs,
|
||||||
|
vmware_argument_spec, wait_for_task)
|
||||||
|
|
||||||
|
|
||||||
class VMwareVmVssDvsMigrate(object):
|
class VMwareVmVssDvsMigrate(object):
|
||||||
def __init__(self, module):
|
def __init__(self, module):
|
||||||
|
@ -156,8 +150,6 @@ def main():
|
||||||
vmware_vmnic_migrate = VMwareVmVssDvsMigrate(module)
|
vmware_vmnic_migrate = VMwareVmVssDvsMigrate(module)
|
||||||
vmware_vmnic_migrate.process_state()
|
vmware_vmnic_migrate.process_state()
|
||||||
|
|
||||||
from ansible.module_utils.vmware import *
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -2,21 +2,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2015, Joseph Callen <jcallen () csc.com>
|
# (c) 2015, Joseph Callen <jcallen () csc.com>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -103,6 +93,9 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYVMOMI = False
|
HAS_PYVMOMI = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.vmware import HAS_PYVMOMI, connect_to_api, get_all_objs, vmware_argument_spec
|
||||||
|
|
||||||
|
|
||||||
def create_vmkernel_adapter(host_system, port_group_name,
|
def create_vmkernel_adapter(host_system, port_group_name,
|
||||||
vlan_id, vswitch_name,
|
vlan_id, vswitch_name,
|
||||||
|
@ -144,7 +137,7 @@ def create_vmkernel_adapter(host_system, port_group_name,
|
||||||
vsan_config.networkInfo.port = [vim.vsan.host.ConfigInfo.NetworkInfo.PortConfig()]
|
vsan_config.networkInfo.port = [vim.vsan.host.ConfigInfo.NetworkInfo.PortConfig()]
|
||||||
|
|
||||||
vsan_config.networkInfo.port[0].device = vnic_device
|
vsan_config.networkInfo.port[0].device = vnic_device
|
||||||
host_vsan_config_result = vsan_system.UpdateVsan_Task(vsan_config)
|
vsan_system.UpdateVsan_Task(vsan_config)
|
||||||
|
|
||||||
if enable_vmotion:
|
if enable_vmotion:
|
||||||
host_virtual_vic_manager.SelectVnicForNicType("vmotion", vnic_device)
|
host_virtual_vic_manager.SelectVnicForNicType("vmotion", vnic_device)
|
||||||
|
@ -206,8 +199,5 @@ def main():
|
||||||
module.fail_json(msg=str(e))
|
module.fail_json(msg=str(e))
|
||||||
|
|
||||||
|
|
||||||
from ansible.module_utils.vmware import *
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -2,21 +2,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2015, Joseph Callen <jcallen () csc.com>
|
# (c) 2015, Joseph Callen <jcallen () csc.com>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -72,6 +62,9 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYVMOMI = False
|
HAS_PYVMOMI = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.vmware import HAS_PYVMOMI, connect_to_api, get_all_objs, vmware_argument_spec
|
||||||
|
|
||||||
|
|
||||||
def configure_vmkernel_ip_address(host_system, vmk_name, ip_address, subnet_mask):
|
def configure_vmkernel_ip_address(host_system, vmk_name, ip_address, subnet_mask):
|
||||||
|
|
||||||
|
@ -121,8 +114,6 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e))
|
module.fail_json(msg=str(e))
|
||||||
|
|
||||||
from ansible.module_utils.vmware import *
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -2,21 +2,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2015, Bede Carroll <bc+github () bedecarroll.com>
|
# (c) 2015, Bede Carroll <bc+github () bedecarroll.com>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -79,6 +69,9 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYVMOMI = False
|
HAS_PYVMOMI = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.vmware import (connect_to_api, find_hostsystem_by_name, find_vm_by_name,
|
||||||
|
vmware_argument_spec, wait_for_task)
|
||||||
|
|
||||||
def migrate_vm(vm_object, host_object):
|
def migrate_vm(vm_object, host_object):
|
||||||
"""
|
"""
|
||||||
|
@ -146,8 +139,6 @@ def main():
|
||||||
result['changed'] = True
|
result['changed'] = True
|
||||||
module.exit_json(**result)
|
module.exit_json(**result)
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible.module_utils.vmware import *
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -2,21 +2,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2015, Russell Teague <rteague2 () csc.com>
|
# (c) 2015, Russell Teague <rteague2 () csc.com>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -76,6 +66,10 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYVMOMI = False
|
HAS_PYVMOMI = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.vmware import (HAS_PYVMOMI, connect_to_api, get_all_objs, vmware_argument_spec,
|
||||||
|
wait_for_task)
|
||||||
|
|
||||||
|
|
||||||
def create_vsan_cluster(host_system, new_cluster_uuid):
|
def create_vsan_cluster(host_system, new_cluster_uuid):
|
||||||
host_config_manager = host_system.configManager
|
host_config_manager = host_system.configManager
|
||||||
|
@ -128,8 +122,6 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e))
|
module.fail_json(msg=str(e))
|
||||||
|
|
||||||
from ansible.module_utils.vmware import *
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -2,21 +2,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2015, Joseph Callen <jcallen () csc.com>
|
# (c) 2015, Joseph Callen <jcallen () csc.com>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -91,8 +81,9 @@ try:
|
||||||
HAS_PYVMOMI = True
|
HAS_PYVMOMI = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYVMOMI = False
|
HAS_PYVMOMI = False
|
||||||
from ansible.module_utils.vmware import vmware_argument_spec, get_all_objs, connect_to_api
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.vmware import vmware_argument_spec, get_all_objs, connect_to_api
|
||||||
|
|
||||||
|
|
||||||
def find_vswitch_by_name(host, vswitch_name):
|
def find_vswitch_by_name(host, vswitch_name):
|
||||||
|
@ -206,5 +197,6 @@ def main():
|
||||||
host_virtual_switch = VMwareHostVirtualSwitch(module)
|
host_virtual_switch = VMwareHostVirtualSwitch(module)
|
||||||
host_virtual_switch.process_state()
|
host_virtual_switch.process_state()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -2,21 +2,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Copyright 2015 Dag Wieers <dag@wieers.com>
|
# Copyright 2015 Dag Wieers <dag@wieers.com>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -96,15 +86,17 @@ EXAMPLES = '''
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import atexit
|
import atexit
|
||||||
import mmap
|
|
||||||
import errno
|
import errno
|
||||||
|
import mmap
|
||||||
import socket
|
import socket
|
||||||
|
import traceback
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.pycompat24 import get_exception
|
|
||||||
from ansible.module_utils.six.moves.urllib.parse import urlencode
|
from ansible.module_utils.six.moves.urllib.parse import urlencode
|
||||||
|
from ansible.module_utils._text import to_native
|
||||||
from ansible.module_utils.urls import open_url
|
from ansible.module_utils.urls import open_url
|
||||||
|
|
||||||
|
|
||||||
def vmware_path(datastore, datacenter, path):
|
def vmware_path(datastore, datacenter, path):
|
||||||
''' Constructs a URL path that VSphere accepts reliably '''
|
''' Constructs a URL path that VSphere accepts reliably '''
|
||||||
path = "/folder/%s" % path.lstrip("/")
|
path = "/folder/%s" % path.lstrip("/")
|
||||||
|
@ -119,6 +111,7 @@ def vmware_path(datastore, datacenter, path):
|
||||||
params = urlencode(params)
|
params = urlencode(params)
|
||||||
return "%s?%s" % (path, params)
|
return "%s?%s" % (path, params)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
|
@ -163,22 +156,22 @@ def main():
|
||||||
r = open_url(url, data=data, headers=headers, method='PUT',
|
r = open_url(url, data=data, headers=headers, method='PUT',
|
||||||
url_username=login, url_password=password, validate_certs=validate_certs,
|
url_username=login, url_password=password, validate_certs=validate_certs,
|
||||||
force_basic_auth=True)
|
force_basic_auth=True)
|
||||||
except socket.error:
|
except socket.error as e:
|
||||||
e = get_exception()
|
|
||||||
if isinstance(e.args, tuple) and e[0] == errno.ECONNRESET:
|
if isinstance(e.args, tuple) and e[0] == errno.ECONNRESET:
|
||||||
# VSphere resets connection if the file is in use and cannot be replaced
|
# VSphere resets connection if the file is in use and cannot be replaced
|
||||||
module.fail_json(msg='Failed to upload, image probably in use', status=None, errno=e[0], reason=str(e), url=url)
|
module.fail_json(msg='Failed to upload, image probably in use', status=None, errno=e[0], reason=to_native(e), url=url)
|
||||||
else:
|
else:
|
||||||
module.fail_json(msg=str(e), status=None, errno=e[0], reason=str(e), url=url)
|
module.fail_json(msg=str(e), status=None, errno=e[0], reason=str(e),
|
||||||
except Exception:
|
url=url, exception=traceback.format_exc())
|
||||||
e = get_exception()
|
except Exception as e:
|
||||||
error_code = -1
|
error_code = -1
|
||||||
try:
|
try:
|
||||||
if isinstance(e[0], int):
|
if isinstance(e[0], int):
|
||||||
error_code = e[0]
|
error_code = e[0]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
module.fail_json(msg=str(e), status=None, errno=error_code, reason=str(e), url=url)
|
module.fail_json(msg=to_native(e), status=None, errno=error_code,
|
||||||
|
reason=to_native(e), url=url, exception=traceback.format_exc())
|
||||||
|
|
||||||
status = r.getcode()
|
status = r.getcode()
|
||||||
if 200 <= status < 300:
|
if 200 <= status < 300:
|
||||||
|
@ -192,5 +185,6 @@ def main():
|
||||||
|
|
||||||
module.fail_json(msg='Failed to upload', errno=None, status=status, reason=r.msg, length=length, headers=dict(r.headers), chunked=chunked, url=url)
|
module.fail_json(msg='Failed to upload', errno=None, status=status, reason=r.msg, length=length, headers=dict(r.headers), chunked=chunked, url=url)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,22 +1,11 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# This file is part of Ansible
|
# Copyright: Ansible Project
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
from __future__ import absolute_import, division, print_function
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
__metaclass__ = type
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# TODO:
|
|
||||||
# Ability to set CPU/Memory reservations
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -307,7 +296,6 @@ EXAMPLES = '''
|
||||||
force: yes
|
force: yes
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import json
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import ssl
|
import ssl
|
||||||
|
@ -318,7 +306,7 @@ try:
|
||||||
from pysphere import VIServer, VIProperty, MORTypes
|
from pysphere import VIServer, VIProperty, MORTypes
|
||||||
from pysphere.resources import VimService_services as VI
|
from pysphere.resources import VimService_services as VI
|
||||||
from pysphere.vi_task import VITask
|
from pysphere.vi_task import VITask
|
||||||
from pysphere import VIException, VIApiException, FaultTypes
|
from pysphere import VIApiException
|
||||||
HAS_PYSPHERE = True
|
HAS_PYSPHERE = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
@ -328,6 +316,9 @@ from ansible.module_utils.six import string_types
|
||||||
from ansible.module_utils._text import to_native
|
from ansible.module_utils._text import to_native
|
||||||
|
|
||||||
|
|
||||||
|
# TODO:
|
||||||
|
# Ability to set CPU/Memory reservations
|
||||||
|
|
||||||
def add_scsi_controller(module, s, config, devices, type="paravirtual", bus_num=0, disk_ctrl_key=1):
|
def add_scsi_controller(module, s, config, devices, type="paravirtual", bus_num=0, disk_ctrl_key=1):
|
||||||
# add a scsi controller
|
# add a scsi controller
|
||||||
scsi_ctrl_spec = config.new_deviceChange()
|
scsi_ctrl_spec = config.new_deviceChange()
|
||||||
|
@ -801,7 +792,7 @@ def update_disks(vsphere_client, vm, module, vm_disk, changes):
|
||||||
found = True
|
found = True
|
||||||
continue
|
continue
|
||||||
if not found:
|
if not found:
|
||||||
it = VI.ReconfigVM_TaskRequestMsg()
|
VI.ReconfigVM_TaskRequestMsg()
|
||||||
_this = request.new__this(vm._mor)
|
_this = request.new__this(vm._mor)
|
||||||
_this.set_attribute_type(vm._mor.get_attribute_type())
|
_this.set_attribute_type(vm._mor.get_attribute_type())
|
||||||
request.set_element__this(_this)
|
request.set_element__this(_this)
|
||||||
|
@ -1811,7 +1802,7 @@ def main():
|
||||||
except ssl.SSLError as sslerr:
|
except ssl.SSLError as sslerr:
|
||||||
if '[SSL: CERTIFICATE_VERIFY_FAILED]' in sslerr.strerror:
|
if '[SSL: CERTIFICATE_VERIFY_FAILED]' in sslerr.strerror:
|
||||||
if not validate_certs:
|
if not validate_certs:
|
||||||
default_context = ssl._create_default_https_context
|
ssl._create_default_https_context
|
||||||
ssl._create_default_https_context = ssl._create_unverified_context
|
ssl._create_default_https_context = ssl._create_unverified_context
|
||||||
viserver.connect(vcenter_hostname, username, password)
|
viserver.connect(vcenter_hostname, username, password)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -1,20 +1,13 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# This file is part of Ansible
|
# Copyright: Ansible Project
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
from __future__ import absolute_import, division, print_function
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
__metaclass__ = type
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
@ -81,6 +74,10 @@ EXAMPLES = '''
|
||||||
|
|
||||||
import cgi
|
import cgi
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.urls import fetch_url
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
|
@ -144,8 +141,6 @@ def main():
|
||||||
|
|
||||||
module.exit_json(changed=True, room=room, msg=msg, notify=notify)
|
module.exit_json(changed=True, room=room, msg=msg, notify=notify)
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.urls import *
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -2,21 +2,13 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2016, Jonathan Mainguy <jon@soh.re>
|
# (c) 2016, Jonathan Mainguy <jon@soh.re>
|
||||||
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
#
|
#
|
||||||
# This file is part of Ansible
|
# basis of code taken from the ansible twillio and nexmo modules
|
||||||
#
|
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
from __future__ import absolute_import, division, print_function
|
||||||
# it under the terms of the GNU General Public License as published by
|
__metaclass__ = type
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -106,9 +98,9 @@ changed:
|
||||||
|
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.urls import fetch_url
|
from ansible.module_utils.urls import fetch_url
|
||||||
# Stole most of this code from the ansible twillio and nexmo modules
|
|
||||||
|
|
||||||
|
|
||||||
def send(module, src, dest, msg, media, user_id, api_token, api_secret):
|
def send(module, src, dest, msg, media, user_id, api_token, api_secret):
|
||||||
|
@ -161,5 +153,6 @@ def main():
|
||||||
changed = True
|
changed = True
|
||||||
module.exit_json(changed=changed)
|
module.exit_json(changed=changed)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,20 +1,11 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# This file is part of Ansible
|
# Copyright: Ansible Project
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
from __future__ import absolute_import, division, print_function
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
__metaclass__ = type
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
|
@ -122,6 +113,8 @@ message:
|
||||||
type: string
|
type: string
|
||||||
sample: OK (585 bytes)
|
sample: OK (585 bytes)
|
||||||
"""
|
"""
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.urls import fetch_url
|
||||||
|
|
||||||
|
|
||||||
def spark_message(module):
|
def spark_message(module):
|
||||||
|
@ -195,7 +188,5 @@ def main():
|
||||||
module.exit_json(**results)
|
module.exit_json(**results)
|
||||||
|
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible.module_utils.urls import fetch_url
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -2,21 +2,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Copyright 2013 Matt Coddington <coddington@gmail.com>
|
# Copyright 2013 Matt Coddington <coddington@gmail.com>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -110,7 +100,10 @@ EXAMPLES = '''
|
||||||
tags: tag1,tag2,tag3
|
tags: tag1,tag2,tag3
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.six.moves.urllib.parse import urlencode
|
from ansible.module_utils.six.moves.urllib.parse import urlencode
|
||||||
|
from ansible.module_utils.urls import fetch_url
|
||||||
|
|
||||||
|
|
||||||
# ===========================================
|
# ===========================================
|
||||||
# Module execution.
|
# Module execution.
|
||||||
|
@ -192,9 +185,6 @@ def main():
|
||||||
|
|
||||||
module.exit_json(changed=True, msg=module.params["msg"])
|
module.exit_json(changed=True, msg=module.params["msg"])
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.urls import *
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,20 +1,12 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# This file is part of Ansible
|
# Copyright: Ansible Project
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
from __future__ import absolute_import, division, print_function
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
__metaclass__ = type
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -69,7 +61,10 @@ EXAMPLES = '''
|
||||||
message=deployed {{ target }}
|
message=deployed {{ target }}
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.six.moves.urllib.parse import urlencode
|
from ansible.module_utils.six.moves.urllib.parse import urlencode
|
||||||
|
from ansible.module_utils.urls import fetch_url
|
||||||
|
|
||||||
|
|
||||||
BASE_URL = 'https://grove.io/api/notice/%s/'
|
BASE_URL = 'https://grove.io/api/notice/%s/'
|
||||||
|
|
||||||
|
@ -116,9 +111,6 @@ def main():
|
||||||
# Mission complete
|
# Mission complete
|
||||||
module.exit_json(msg="OK")
|
module.exit_json(msg="OK")
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.urls import *
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -2,21 +2,10 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2015, Billy Kimble <basslines@gmail.com>
|
# (c) 2015, Billy Kimble <basslines@gmail.com>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
|
@ -69,9 +58,13 @@ EXAMPLES = """
|
||||||
when: ec2.instances|length > 0
|
when: ec2.instances|length > 0
|
||||||
with_items: '{{ ec2.instances }}'
|
with_items: '{{ ec2.instances }}'
|
||||||
"""
|
"""
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.urls import fetch_url
|
||||||
|
|
||||||
|
|
||||||
HALL_API_ENDPOINT = 'https://hall.com/api/1/services/generic/%s'
|
HALL_API_ENDPOINT = 'https://hall.com/api/1/services/generic/%s'
|
||||||
|
|
||||||
|
|
||||||
def send_request_to_hall(module, room_token, payload):
|
def send_request_to_hall(module, room_token, payload):
|
||||||
headers = {'Content-Type': 'application/json'}
|
headers = {'Content-Type': 'application/json'}
|
||||||
payload=module.jsonify(payload)
|
payload=module.jsonify(payload)
|
||||||
|
@ -81,6 +74,7 @@ def send_request_to_hall(module, room_token, payload):
|
||||||
secure_url = HALL_API_ENDPOINT % ('[redacted]')
|
secure_url = HALL_API_ENDPOINT % ('[redacted]')
|
||||||
module.fail_json(msg=" failed to send %s to %s: %s" % (payload, secure_url, info['msg']))
|
module.fail_json(msg=" failed to send %s to %s: %s" % (payload, secure_url, info['msg']))
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=dict(
|
argument_spec=dict(
|
||||||
|
@ -100,8 +94,6 @@ def main():
|
||||||
send_request_to_hall(module, room_token, payload)
|
send_request_to_hall(module, room_token, payload)
|
||||||
module.exit_json(msg="OK")
|
module.exit_json(msg="OK")
|
||||||
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.urls import *
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,20 +1,13 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# This file is part of Ansible
|
# Copyright: Ansible Project
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
from __future__ import absolute_import, division, print_function
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
__metaclass__ = type
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['stableinterface'],
|
'status': ['stableinterface'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
@ -103,19 +96,16 @@ EXAMPLES = '''
|
||||||
# HipChat module specific support methods.
|
# HipChat module specific support methods.
|
||||||
#
|
#
|
||||||
|
|
||||||
try:
|
import json
|
||||||
import json
|
import traceback
|
||||||
except ImportError:
|
|
||||||
import simplejson as json
|
|
||||||
|
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.pycompat24 import get_exception
|
|
||||||
from ansible.module_utils.six.moves.urllib.parse import urlencode
|
from ansible.module_utils.six.moves.urllib.parse import urlencode
|
||||||
from ansible.module_utils.six.moves.urllib.request import pathname2url
|
from ansible.module_utils.six.moves.urllib.request import pathname2url
|
||||||
|
from ansible.module_utils._text import to_native
|
||||||
from ansible.module_utils.urls import fetch_url
|
from ansible.module_utils.urls import fetch_url
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_URI = "https://api.hipchat.com/v1"
|
DEFAULT_URI = "https://api.hipchat.com/v1"
|
||||||
|
|
||||||
MSG_URI_V1 = "/rooms/message"
|
MSG_URI_V1 = "/rooms/message"
|
||||||
|
@ -217,12 +207,12 @@ def main():
|
||||||
send_msg_v2(module, token, room, msg_from, msg, msg_format, color, notify, api)
|
send_msg_v2(module, token, room, msg_from, msg, msg_format, color, notify, api)
|
||||||
else:
|
else:
|
||||||
send_msg_v1(module, token, room, msg_from, msg, msg_format, color, notify, api)
|
send_msg_v1(module, token, room, msg_from, msg, msg_format, color, notify, api)
|
||||||
except Exception:
|
except Exception as e:
|
||||||
e = get_exception()
|
module.fail_json(msg="unable to send msg: %s" % to_native(e), exception=traceback.format_exc())
|
||||||
module.fail_json(msg="unable to send msg: %s" % e)
|
|
||||||
|
|
||||||
changed = True
|
changed = True
|
||||||
module.exit_json(changed=changed, room=room, msg_from=msg_from, msg=msg)
|
module.exit_json(changed=changed, room=room, msg_from=msg_from, msg=msg)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -2,22 +2,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2013, Jan-Piet Mens <jpmens () gmail.com>
|
# (c) 2013, Jan-Piet Mens <jpmens () gmail.com>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['stableinterface'],
|
'status': ['stableinterface'],
|
||||||
|
@ -152,8 +141,11 @@ EXAMPLES = '''
|
||||||
import re
|
import re
|
||||||
import socket
|
import socket
|
||||||
import ssl
|
import ssl
|
||||||
|
import time
|
||||||
|
import traceback
|
||||||
|
|
||||||
from time import sleep
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils._text import to_native
|
||||||
|
|
||||||
|
|
||||||
def send_msg(msg, server='localhost', port='6667', channel=None, nick_to=[], key=None, topic=None,
|
def send_msg(msg, server='localhost', port='6667', channel=None, nick_to=[], key=None, topic=None,
|
||||||
|
@ -219,7 +211,7 @@ def send_msg(msg, server='localhost', port='6667', channel=None, nick_to=[], key
|
||||||
break
|
break
|
||||||
elif time.time() - start > timeout:
|
elif time.time() - start > timeout:
|
||||||
raise Exception('Timeout waiting for IRC server welcome response')
|
raise Exception('Timeout waiting for IRC server welcome response')
|
||||||
sleep(0.5)
|
time.sleep(0.5)
|
||||||
|
|
||||||
if key:
|
if key:
|
||||||
irc.send('JOIN %s %s\r\n' % (channel, key))
|
irc.send('JOIN %s %s\r\n' % (channel, key))
|
||||||
|
@ -234,22 +226,22 @@ def send_msg(msg, server='localhost', port='6667', channel=None, nick_to=[], key
|
||||||
break
|
break
|
||||||
elif time.time() - start > timeout:
|
elif time.time() - start > timeout:
|
||||||
raise Exception('Timeout waiting for IRC JOIN response')
|
raise Exception('Timeout waiting for IRC JOIN response')
|
||||||
sleep(0.5)
|
time.sleep(0.5)
|
||||||
|
|
||||||
if topic is not None:
|
if topic is not None:
|
||||||
irc.send('TOPIC %s :%s\r\n' % (channel, topic))
|
irc.send('TOPIC %s :%s\r\n' % (channel, topic))
|
||||||
sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
if nick_to:
|
if nick_to:
|
||||||
for nick in nick_to:
|
for nick in nick_to:
|
||||||
irc.send('PRIVMSG %s :%s\r\n' % (nick, message))
|
irc.send('PRIVMSG %s :%s\r\n' % (nick, message))
|
||||||
if channel:
|
if channel:
|
||||||
irc.send('PRIVMSG %s :%s\r\n' % (channel, message))
|
irc.send('PRIVMSG %s :%s\r\n' % (channel, message))
|
||||||
sleep(1)
|
time.sleep(1)
|
||||||
if part:
|
if part:
|
||||||
irc.send('PART %s\r\n' % channel)
|
irc.send('PART %s\r\n' % channel)
|
||||||
irc.send('QUIT\r\n')
|
irc.send('QUIT\r\n')
|
||||||
sleep(1)
|
time.sleep(1)
|
||||||
irc.close()
|
irc.close()
|
||||||
|
|
||||||
# ===========================================
|
# ===========================================
|
||||||
|
@ -303,16 +295,12 @@ def main():
|
||||||
|
|
||||||
try:
|
try:
|
||||||
send_msg(msg, server, port, channel, nick_to, key, topic, nick, color, passwd, timeout, use_ssl, part, style)
|
send_msg(msg, server, port, channel, nick_to, key, topic, nick, color, passwd, timeout, use_ssl, part, style)
|
||||||
except Exception:
|
except Exception as e:
|
||||||
e = get_exception()
|
module.fail_json(msg="unable to send to IRC: %s" % to_native(e), exception=traceback.format_exc())
|
||||||
module.fail_json(msg="unable to send to IRC: %s" % e)
|
|
||||||
|
|
||||||
module.exit_json(changed=False, channel=channel, nick=nick,
|
module.exit_json(changed=False, channel=channel, nick=nick,
|
||||||
msg=msg)
|
msg=msg)
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.pycompat24 import get_exception
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -2,21 +2,10 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# (c) 2015, Brian Coca <bcoca@ansible.com>
|
# (c) 2015, Brian Coca <bcoca@ansible.com>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
|
@ -94,9 +83,8 @@ EXAMPLES = '''
|
||||||
msg: Ansible task finished
|
msg: Ansible task finished
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import os
|
|
||||||
import re
|
|
||||||
import time
|
import time
|
||||||
|
import traceback
|
||||||
|
|
||||||
HAS_XMPP = True
|
HAS_XMPP = True
|
||||||
try:
|
try:
|
||||||
|
@ -104,6 +92,10 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_XMPP = False
|
HAS_XMPP = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils._text import to_native
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
|
@ -163,15 +155,11 @@ def main():
|
||||||
conn.send(msg)
|
conn.send(msg)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
conn.disconnect()
|
conn.disconnect()
|
||||||
except Exception:
|
except Exception as e:
|
||||||
e = get_exception()
|
module.fail_json(msg="unable to send msg: %s" % to_native(e), exception=traceback.format_exc())
|
||||||
module.fail_json(msg="unable to send msg: %s" % e)
|
|
||||||
|
|
||||||
module.exit_json(changed=False, to=to, user=user, msg=msg.getBody())
|
module.exit_json(changed=False, to=to, user=user, msg=msg.getBody())
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.pycompat24 import get_exception
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -2,21 +2,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Copyright 2012 Dag Wieers <dag@wieers.com>
|
# Copyright 2012 Dag Wieers <dag@wieers.com>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['stableinterface'],
|
'status': ['stableinterface'],
|
||||||
|
@ -203,24 +193,15 @@ EXAMPLES = '''
|
||||||
import os
|
import os
|
||||||
import smtplib
|
import smtplib
|
||||||
import ssl
|
import ssl
|
||||||
|
import traceback
|
||||||
try:
|
from email import encoders
|
||||||
# Python 2.6+
|
from email.utils import parseaddr, formataddr
|
||||||
from email import encoders
|
from email.mime.base import MIMEBase
|
||||||
from email.utils import parseaddr, formataddr
|
from email.mime.multipart import MIMEMultipart
|
||||||
from email.mime.base import MIMEBase
|
from email.mime.text import MIMEText
|
||||||
from email.mime.multipart import MIMEMultipart
|
|
||||||
from email.mime.text import MIMEText
|
|
||||||
except ImportError:
|
|
||||||
# Python 2.4 & 2.5
|
|
||||||
from email import Encoders as encoders
|
|
||||||
from email.Utils import parseaddr, formataddr
|
|
||||||
from email.MIMEBase import MIMEBase
|
|
||||||
from email.MIMEMultipart import MIMEMultipart
|
|
||||||
from email.MIMEText import MIMEText
|
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.pycompat24 import get_exception
|
from ansible.module_utils._text import to_native
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
@ -275,18 +256,18 @@ def main():
|
||||||
if secure in ('never', 'try', 'starttls'):
|
if secure in ('never', 'try', 'starttls'):
|
||||||
try:
|
try:
|
||||||
code, smtpmessage = smtp.connect(host, port=port)
|
code, smtpmessage = smtp.connect(host, port=port)
|
||||||
except smtplib.SMTPException:
|
except smtplib.SMTPException as e:
|
||||||
e = get_exception()
|
|
||||||
if secure == 'try':
|
if secure == 'try':
|
||||||
try:
|
try:
|
||||||
smtp = smtplib.SMTP_SSL(timeout=timeout)
|
smtp = smtplib.SMTP_SSL(timeout=timeout)
|
||||||
code, smtpmessage = smtp.connect(host, port=port)
|
code, smtpmessage = smtp.connect(host, port=port)
|
||||||
secure_state = True
|
secure_state = True
|
||||||
except ssl.SSLError:
|
except ssl.SSLError as e:
|
||||||
e = get_exception()
|
module.fail_json(rc=1, msg='Unable to start an encrypted session to %s:%s: %s' %
|
||||||
module.fail_json(rc=1, msg='Unable to start an encrypted session to %s:%s: %s' % (host, port, e))
|
(host, port, to_native(e)), exception=traceback.format_exc())
|
||||||
else:
|
else:
|
||||||
module.fail_json(rc=1, msg='Unable to Connect to %s:%s: %s' % (host, port, e))
|
module.fail_json(rc=1, msg='Unable to Connect to %s:%s: %s' %
|
||||||
|
(host, port, to_native(e)), exception=traceback.format_exc())
|
||||||
|
|
||||||
|
|
||||||
if (secure == 'always'):
|
if (secure == 'always'):
|
||||||
|
@ -294,16 +275,16 @@ def main():
|
||||||
smtp = smtplib.SMTP_SSL(timeout=timeout)
|
smtp = smtplib.SMTP_SSL(timeout=timeout)
|
||||||
code, smtpmessage = smtp.connect(host, port=port)
|
code, smtpmessage = smtp.connect(host, port=port)
|
||||||
secure_state = True
|
secure_state = True
|
||||||
except ssl.SSLError:
|
except ssl.SSLError as e:
|
||||||
e = get_exception()
|
module.fail_json(rc=1, msg='Unable to start an encrypted session to %s:%s: %s' %
|
||||||
module.fail_json(rc=1, msg='Unable to start an encrypted session to %s:%s: %s' % (host, port, e))
|
(host, port, to_native(e)), exception=traceback.format_exc())
|
||||||
|
|
||||||
if int(code) > 0:
|
if int(code) > 0:
|
||||||
try:
|
try:
|
||||||
smtp.ehlo()
|
smtp.ehlo()
|
||||||
except smtplib.SMTPException:
|
except smtplib.SMTPException as e:
|
||||||
e = get_exception()
|
module.fail_json(rc=1, msg='Helo failed for host %s:%s: %s' %
|
||||||
module.fail_json(rc=1, msg='Helo failed for host %s:%s: %s' % (host, port, e))
|
(host, port, to_native(e)), exception=traceback.format_exc())
|
||||||
|
|
||||||
auth_flag = smtp.has_extn('AUTH')
|
auth_flag = smtp.has_extn('AUTH')
|
||||||
|
|
||||||
|
@ -314,9 +295,9 @@ def main():
|
||||||
smtp.ehlo()
|
smtp.ehlo()
|
||||||
auth_flag = smtp.has_extn('AUTH')
|
auth_flag = smtp.has_extn('AUTH')
|
||||||
secure_state = True
|
secure_state = True
|
||||||
except smtplib.SMTPException:
|
except smtplib.SMTPException as e:
|
||||||
e = get_exception()
|
module.fail_json(rc=1, msg='Unable to start an encrypted session to %s:%s: %s' %
|
||||||
module.fail_json(rc=1, msg='Unable to start an encrypted session to %s:%s: %s' % (host, port, e))
|
(host, port, to_native(e)), exception=traceback.format_exc())
|
||||||
else:
|
else:
|
||||||
if secure == 'starttls':
|
if secure == 'starttls':
|
||||||
module.fail_json(rc=1, msg='StartTLS is not offered on server %s:%s' % (host, port))
|
module.fail_json(rc=1, msg='StartTLS is not offered on server %s:%s' % (host, port))
|
||||||
|
@ -385,17 +366,17 @@ def main():
|
||||||
|
|
||||||
part.add_header('Content-disposition', 'attachment', filename=os.path.basename(file))
|
part.add_header('Content-disposition', 'attachment', filename=os.path.basename(file))
|
||||||
msg.attach(part)
|
msg.attach(part)
|
||||||
except Exception:
|
except Exception as e:
|
||||||
e = get_exception()
|
module.fail_json(rc=1, msg="Failed to send mail: can't attach file %s: %s" %
|
||||||
module.fail_json(rc=1, msg="Failed to send mail: can't attach file %s: %s" % (file, e))
|
(file, to_native(e)), exception=traceback.format_exc())
|
||||||
|
|
||||||
composed = msg.as_string()
|
composed = msg.as_string()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
smtp.sendmail(sender_addr, set(addr_list), composed)
|
smtp.sendmail(sender_addr, set(addr_list), composed)
|
||||||
except Exception:
|
except Exception as e:
|
||||||
e = get_exception()
|
module.fail_json(rc=1, msg='Failed to send mail to %s: %s' %
|
||||||
module.fail_json(rc=1, msg='Failed to send mail to %s: %s' % (", ".join(addr_list), e))
|
(", ".join(addr_list), to_native(e)), exception=traceback.format_exc())
|
||||||
|
|
||||||
smtp.quit()
|
smtp.quit()
|
||||||
|
|
||||||
|
|
|
@ -7,21 +7,12 @@
|
||||||
# # (c) 2016, René Moser <mail@renemoser.net>
|
# # (c) 2016, René Moser <mail@renemoser.net>
|
||||||
# # (c) 2015, Stefan Berggren <nsg@nsg.cc>
|
# # (c) 2015, Stefan Berggren <nsg@nsg.cc>
|
||||||
# # (c) 2014, Ramon de la Fuente <ramon@delafuente.nl>)
|
# # (c) 2014, Ramon de la Fuente <ramon@delafuente.nl>)
|
||||||
|
#
|
||||||
|
# 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',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -103,6 +94,7 @@ webhook_url:
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.urls import fetch_url
|
from ansible.module_utils.urls import fetch_url
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
|
|
|
@ -2,22 +2,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2013, 2014, Jan-Piet Mens <jpmens () gmail.com>
|
# (c) 2013, 2014, Jan-Piet Mens <jpmens () gmail.com>
|
||||||
#
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
from __future__ import absolute_import, division, print_function
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
__metaclass__ = type
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -133,6 +122,9 @@ EXAMPLES = '''
|
||||||
# MQTT module support methods.
|
# MQTT module support methods.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
import os
|
||||||
|
import traceback
|
||||||
|
|
||||||
HAS_PAHOMQTT = True
|
HAS_PAHOMQTT = True
|
||||||
try:
|
try:
|
||||||
import socket
|
import socket
|
||||||
|
@ -140,6 +132,10 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PAHOMQTT = False
|
HAS_PAHOMQTT = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils._text import to_native
|
||||||
|
|
||||||
|
|
||||||
# ===========================================
|
# ===========================================
|
||||||
# Main
|
# Main
|
||||||
#
|
#
|
||||||
|
@ -196,7 +192,7 @@ def main():
|
||||||
'keyfile': keyfile}
|
'keyfile': keyfile}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
rc = mqtt.single(topic, payload,
|
mqtt.single(topic, payload,
|
||||||
qos=qos,
|
qos=qos,
|
||||||
retain=retain,
|
retain=retain,
|
||||||
client_id=client_id,
|
client_id=client_id,
|
||||||
|
@ -204,15 +200,12 @@ def main():
|
||||||
port=port,
|
port=port,
|
||||||
auth=auth,
|
auth=auth,
|
||||||
tls=tls)
|
tls=tls)
|
||||||
except Exception:
|
except Exception as e:
|
||||||
e = get_exception()
|
module.fail_json(msg="unable to publish to MQTT broker %s" % to_native(e),
|
||||||
module.fail_json(msg="unable to publish to MQTT broker %s" % (e))
|
exception=traceback.format_exc())
|
||||||
|
|
||||||
module.exit_json(changed=False, topic=topic)
|
module.exit_json(changed=False, topic=topic)
|
||||||
|
|
||||||
# import module snippets
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.pycompat24 import get_exception
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue