Add boilerplate and remove wildcard imports for openstack modules (#31461)
* Add boilerplate and remove wildcard imports for openstack modules * Remove openstack files that are now pep8 compliant from the legacy list
This commit is contained in:
parent
e609618274
commit
5e9384300d
47 changed files with 421 additions and 759 deletions
|
@ -1,19 +1,11 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
@ -49,13 +41,18 @@ EXAMPLES = '''
|
|||
var: service_catalog
|
||||
'''
|
||||
|
||||
import traceback
|
||||
|
||||
try:
|
||||
import shade
|
||||
from shade import meta
|
||||
HAS_SHADE = True
|
||||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
||||
# this is magic, see lib/ansible/module_common.py
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec, openstack_module_kwargs
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
|
@ -76,8 +73,6 @@ def main():
|
|||
except Exception as e:
|
||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
||||
|
||||
# this is magic, see lib/ansible/module_common.py
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.openstack import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -46,8 +46,6 @@ EXAMPLES = '''
|
|||
- mordred
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
try:
|
||||
import os_client_config
|
||||
from os_client_config import exceptions
|
||||
|
@ -55,6 +53,8 @@ try:
|
|||
except ImportError:
|
||||
HAS_OS_CLIENT_CONFIG = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
|
||||
def main():
|
||||
module = AnsibleModule(argument_spec=dict(
|
||||
|
|
|
@ -1,19 +1,11 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# Copyright (c) 2015 IBM
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
@ -179,7 +171,7 @@ openstack_flavors:
|
|||
sample: true
|
||||
'''
|
||||
|
||||
import re
|
||||
from distutils.version import StrictVersion
|
||||
|
||||
try:
|
||||
import shade
|
||||
|
@ -187,7 +179,8 @@ try:
|
|||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
||||
from distutils.version import StrictVersion
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec, openstack_module_kwargs
|
||||
|
||||
|
||||
def main():
|
||||
|
@ -246,8 +239,5 @@ def main():
|
|||
module.fail_json(msg=str(e))
|
||||
|
||||
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.openstack import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -1,19 +1,11 @@
|
|||
#!/usr/bin/python
|
||||
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
|
||||
# Author: Davide Guerri <davide.guerri@hp.com>
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
@ -136,15 +128,16 @@ EXAMPLES = '''
|
|||
server: cattle001
|
||||
'''
|
||||
|
||||
from distutils.version import StrictVersion
|
||||
|
||||
try:
|
||||
import shade
|
||||
from shade import meta
|
||||
|
||||
HAS_SHADE = True
|
||||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
||||
from distutils.version import StrictVersion
|
||||
from ansible.module_utils.basic import AnsibleModule, remove_values
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec, openstack_module_kwargs
|
||||
|
||||
|
||||
def _get_floating_ip(cloud, floating_ip_address):
|
||||
|
@ -267,10 +260,5 @@ def main():
|
|||
module.fail_json(msg=str(e), extra_data=e.extra_data)
|
||||
|
||||
|
||||
# this is magic, see lib/ansible/module_common.py
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.openstack import *
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -1,18 +1,10 @@
|
|||
#!/usr/bin/python
|
||||
# Copyright (c) 2016 IBM
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
@ -113,6 +105,9 @@ try:
|
|||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec, openstack_module_kwargs
|
||||
|
||||
|
||||
def _system_state_change(state, description, group):
|
||||
if state == 'present' and not group:
|
||||
|
@ -171,18 +166,15 @@ def main():
|
|||
|
||||
elif state == 'absent':
|
||||
if group is None:
|
||||
changed=False
|
||||
changed = False
|
||||
else:
|
||||
cloud.delete_group(group.id)
|
||||
changed=True
|
||||
changed = True
|
||||
module.exit_json(changed=changed)
|
||||
|
||||
except shade.OpenStackCloudException as e:
|
||||
module.fail_json(msg=str(e))
|
||||
|
||||
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.openstack import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -2,21 +2,13 @@
|
|||
|
||||
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
|
||||
# Copyright (c) 2013, Benno Joy <benno@ansible.com>
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
#TODO(mordred): we need to support "location"(v1) and "locations"(v2)
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
# TODO(mordred): we need to support "location"(v1) and "locations"(v2)
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
@ -138,6 +130,9 @@ try:
|
|||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec, openstack_module_kwargs
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
|
@ -215,9 +210,6 @@ def main():
|
|||
except shade.OpenStackCloudException as e:
|
||||
module.fail_json(msg=str(e), extra_data=e.extra_data)
|
||||
|
||||
# this is magic, see lib/ansible/module_common.py
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.openstack import *
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -1,19 +1,11 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
@ -141,6 +133,9 @@ try:
|
|||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec, openstack_module_kwargs
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
|
@ -162,8 +157,6 @@ def main():
|
|||
except shade.OpenStackCloudException as e:
|
||||
module.fail_json(msg=str(e))
|
||||
|
||||
# this is magic, see lib/ansible/module_common.py
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.openstack import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -2,19 +2,11 @@
|
|||
# coding: utf-8 -*-
|
||||
|
||||
# (c) 2014, Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
@ -150,17 +142,20 @@ EXAMPLES = '''
|
|||
|
||||
'''
|
||||
|
||||
try:
|
||||
import jsonpatch
|
||||
HAS_JSONPATCH = True
|
||||
except ImportError:
|
||||
HAS_JSONPATCH = False
|
||||
|
||||
try:
|
||||
import shade
|
||||
HAS_SHADE = True
|
||||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
||||
try:
|
||||
import jsonpatch
|
||||
HAS_JSONPATCH = True
|
||||
except ImportError:
|
||||
HAS_JSONPATCH = False
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec, openstack_module_kwargs
|
||||
|
||||
|
||||
def _parse_properties(module):
|
||||
|
@ -197,8 +192,6 @@ def _choose_id_value(module):
|
|||
return None
|
||||
|
||||
|
||||
|
||||
|
||||
def _choose_if_password_only(module, patch):
|
||||
if len(patch) is 1:
|
||||
if 'password' in patch[0]['path'] and module.params['skip_update_of_masked_password']:
|
||||
|
@ -357,9 +350,5 @@ def main():
|
|||
module.fail_json(msg=str(e))
|
||||
|
||||
|
||||
# this is magic, see lib/ansible/module_common.py
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.openstack import *
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -2,19 +2,11 @@
|
|||
# coding: utf-8 -*-
|
||||
|
||||
# (c) 2015-2016, Hewlett Packard Enterprise Development Company LP
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
@ -97,13 +89,16 @@ EXAMPLES = '''
|
|||
name: "testnode1"
|
||||
'''
|
||||
|
||||
from distutils.version import StrictVersion
|
||||
|
||||
try:
|
||||
import shade
|
||||
HAS_SHADE = True
|
||||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
||||
from distutils.version import StrictVersion
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec, openstack_module_kwargs
|
||||
|
||||
|
||||
def _choose_id_value(module):
|
||||
|
@ -170,9 +165,5 @@ def main():
|
|||
module.fail_json(msg=str(e))
|
||||
|
||||
|
||||
# this is magic, see lib/ansible/module_common.py
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.openstack import *
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -2,19 +2,11 @@
|
|||
# coding: utf-8 -*-
|
||||
|
||||
# (c) 2015, Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
@ -130,13 +122,16 @@ os_ironic_node:
|
|||
delegate_to: localhost
|
||||
'''
|
||||
|
||||
from distutils.version import StrictVersion
|
||||
|
||||
try:
|
||||
import shade
|
||||
HAS_SHADE = True
|
||||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
||||
from distutils.version import StrictVersion
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec, openstack_module_kwargs
|
||||
|
||||
|
||||
def _choose_id_value(module):
|
||||
|
@ -371,9 +366,5 @@ def main():
|
|||
module.fail_json(msg=str(e))
|
||||
|
||||
|
||||
# this is magic, see lib/ansible/module_common.py
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.openstack import *
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -3,19 +3,11 @@
|
|||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
# Copyright (c) 2013, Benno Joy <benno@ansible.com>
|
||||
# Copyright (c) 2013, John Dewey <john@dewey.ws>
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
@ -102,6 +94,9 @@ try:
|
|||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec, openstack_module_kwargs
|
||||
|
||||
|
||||
def _system_state_change(module, keypair):
|
||||
state = module.params['state']
|
||||
|
@ -172,8 +167,6 @@ def main():
|
|||
except shade.OpenStackCloudException as e:
|
||||
module.fail_json(msg=str(e))
|
||||
|
||||
# this is magic, see lib/ansible/module_common.py
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.openstack import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -1,18 +1,10 @@
|
|||
#!/usr/bin/python
|
||||
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
@ -112,6 +104,9 @@ try:
|
|||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec, openstack_module_kwargs
|
||||
|
||||
|
||||
def _needs_update(module, domain):
|
||||
if module.params['description'] is not None and \
|
||||
|
@ -121,6 +116,7 @@ def _needs_update(module, domain):
|
|||
return True
|
||||
return False
|
||||
|
||||
|
||||
def _system_state_change(module, domain):
|
||||
state = module.params['state']
|
||||
if state == 'absent' and domain:
|
||||
|
@ -133,8 +129,8 @@ def _system_state_change(module, domain):
|
|||
|
||||
return False
|
||||
|
||||
def main():
|
||||
|
||||
def main():
|
||||
argument_spec = openstack_full_argument_spec(
|
||||
name=dict(required=True),
|
||||
description=dict(default=None),
|
||||
|
@ -187,18 +183,15 @@ def main():
|
|||
|
||||
elif state == 'absent':
|
||||
if domain is None:
|
||||
changed=False
|
||||
changed = False
|
||||
else:
|
||||
cloud.delete_domain(domain.id)
|
||||
changed=True
|
||||
changed = True
|
||||
module.exit_json(changed=changed)
|
||||
|
||||
except shade.OpenStackCloudException as e:
|
||||
module.fail_json(msg=str(e))
|
||||
|
||||
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.openstack import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -1,18 +1,10 @@
|
|||
#!/usr/bin/python
|
||||
# Copyright (c) 2016 Hewlett-Packard Enterprise Corporation
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
# Copyright: (c) 2017, VEXXHOST, Inc.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
@ -101,16 +105,16 @@ endpoint:
|
|||
sample: True
|
||||
'''
|
||||
|
||||
from distutils.version import StrictVersion
|
||||
|
||||
try:
|
||||
import shade
|
||||
HAS_SHADE = True
|
||||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
||||
from distutils.version import StrictVersion
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec
|
||||
from ansible.module_utils.openstack import openstack_module_kwargs
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec, openstack_module_kwargs
|
||||
|
||||
|
||||
def _needs_update(module, endpoint):
|
||||
|
|
|
@ -1,18 +1,10 @@
|
|||
#!/usr/bin/python
|
||||
# Copyright (c) 2016 IBM
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
@ -83,6 +75,9 @@ try:
|
|||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec, openstack_module_kwargs
|
||||
|
||||
|
||||
def _system_state_change(state, role):
|
||||
if state == 'present' and not role:
|
||||
|
@ -126,19 +121,15 @@ def main():
|
|||
module.exit_json(changed=changed, role=role)
|
||||
elif state == 'absent':
|
||||
if role is None:
|
||||
changed=False
|
||||
changed = False
|
||||
else:
|
||||
cloud.delete_role(name)
|
||||
changed=True
|
||||
changed = True
|
||||
module.exit_json(changed=changed)
|
||||
|
||||
except shade.OpenStackCloudException as e:
|
||||
module.fail_json(msg=str(e))
|
||||
|
||||
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.openstack import *
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -1,18 +1,10 @@
|
|||
#!/usr/bin/python
|
||||
# Copyright 2016 Sam Yaple
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
@ -112,13 +104,16 @@ id:
|
|||
sample: "3292f020780b4d5baf27ff7e1d224c44"
|
||||
'''
|
||||
|
||||
from distutils.version import StrictVersion
|
||||
|
||||
try:
|
||||
import shade
|
||||
HAS_SHADE = True
|
||||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
||||
from distutils.version import StrictVersion
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec, openstack_module_kwargs
|
||||
|
||||
|
||||
def _needs_update(module, service):
|
||||
|
@ -177,7 +172,7 @@ def main():
|
|||
|
||||
if len(services) > 1:
|
||||
module.fail_json(msg='Service name %s and type %s are not unique' %
|
||||
(name, service_type))
|
||||
(name, service_type))
|
||||
elif len(services) == 1:
|
||||
service = services[0]
|
||||
else:
|
||||
|
@ -188,8 +183,8 @@ def main():
|
|||
|
||||
if state == 'present':
|
||||
if service is None:
|
||||
service = cloud.create_service(name=name,
|
||||
description=description, type=service_type, enabled=True)
|
||||
service = cloud.create_service(name=name, description=description,
|
||||
type=service_type, enabled=True)
|
||||
changed = True
|
||||
else:
|
||||
if _needs_update(module, service):
|
||||
|
@ -203,17 +198,15 @@ def main():
|
|||
|
||||
elif state == 'absent':
|
||||
if service is None:
|
||||
changed=False
|
||||
changed = False
|
||||
else:
|
||||
cloud.delete_service(service.id)
|
||||
changed=True
|
||||
changed = True
|
||||
module.exit_json(changed=changed)
|
||||
|
||||
except shade.OpenStackCloudException as e:
|
||||
module.fail_json(msg=str(e))
|
||||
|
||||
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.openstack import *
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -2,19 +2,11 @@
|
|||
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
# Copyright (c) 2013, Benno Joy <benno@ansible.com>
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
@ -159,13 +151,16 @@ network:
|
|||
sample: 101
|
||||
'''
|
||||
|
||||
from distutils.version import StrictVersion
|
||||
|
||||
try:
|
||||
import shade
|
||||
HAS_SHADE = True
|
||||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
||||
from distutils.version import StrictVersion
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec, openstack_module_kwargs
|
||||
|
||||
|
||||
def main():
|
||||
|
@ -250,8 +245,5 @@ def main():
|
|||
module.fail_json(msg=str(e))
|
||||
|
||||
|
||||
# this is magic, see lib/ansible/module_common.py
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.openstack import *
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -1,19 +1,11 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
@ -131,6 +123,9 @@ try:
|
|||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
|
@ -153,8 +148,6 @@ def main():
|
|||
except shade.OpenStackCloudException as e:
|
||||
module.fail_json(msg=str(e))
|
||||
|
||||
# this is magic, see lib/ansible/module_common.py
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.openstack import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -1,19 +1,11 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
@ -187,6 +179,9 @@ try:
|
|||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec, openstack_module_kwargs
|
||||
|
||||
|
||||
def _system_state_change(module, flavor):
|
||||
state = module.params['state']
|
||||
|
@ -282,8 +277,5 @@ def main():
|
|||
module.fail_json(msg=str(e))
|
||||
|
||||
|
||||
# this is magic, see lib/ansible/module_common.py
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.openstack import *
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -1,18 +1,10 @@
|
|||
#!/usr/bin/python
|
||||
# Copyright 2016 Jakub Jursa <jakub.jursa1@gmail.com>
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
@ -77,13 +69,16 @@ RETURN = '''
|
|||
|
||||
'''
|
||||
|
||||
from distutils.version import StrictVersion
|
||||
|
||||
try:
|
||||
import shade
|
||||
HAS_SHADE = True
|
||||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
||||
from distutils.version import StrictVersion
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec, openstack_module_kwargs
|
||||
|
||||
|
||||
def _needs_update(module, aggregate):
|
||||
|
@ -100,6 +95,7 @@ def _needs_update(module, aggregate):
|
|||
|
||||
return False
|
||||
|
||||
|
||||
def _system_state_change(module, aggregate):
|
||||
state = module.params['state']
|
||||
if state == 'absent' and aggregate:
|
||||
|
@ -112,6 +108,7 @@ def _system_state_change(module, aggregate):
|
|||
|
||||
return False
|
||||
|
||||
|
||||
def main():
|
||||
argument_spec = openstack_full_argument_spec(
|
||||
name=dict(required=True),
|
||||
|
@ -158,7 +155,7 @@ def main():
|
|||
if state == 'present':
|
||||
if aggregate is None:
|
||||
aggregate = cloud.create_aggregate(name=name,
|
||||
availability_zone=availability_zone)
|
||||
availability_zone=availability_zone)
|
||||
if hosts:
|
||||
for h in hosts:
|
||||
cloud.add_host_to_aggregate(aggregate.id, h)
|
||||
|
@ -168,8 +165,8 @@ def main():
|
|||
else:
|
||||
if _needs_update(module, aggregate):
|
||||
if availability_zone is not None:
|
||||
aggregate = cloud.update_aggregate(aggregate.id,
|
||||
name=name, availability_zone=availability_zone)
|
||||
aggregate = cloud.update_aggregate(aggregate.id, name=name,
|
||||
availability_zone=availability_zone)
|
||||
if metadata is not None:
|
||||
metas = metadata
|
||||
for i in (set(aggregate.metadata.keys()) - set(metadata.keys())):
|
||||
|
@ -177,7 +174,7 @@ def main():
|
|||
metas[i] = None
|
||||
cloud.set_aggregate_metadata(aggregate.id, metas)
|
||||
if hosts is not None:
|
||||
for i in (set(aggregate.hosts) - set (hosts)):
|
||||
for i in (set(aggregate.hosts) - set(hosts)):
|
||||
cloud.remove_host_from_aggregate(aggregate.id, i)
|
||||
for i in (set(hosts) - set(aggregate.hosts)):
|
||||
cloud.add_host_to_aggregate(aggregate.id, i)
|
||||
|
@ -188,17 +185,15 @@ def main():
|
|||
|
||||
elif state == 'absent':
|
||||
if aggregate is None:
|
||||
changed=False
|
||||
changed = False
|
||||
else:
|
||||
cloud.delete_aggregate(aggregate.id)
|
||||
changed=True
|
||||
changed = True
|
||||
module.exit_json(changed=changed)
|
||||
|
||||
except shade.OpenStackCloudException as e:
|
||||
module.fail_json(msg=str(e))
|
||||
|
||||
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.openstack import *
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -2,19 +2,11 @@
|
|||
|
||||
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
|
||||
# Copyright (c) 2013, Benno Joy <benno@ansible.com>
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
@ -83,6 +75,9 @@ try:
|
|||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec, openstack_module_kwargs
|
||||
|
||||
|
||||
def process_object(
|
||||
cloud_obj, container, name, filename, container_access, **kwargs):
|
||||
|
@ -105,10 +100,10 @@ def process_object(
|
|||
if name:
|
||||
if cloud_obj.get_object_metadata(container, name):
|
||||
cloud_obj.delete_object(container, name)
|
||||
changed= True
|
||||
changed = True
|
||||
else:
|
||||
cloud_obj.delete_container(container)
|
||||
changed= True
|
||||
changed = True
|
||||
return changed
|
||||
|
||||
|
||||
|
@ -135,9 +130,6 @@ def main():
|
|||
except shade.OpenStackCloudException as e:
|
||||
module.fail_json(msg=str(e))
|
||||
|
||||
# this is magic, see lib/ansible/module_common.py
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.openstack import *
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -1,19 +1,11 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
@ -215,6 +207,9 @@ try:
|
|||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec, openstack_module_kwargs
|
||||
|
||||
|
||||
def _needs_update(module, port, cloud):
|
||||
"""Check for differences in the updatable values.
|
||||
|
@ -392,8 +387,6 @@ def main():
|
|||
except shade.OpenStackCloudException as e:
|
||||
module.fail_json(msg=str(e))
|
||||
|
||||
# this is magic, see lib/ansible/module_common.py
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.openstack import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -1,19 +1,11 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# Copyright (c) 2016 IBM
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
@ -203,6 +195,9 @@ try:
|
|||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec, openstack_module_kwargs
|
||||
|
||||
|
||||
def main():
|
||||
argument_spec = openstack_full_argument_spec(
|
||||
|
@ -227,8 +222,6 @@ def main():
|
|||
except shade.OpenStackCloudException as e:
|
||||
module.fail_json(msg=str(e))
|
||||
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.openstack import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -1,18 +1,10 @@
|
|||
#!/usr/bin/python
|
||||
# Copyright (c) 2015 IBM Corporation
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
@ -110,13 +102,16 @@ project:
|
|||
sample: True
|
||||
'''
|
||||
|
||||
from distutils.version import StrictVersion
|
||||
|
||||
try:
|
||||
import shade
|
||||
HAS_SHADE = True
|
||||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
||||
from distutils.version import StrictVersion
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec, openstack_module_kwargs
|
||||
|
||||
|
||||
def _needs_update(module, project):
|
||||
|
@ -127,6 +122,7 @@ def _needs_update(module, project):
|
|||
|
||||
return False
|
||||
|
||||
|
||||
def _system_state_change(module, project):
|
||||
state = module.params['state']
|
||||
if state == 'present':
|
||||
|
@ -140,14 +136,14 @@ def _system_state_change(module, project):
|
|||
|
||||
elif state == 'absent':
|
||||
if project is None:
|
||||
changed=False
|
||||
changed = False
|
||||
else:
|
||||
changed=True
|
||||
changed = True
|
||||
|
||||
return changed
|
||||
|
||||
def main():
|
||||
|
||||
def main():
|
||||
argument_spec = openstack_full_argument_spec(
|
||||
name=dict(required=True),
|
||||
description=dict(required=False, default=None),
|
||||
|
@ -221,17 +217,15 @@ def main():
|
|||
|
||||
elif state == 'absent':
|
||||
if project is None:
|
||||
changed=False
|
||||
changed = False
|
||||
else:
|
||||
cloud.delete_project(project['id'])
|
||||
changed=True
|
||||
changed = True
|
||||
module.exit_json(changed=changed)
|
||||
|
||||
except shade.OpenStackCloudException as e:
|
||||
module.fail_json(msg=e.message, extra_data=e.extra_data)
|
||||
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.openstack import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -1,18 +1,10 @@
|
|||
#!/usr/bin/python
|
||||
# Copyright (c) 2016 Hewlett-Packard Enterprise Corporation
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
@ -121,6 +113,9 @@ try:
|
|||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
|
@ -168,8 +163,6 @@ def main():
|
|||
except shade.OpenStackCloudException as e:
|
||||
module.fail_json(msg=str(e))
|
||||
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.openstack import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -1,18 +1,9 @@
|
|||
#!/usr/bin/python
|
||||
# Copyright (c) 2016 Pason System Corporation
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
|
@ -300,8 +291,6 @@ openstack_quotas:
|
|||
|
||||
'''
|
||||
|
||||
import sys
|
||||
|
||||
try:
|
||||
import shade
|
||||
from keystoneauth1 import exceptions
|
||||
|
@ -309,6 +298,9 @@ try:
|
|||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec
|
||||
|
||||
|
||||
def _get_volume_quotas(cloud, project):
|
||||
|
||||
|
@ -489,7 +481,6 @@ def main():
|
|||
project_quota_output = _get_quotas(module, cloud, cloud_params['name'])
|
||||
changes_required = True
|
||||
|
||||
|
||||
elif module.params['state'] == "present":
|
||||
if module.check_mode:
|
||||
module.exit_json(changed=_system_state_change(module, project_quota_output))
|
||||
|
@ -520,7 +511,5 @@ def main():
|
|||
module.fail_json(msg=str(e), extra_data=e.extra_data)
|
||||
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -1,18 +1,10 @@
|
|||
#!/usr/bin/python
|
||||
# Copyright (c) 2016 Hewlett-Packard Enterprise
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
@ -135,13 +127,16 @@ recordset:
|
|||
sample: ['10.0.0.1']
|
||||
'''
|
||||
|
||||
from distutils.version import StrictVersion
|
||||
|
||||
try:
|
||||
import shade
|
||||
HAS_SHADE = True
|
||||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
||||
from distutils.version import StrictVersion
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec, openstack_module_kwargs
|
||||
|
||||
|
||||
def _system_state_change(state, records, description, ttl, zone, recordset):
|
||||
|
@ -158,6 +153,7 @@ def _system_state_change(state, records, description, ttl, zone, recordset):
|
|||
return True
|
||||
return False
|
||||
|
||||
|
||||
def main():
|
||||
argument_spec = openstack_full_argument_spec(
|
||||
zone=dict(required=True),
|
||||
|
@ -190,7 +186,7 @@ def main():
|
|||
try:
|
||||
cloud = shade.openstack_cloud(**module.params)
|
||||
recordset_type = module.params.get('recordset_type')
|
||||
recordset_filter = { 'type': recordset_type }
|
||||
recordset_filter = {'type': recordset_type}
|
||||
|
||||
recordsets = cloud.search_recordsets(zone, name_or_id=name + '.' + zone, filters=recordset_filter)
|
||||
|
||||
|
@ -245,18 +241,15 @@ def main():
|
|||
None, recordset))
|
||||
|
||||
if recordset is None:
|
||||
changed=False
|
||||
changed = False
|
||||
else:
|
||||
cloud.delete_recordset(zone, recordset_id)
|
||||
changed=True
|
||||
changed = True
|
||||
module.exit_json(changed=changed)
|
||||
|
||||
except shade.OpenStackCloudException as e:
|
||||
module.fail_json(msg=str(e))
|
||||
|
||||
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.openstack import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -1,17 +1,11 @@
|
|||
#!/usr/bin/python
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# Copyright: Ansible Project
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
@ -172,13 +166,17 @@ router:
|
|||
type: list
|
||||
'''
|
||||
|
||||
from distutils.version import StrictVersion
|
||||
|
||||
try:
|
||||
import shade
|
||||
HAS_SHADE = True
|
||||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
||||
from distutils.version import StrictVersion
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec, openstack_module_kwargs
|
||||
|
||||
|
||||
ROUTER_INTERFACE_OWNERS = set([
|
||||
'network:router_interface',
|
||||
|
@ -417,8 +415,5 @@ def main():
|
|||
module.fail_json(msg=str(e))
|
||||
|
||||
|
||||
# this is magic, see lib/ansible/module_common.py
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.openstack import *
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -2,19 +2,11 @@
|
|||
|
||||
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
|
||||
# Copyright (c) 2013, Benno Joy <benno@ansible.com>
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
@ -74,6 +66,9 @@ try:
|
|||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec, openstack_module_kwargs
|
||||
|
||||
|
||||
def _needs_update(module, secgroup):
|
||||
"""Check for differences in the updatable values.
|
||||
|
@ -144,9 +139,6 @@ def main():
|
|||
except shade.OpenStackCloudException as e:
|
||||
module.fail_json(msg=str(e))
|
||||
|
||||
# this is magic, see lib/ansible/module_common.py
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.openstack import *
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -2,19 +2,11 @@
|
|||
|
||||
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
|
||||
# Copyright (c) 2013, Benno Joy <benno@ansible.com>
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
@ -181,6 +173,9 @@ try:
|
|||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec, openstack_module_kwargs
|
||||
|
||||
|
||||
def _ports_match(protocol, module_min, module_max, rule_min, rule_max):
|
||||
"""
|
||||
|
@ -353,9 +348,6 @@ def main():
|
|||
except shade.OpenStackCloudException as e:
|
||||
module.fail_json(msg=str(e))
|
||||
|
||||
# this is magic, see lib/ansible/module_common.py
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.openstack import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -4,19 +4,11 @@
|
|||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
# Copyright (c) 2013, Benno Joy <benno@ansible.com>
|
||||
# Copyright (c) 2013, John Dewey <john@dewey.ws>
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
@ -422,6 +414,10 @@ try:
|
|||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import (openstack_find_nova_addresses,
|
||||
openstack_full_argument_spec, openstack_module_kwargs)
|
||||
|
||||
|
||||
def _exit_hostvars(module, cloud, server, changed=True):
|
||||
hostvars = meta.get_hostvars_from_server(cloud, server)
|
||||
|
@ -766,8 +762,6 @@ def main():
|
|||
except shade.OpenStackCloudException as e:
|
||||
module.fail_json(msg=str(e), extra_data=e.extra_data)
|
||||
|
||||
# this is magic, see lib/ansible/module_common.py
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.openstack import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -2,19 +2,11 @@
|
|||
# coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2015, Jesse Keating <jlk@derpops.bike>
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
@ -84,7 +76,6 @@ EXAMPLES = '''
|
|||
|
||||
try:
|
||||
import shade
|
||||
from shade import meta
|
||||
HAS_SHADE = True
|
||||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
@ -97,7 +88,7 @@ _action_map = {'stop': 'SHUTOFF',
|
|||
'start': 'ACTIVE',
|
||||
'pause': 'PAUSED',
|
||||
'unpause': 'ACTIVE',
|
||||
'lock': 'ACTIVE', # API doesn't show lock/unlock status
|
||||
'lock': 'ACTIVE', # API doesn't show lock/unlock status
|
||||
'unlock': 'ACTIVE',
|
||||
'suspend': 'SUSPENDED',
|
||||
'resume': 'ACTIVE',
|
||||
|
@ -105,6 +96,7 @@ _action_map = {'stop': 'SHUTOFF',
|
|||
|
||||
_admin_actions = ['pause', 'unpause', 'suspend', 'resume', 'lock', 'unlock']
|
||||
|
||||
|
||||
def _wait(timeout, cloud, server, action, module):
|
||||
"""Wait for the server to reach the desired state for the given action."""
|
||||
|
||||
|
@ -122,12 +114,14 @@ def _wait(timeout, cloud, server, action, module):
|
|||
if server.status == 'ERROR':
|
||||
module.fail_json(msg="Server reached ERROR state while attempting to %s" % action)
|
||||
|
||||
|
||||
def _system_state_change(action, status):
|
||||
"""Check if system state would change."""
|
||||
if status == _action_map[action]:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def main():
|
||||
argument_spec = openstack_full_argument_spec(
|
||||
server=dict(required=True),
|
||||
|
|
|
@ -1,19 +1,11 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
@ -67,11 +59,13 @@ import fnmatch
|
|||
|
||||
try:
|
||||
import shade
|
||||
from shade import meta
|
||||
HAS_SHADE = True
|
||||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec, openstack_module_kwargs
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
|
@ -101,8 +95,6 @@ def main():
|
|||
except shade.OpenStackCloudException as e:
|
||||
module.fail_json(msg=str(e))
|
||||
|
||||
# this is magic, see lib/ansible/module_common.py
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.openstack import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -1,19 +1,11 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# Copyright (c) 2016 Catalyst IT Limited
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
@ -118,6 +110,9 @@ try:
|
|||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec, openstack_module_kwargs
|
||||
|
||||
|
||||
def _system_state_change(state, server_group):
|
||||
if state == 'present' and not server_group:
|
||||
|
@ -182,9 +177,5 @@ def main():
|
|||
module.fail_json(msg=str(e), extra_data=e.extra_data)
|
||||
|
||||
|
||||
# this is magic, see lib/ansible/module_common.py
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.openstack import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -2,19 +2,11 @@
|
|||
#coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
@ -80,6 +72,9 @@ try:
|
|||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec, openstack_module_kwargs
|
||||
|
||||
|
||||
def _system_state_change(state, device):
|
||||
"""Check if system state would change."""
|
||||
|
@ -155,8 +150,6 @@ def main():
|
|||
except (shade.OpenStackCloudException, shade.OpenStackCloudTimeout) as e:
|
||||
module.fail_json(msg=str(e))
|
||||
|
||||
# this is magic, see lib/ansible/module_utils/common.py
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.openstack import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -3,19 +3,11 @@
|
|||
|
||||
# (c) 2016, Mathieu Bultel <mbultel@redhat.com>
|
||||
# (c) 2016, Steve Baker <sbaker@redhat.com>
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
@ -159,14 +151,17 @@ stack:
|
|||
'updated_time': null}"
|
||||
'''
|
||||
|
||||
from time import sleep
|
||||
from distutils.version import StrictVersion
|
||||
|
||||
try:
|
||||
import shade
|
||||
HAS_SHADE = True
|
||||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec, openstack_module_kwargs
|
||||
|
||||
|
||||
def _create_stack(module, stack, cloud):
|
||||
try:
|
||||
|
@ -271,7 +266,6 @@ def main():
|
|||
except shade.OpenStackCloudException as e:
|
||||
module.fail_json(msg=str(e))
|
||||
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.openstack import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -1,20 +1,12 @@
|
|||
#!/usr/bin/python
|
||||
#coding: utf-8 -*-
|
||||
# coding: utf-8 -*-
|
||||
|
||||
# (c) 2013, Benno Joy <benno@ansible.com>
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
@ -165,20 +157,21 @@ EXAMPLES = '''
|
|||
ipv6_address_mode: dhcpv6-stateless
|
||||
'''
|
||||
|
||||
from distutils.version import StrictVersion
|
||||
|
||||
try:
|
||||
import shade
|
||||
HAS_SHADE = True
|
||||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
||||
|
||||
from distutils.version import StrictVersion
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec, openstack_module_kwargs
|
||||
|
||||
|
||||
def _can_update(subnet, module, cloud):
|
||||
"""Check for differences in non-updatable values"""
|
||||
network_name = module.params['network_name']
|
||||
cidr = module.params['cidr']
|
||||
ip_version = int(module.params['ip_version'])
|
||||
ipv6_ra_mode = module.params['ipv6_ra_mode']
|
||||
ipv6_a_mode = module.params['ipv6_address_mode']
|
||||
|
@ -200,6 +193,7 @@ def _can_update(subnet, module, cloud):
|
|||
module.fail_json(msg='Cannot update ipv6_address_mode in existing \
|
||||
subnet')
|
||||
|
||||
|
||||
def _needs_update(subnet, module, cloud):
|
||||
"""Check for differences in the updatable values."""
|
||||
|
||||
|
@ -384,8 +378,5 @@ def main():
|
|||
module.fail_json(msg=str(e))
|
||||
|
||||
|
||||
# this is magic, see lib/ansible/module_common.py
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.openstack import *
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -1,19 +1,11 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
@ -144,6 +136,9 @@ try:
|
|||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
|
@ -159,15 +154,13 @@ def main():
|
|||
try:
|
||||
cloud = shade.openstack_cloud(**module.params)
|
||||
subnets = cloud.search_subnets(module.params['name'],
|
||||
module.params['filters'])
|
||||
module.params['filters'])
|
||||
module.exit_json(changed=False, ansible_facts=dict(
|
||||
openstack_subnets=subnets))
|
||||
|
||||
except shade.OpenStackCloudException as e:
|
||||
module.fail_json(msg=str(e))
|
||||
|
||||
# this is magic, see lib/ansible/module_common.py
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.openstack import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -1,18 +1,10 @@
|
|||
#!/usr/bin/python
|
||||
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
@ -145,13 +137,14 @@ user:
|
|||
type: string
|
||||
sample: "demouser"
|
||||
'''
|
||||
from distutils.version import StrictVersion
|
||||
|
||||
try:
|
||||
import shade
|
||||
HAS_SHADE = True
|
||||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
from distutils.version import StrictVersion
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec, openstack_module_kwargs
|
||||
|
||||
|
|
|
@ -1,18 +1,10 @@
|
|||
#!/usr/bin/python
|
||||
# Copyright (c) 2016 Hewlett-Packard Enterprise Corporation
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
@ -129,6 +121,9 @@ try:
|
|||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
|
@ -169,16 +164,13 @@ def main():
|
|||
|
||||
filters['domain_id'] = domain
|
||||
|
||||
users = opcloud.search_users(name,
|
||||
filters)
|
||||
users = opcloud.search_users(name, filters)
|
||||
module.exit_json(changed=False, ansible_facts=dict(
|
||||
openstack_users=users))
|
||||
|
||||
except shade.OpenStackCloudException as e:
|
||||
module.fail_json(msg=str(e))
|
||||
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.openstack import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -1,18 +1,10 @@
|
|||
#!/usr/bin/python
|
||||
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
@ -65,6 +57,9 @@ try:
|
|||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec, openstack_module_kwargs
|
||||
|
||||
|
||||
def _system_state_change(state, in_group):
|
||||
if state == 'present' and not in_group:
|
||||
|
@ -73,6 +68,7 @@ def _system_state_change(state, in_group):
|
|||
return True
|
||||
return False
|
||||
|
||||
|
||||
def main():
|
||||
argument_spec = openstack_full_argument_spec(
|
||||
user=dict(required=True),
|
||||
|
@ -109,7 +105,7 @@ def main():
|
|||
elif state == 'absent':
|
||||
if in_group:
|
||||
cloud.remove_user_from_group(user, group)
|
||||
changed=True
|
||||
changed = True
|
||||
|
||||
module.exit_json(changed=changed)
|
||||
|
||||
|
@ -117,8 +113,5 @@ def main():
|
|||
module.fail_json(msg=str(e), extra_data=e.extra_data)
|
||||
|
||||
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.openstack import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -1,18 +1,10 @@
|
|||
#!/usr/bin/python
|
||||
# Copyright (c) 2016 IBM
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
@ -94,13 +86,16 @@ RETURN = '''
|
|||
#
|
||||
'''
|
||||
|
||||
from distutils.version import StrictVersion
|
||||
|
||||
try:
|
||||
import shade
|
||||
HAS_SHADE = True
|
||||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
||||
from distutils.version import StrictVersion
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec, openstack_module_kwargs
|
||||
|
||||
|
||||
def _system_state_change(state, assignment):
|
||||
|
@ -205,7 +200,7 @@ def main():
|
|||
if assignment:
|
||||
kwargs = _build_kwargs(user, group, project, domain)
|
||||
cloud.revoke_role(role, **kwargs)
|
||||
changed=True
|
||||
changed = True
|
||||
|
||||
module.exit_json(changed=changed)
|
||||
|
||||
|
@ -213,8 +208,5 @@ def main():
|
|||
module.fail_json(msg=str(e))
|
||||
|
||||
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.openstack import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -1,19 +1,11 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
@ -101,6 +93,7 @@ EXAMPLES = '''
|
|||
scheduler_hints:
|
||||
same_host: 243e8d3c-8f47-4a61-93d6-7215c344b0c0
|
||||
'''
|
||||
from distutils.version import StrictVersion
|
||||
|
||||
try:
|
||||
import shade
|
||||
|
@ -108,7 +101,8 @@ try:
|
|||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
||||
from distutils.version import StrictVersion
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec, openstack_module_kwargs
|
||||
|
||||
|
||||
def _present_volume(module, cloud):
|
||||
|
@ -197,8 +191,6 @@ def main():
|
|||
except shade.OpenStackCloudException as e:
|
||||
module.fail_json(msg=str(e))
|
||||
|
||||
# this is magic, see lib/ansible/module_common.py
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.openstack import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -1,18 +1,10 @@
|
|||
#!/usr/bin/python
|
||||
# Copyright (c) 2016 Hewlett-Packard Enterprise
|
||||
#
|
||||
# This module is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This software is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
|
@ -134,13 +126,16 @@ zone:
|
|||
sample: []
|
||||
'''
|
||||
|
||||
from distutils.version import StrictVersion
|
||||
|
||||
try:
|
||||
import shade
|
||||
HAS_SHADE = True
|
||||
except ImportError:
|
||||
HAS_SHADE = False
|
||||
|
||||
from distutils.version import StrictVersion
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.openstack import openstack_full_argument_spec, openstack_module_kwargs
|
||||
|
||||
|
||||
def _system_state_change(state, email, description, ttl, masters, zone):
|
||||
|
@ -159,6 +154,7 @@ def _system_state_change(state, email, description, ttl, masters, zone):
|
|||
return True
|
||||
return False
|
||||
|
||||
|
||||
def main():
|
||||
argument_spec = openstack_full_argument_spec(
|
||||
name=dict(required=True),
|
||||
|
@ -188,7 +184,6 @@ def main():
|
|||
cloud = shade.openstack_cloud(**module.params)
|
||||
zone = cloud.get_zone(name)
|
||||
|
||||
|
||||
if state == 'present':
|
||||
zone_type = module.params.get('zone_type')
|
||||
email = module.params.get('email')
|
||||
|
@ -228,18 +223,15 @@ def main():
|
|||
None, zone))
|
||||
|
||||
if zone is None:
|
||||
changed=False
|
||||
changed = False
|
||||
else:
|
||||
cloud.delete_zone(name)
|
||||
changed=True
|
||||
changed = True
|
||||
module.exit_json(changed=changed)
|
||||
|
||||
except shade.OpenStackCloudException as e:
|
||||
module.fail_json(msg=str(e))
|
||||
|
||||
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.openstack import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -21,7 +21,6 @@ future2=$(find ./lib/ansible -path ./lib/ansible/modules -prune \
|
|||
# Eventually we want metaclass3 and future3 to get down to 0
|
||||
metaclass3=$(find ./lib/ansible/modules -path ./lib/ansible/modules/windows -prune \
|
||||
-o -path ./lib/ansible/modules/cloud/ovirt -prune \
|
||||
-o -path ./lib/ansible/modules/cloud/openstack -prune \
|
||||
-o -path ./lib/ansible/modules/cloud/cloudstack -prune \
|
||||
-o -path ./lib/ansible/modules/cloud/amazon -prune \
|
||||
-o -path ./lib/ansible/modules/network/aos -prune \
|
||||
|
@ -40,7 +39,6 @@ metaclass3=$(find ./lib/ansible/modules -path ./lib/ansible/modules/windows -pru
|
|||
|
||||
future3=$(find ./lib/ansible/modules -path ./lib/ansible/modules/windows -prune \
|
||||
-o -path ./lib/ansible/modules/cloud/ovirt -prune \
|
||||
-o -path ./lib/ansible/modules/cloud/openstack -prune \
|
||||
-o -path ./lib/ansible/modules/cloud/cloudstack -prune \
|
||||
-o -path ./lib/ansible/modules/cloud/amazon -prune \
|
||||
-o -path ./lib/ansible/modules/network/aos -prune \
|
||||
|
@ -64,7 +62,7 @@ future3=$(find ./lib/ansible/modules -path ./lib/ansible/modules/windows -prune
|
|||
|
||||
### TODO:
|
||||
### - module_utils <=== these are important but not well organized so we'd
|
||||
### have to construct the teset file by file
|
||||
### have to construct the test file by file
|
||||
### - contrib/ <=== Not a priority as these will move to inventory plugins over time
|
||||
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ wildcard_imports=$(find . -path ./test/runner/.tox -prune \
|
|||
-o -path ./lib/ansible/compat/tests/mock.py -prune \
|
||||
-o -path ./lib/ansible/compat/tests/unittest.py \
|
||||
-o -path ./test/units/modules/network/cumulus/test_nclu.py -prune \
|
||||
-o -path ./lib/ansible/modules/cloud/openstack -prune \
|
||||
-o -path ./lib/ansible/modules/cloud/cloudstack -prune \
|
||||
-o -path ./lib/ansible/modules/network/f5 -prune \
|
||||
-o -path ./lib/ansible/modules/network/nxos -prune \
|
||||
|
|
|
@ -98,30 +98,14 @@ lib/ansible/modules/cloud/misc/serverless.py
|
|||
lib/ansible/modules/cloud/misc/virt_net.py
|
||||
lib/ansible/modules/cloud/misc/virt_pool.py
|
||||
lib/ansible/modules/cloud/misc/xenserver_facts.py
|
||||
lib/ansible/modules/cloud/openstack/os_group.py
|
||||
lib/ansible/modules/cloud/openstack/os_image.py
|
||||
lib/ansible/modules/cloud/openstack/os_ironic.py
|
||||
lib/ansible/modules/cloud/openstack/os_keypair.py
|
||||
lib/ansible/modules/cloud/openstack/os_keystone_domain.py
|
||||
lib/ansible/modules/cloud/openstack/os_keystone_role.py
|
||||
lib/ansible/modules/cloud/openstack/os_keystone_service.py
|
||||
lib/ansible/modules/cloud/openstack/os_nova_flavor.py
|
||||
lib/ansible/modules/cloud/openstack/os_nova_host_aggregate.py
|
||||
lib/ansible/modules/cloud/openstack/os_object.py
|
||||
lib/ansible/modules/cloud/openstack/os_project.py
|
||||
lib/ansible/modules/cloud/openstack/os_quota.py
|
||||
lib/ansible/modules/cloud/openstack/os_recordset.py
|
||||
lib/ansible/modules/cloud/openstack/os_security_group_rule.py
|
||||
lib/ansible/modules/cloud/openstack/os_server.py
|
||||
lib/ansible/modules/cloud/openstack/os_server_action.py
|
||||
lib/ansible/modules/cloud/openstack/os_server_volume.py
|
||||
lib/ansible/modules/cloud/openstack/os_stack.py
|
||||
lib/ansible/modules/cloud/openstack/os_subnet.py
|
||||
lib/ansible/modules/cloud/openstack/os_subnets_facts.py
|
||||
lib/ansible/modules/cloud/openstack/os_user_facts.py
|
||||
lib/ansible/modules/cloud/openstack/os_user_group.py
|
||||
lib/ansible/modules/cloud/openstack/os_user_role.py
|
||||
lib/ansible/modules/cloud/openstack/os_zone.py
|
||||
lib/ansible/modules/cloud/ovh/ovh_ip_loadbalancing_backend.py
|
||||
lib/ansible/modules/cloud/ovirt/ovirt_affinity_group.py
|
||||
lib/ansible/modules/cloud/ovirt/ovirt_nics.py
|
||||
|
|
Loading…
Reference in a new issue