Scaleway: rename _facts -> _info (#61095)
* Rename scaleway _facts -> _info * Add changelog. * Improve docs.
This commit is contained in:
parent
185a1fcb07
commit
e176023c6b
32 changed files with 961 additions and 48 deletions
8
changelogs/fragments/61095-scaleway-facts-info.yaml
Normal file
8
changelogs/fragments/61095-scaleway-facts-info.yaml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
minor_changes:
|
||||||
|
- The ``scaleway_image_facts`` module has been deprecated. Use ``scaleway_image_info`` instead.
|
||||||
|
- The ``scaleway_ip_facts`` module has been deprecated. Use ``scaleway_ip_info`` instead.
|
||||||
|
- The ``scaleway_organization_facts`` module has been deprecated. Use ``scaleway_organization_info`` instead.
|
||||||
|
- The ``scaleway_security_group_facts`` module has been deprecated. Use ``scaleway_security_group_info`` instead.
|
||||||
|
- The ``scaleway_server_facts`` module has been deprecated. Use ``scaleway_server_info`` instead.
|
||||||
|
- The ``scaleway_snapshot_facts`` module has been deprecated. Use ``scaleway_snapshot_info`` instead.
|
||||||
|
- The ``scaleway_volume_facts`` module has been deprecated. Use ``scaleway_volume_info`` instead.
|
|
@ -124,6 +124,20 @@ The following modules will be removed in Ansible 2.13. Please update update your
|
||||||
|
|
||||||
* purefb_facts use :ref:`purefb_info <purefb_info_module>` instead.
|
* purefb_facts use :ref:`purefb_info <purefb_info_module>` instead.
|
||||||
|
|
||||||
|
* scaleway_image_facts use :ref:`scaleway_image_info <scaleway_image_info_module>` instead.
|
||||||
|
|
||||||
|
* scaleway_ip_facts use :ref:`scaleway_ip_info <scaleway_ip_info_module>` instead.
|
||||||
|
|
||||||
|
* scaleway_organization_facts use :ref:`scaleway_organization_info <scaleway_organization_info_module>` instead.
|
||||||
|
|
||||||
|
* scaleway_security_group_facts use :ref:`scaleway_security_group_info <scaleway_security_group_info_module>` instead.
|
||||||
|
|
||||||
|
* scaleway_server_facts use :ref:`scaleway_server_info <scaleway_server_info_module>` instead.
|
||||||
|
|
||||||
|
* scaleway_snapshot_facts use :ref:`scaleway_snapshot_info <scaleway_snapshot_info_module>` instead.
|
||||||
|
|
||||||
|
* scaleway_volume_facts use :ref:`scaleway_volume_info <scaleway_volume_info_module>` instead.
|
||||||
|
|
||||||
* vcenter_extension_facts use :ref:`vcenter_extension_info <vcenter_extension_info_module>` instead.
|
* vcenter_extension_facts use :ref:`vcenter_extension_info <vcenter_extension_info_module>` instead.
|
||||||
|
|
||||||
* vmware_about_facts use :ref:`vmware_about_info <vmware_about_info_module>` instead.
|
* vmware_about_facts use :ref:`vmware_about_info <vmware_about_info_module>` instead.
|
||||||
|
|
|
@ -8,12 +8,16 @@ from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||||
'status': ['preview'],
|
'status': ['deprecated'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
|
||||||
DOCUMENTATION = r'''
|
DOCUMENTATION = r'''
|
||||||
---
|
---
|
||||||
module: scaleway_image_facts
|
module: scaleway_image_facts
|
||||||
|
deprecated:
|
||||||
|
removed_in: '2.13'
|
||||||
|
why: Deprecated in favour of C(_info) module.
|
||||||
|
alternative: Use M(scaleway_image_info) instead.
|
||||||
short_description: Gather facts about the Scaleway images available.
|
short_description: Gather facts about the Scaleway images available.
|
||||||
description:
|
description:
|
||||||
- Gather facts about the Scaleway images available.
|
- Gather facts about the Scaleway images available.
|
|
@ -8,12 +8,16 @@ from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||||
'status': ['preview'],
|
'status': ['deprecated'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
|
||||||
DOCUMENTATION = r'''
|
DOCUMENTATION = r'''
|
||||||
---
|
---
|
||||||
module: scaleway_ip_facts
|
module: scaleway_ip_facts
|
||||||
|
deprecated:
|
||||||
|
removed_in: '2.13'
|
||||||
|
why: Deprecated in favour of C(_info) module.
|
||||||
|
alternative: Use M(scaleway_ip_info) instead.
|
||||||
short_description: Gather facts about the Scaleway ips available.
|
short_description: Gather facts about the Scaleway ips available.
|
||||||
description:
|
description:
|
||||||
- Gather facts about the Scaleway ips available.
|
- Gather facts about the Scaleway ips available.
|
|
@ -8,12 +8,16 @@ from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||||
'status': ['preview'],
|
'status': ['deprecated'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
|
||||||
DOCUMENTATION = r'''
|
DOCUMENTATION = r'''
|
||||||
---
|
---
|
||||||
module: scaleway_organization_facts
|
module: scaleway_organization_facts
|
||||||
|
deprecated:
|
||||||
|
removed_in: '2.13'
|
||||||
|
why: Deprecated in favour of C(_info) module.
|
||||||
|
alternative: Use M(scaleway_organization_info) instead.
|
||||||
short_description: Gather facts about the Scaleway organizations available.
|
short_description: Gather facts about the Scaleway organizations available.
|
||||||
description:
|
description:
|
||||||
- Gather facts about the Scaleway organizations available.
|
- Gather facts about the Scaleway organizations available.
|
|
@ -8,12 +8,16 @@ from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||||
'status': ['preview'],
|
'status': ['deprecated'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
|
||||||
DOCUMENTATION = r'''
|
DOCUMENTATION = r'''
|
||||||
---
|
---
|
||||||
module: scaleway_security_group_facts
|
module: scaleway_security_group_facts
|
||||||
|
deprecated:
|
||||||
|
removed_in: '2.13'
|
||||||
|
why: Deprecated in favour of C(_info) module.
|
||||||
|
alternative: Use M(scaleway_security_group_info) instead.
|
||||||
short_description: Gather facts about the Scaleway security groups available.
|
short_description: Gather facts about the Scaleway security groups available.
|
||||||
description:
|
description:
|
||||||
- Gather facts about the Scaleway security groups available.
|
- Gather facts about the Scaleway security groups available.
|
|
@ -8,12 +8,16 @@ from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||||
'status': ['preview'],
|
'status': ['deprecated'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
|
||||||
DOCUMENTATION = r'''
|
DOCUMENTATION = r'''
|
||||||
---
|
---
|
||||||
module: scaleway_server_facts
|
module: scaleway_server_facts
|
||||||
|
deprecated:
|
||||||
|
removed_in: '2.13'
|
||||||
|
why: Deprecated in favour of C(_info) module.
|
||||||
|
alternative: Use M(scaleway_server_info) instead.
|
||||||
short_description: Gather facts about the Scaleway servers available.
|
short_description: Gather facts about the Scaleway servers available.
|
||||||
description:
|
description:
|
||||||
- Gather facts about the Scaleway servers available.
|
- Gather facts about the Scaleway servers available.
|
|
@ -8,12 +8,16 @@ from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||||
'status': ['preview'],
|
'status': ['deprecated'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
|
||||||
DOCUMENTATION = r'''
|
DOCUMENTATION = r'''
|
||||||
---
|
---
|
||||||
module: scaleway_snapshot_facts
|
module: scaleway_snapshot_facts
|
||||||
|
deprecated:
|
||||||
|
removed_in: '2.13'
|
||||||
|
why: Deprecated in favour of C(_info) module.
|
||||||
|
alternative: Use M(scaleway_snapshot_info) instead.
|
||||||
short_description: Gather facts about the Scaleway snapshots available.
|
short_description: Gather facts about the Scaleway snapshots available.
|
||||||
description:
|
description:
|
||||||
- Gather facts about the Scaleway snapshot available.
|
- Gather facts about the Scaleway snapshot available.
|
|
@ -8,12 +8,16 @@ from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||||
'status': ['preview'],
|
'status': ['deprecated'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
|
||||||
DOCUMENTATION = r'''
|
DOCUMENTATION = r'''
|
||||||
---
|
---
|
||||||
module: scaleway_volume_facts
|
module: scaleway_volume_facts
|
||||||
|
deprecated:
|
||||||
|
removed_in: '2.13'
|
||||||
|
why: Deprecated in favour of C(_info) module.
|
||||||
|
alternative: Use M(scaleway_volume_info) instead.
|
||||||
short_description: Gather facts about the Scaleway volumes available.
|
short_description: Gather facts about the Scaleway volumes available.
|
||||||
description:
|
description:
|
||||||
- Gather facts about the Scaleway volumes available.
|
- Gather facts about the Scaleway volumes available.
|
124
lib/ansible/modules/cloud/scaleway/scaleway_image_info.py
Normal file
124
lib/ansible/modules/cloud/scaleway/scaleway_image_info.py
Normal file
|
@ -0,0 +1,124 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
|
# (c) 2018, Yanis Guenane <yanis+ansible@guenane.org>
|
||||||
|
# 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'}
|
||||||
|
|
||||||
|
DOCUMENTATION = r'''
|
||||||
|
---
|
||||||
|
module: scaleway_image_info
|
||||||
|
short_description: Gather information about the Scaleway images available.
|
||||||
|
description:
|
||||||
|
- Gather information about the Scaleway images available.
|
||||||
|
version_added: "2.9"
|
||||||
|
author:
|
||||||
|
- "Yanis Guenane (@Spredzy)"
|
||||||
|
- "Remy Leone (@sieben)"
|
||||||
|
extends_documentation_fragment: scaleway
|
||||||
|
|
||||||
|
options:
|
||||||
|
|
||||||
|
region:
|
||||||
|
description:
|
||||||
|
- Scaleway compute zone
|
||||||
|
required: true
|
||||||
|
choices:
|
||||||
|
- ams1
|
||||||
|
- EMEA-NL-EVS
|
||||||
|
- par1
|
||||||
|
- EMEA-FR-PAR1
|
||||||
|
'''
|
||||||
|
|
||||||
|
EXAMPLES = r'''
|
||||||
|
- name: Gather Scaleway images information
|
||||||
|
scaleway_image_info:
|
||||||
|
region: par1
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- debug:
|
||||||
|
msg: "{{ result.scaleway_image_info }}"
|
||||||
|
'''
|
||||||
|
|
||||||
|
RETURN = r'''
|
||||||
|
---
|
||||||
|
scaleway_image_info:
|
||||||
|
description: Response from Scaleway API
|
||||||
|
returned: success
|
||||||
|
type: complex
|
||||||
|
contains:
|
||||||
|
"scaleway_image_info": [
|
||||||
|
{
|
||||||
|
"arch": "x86_64",
|
||||||
|
"creation_date": "2018-07-17T16:18:49.276456+00:00",
|
||||||
|
"default_bootscript": {
|
||||||
|
"architecture": "x86_64",
|
||||||
|
"bootcmdargs": "LINUX_COMMON scaleway boot=local nbd.max_part=16",
|
||||||
|
"default": false,
|
||||||
|
"dtb": "",
|
||||||
|
"id": "15fbd2f7-a0f9-412b-8502-6a44da8d98b8",
|
||||||
|
"initrd": "http://169.254.42.24/initrd/initrd-Linux-x86_64-v3.14.5.gz",
|
||||||
|
"kernel": "http://169.254.42.24/kernel/x86_64-mainline-lts-4.9-4.9.93-rev1/vmlinuz-4.9.93",
|
||||||
|
"organization": "11111111-1111-4111-8111-111111111111",
|
||||||
|
"public": true,
|
||||||
|
"title": "x86_64 mainline 4.9.93 rev1"
|
||||||
|
},
|
||||||
|
"extra_volumes": [],
|
||||||
|
"from_server": null,
|
||||||
|
"id": "00ae4a88-3252-4eda-9feb-5f6b56bf5ef0",
|
||||||
|
"modification_date": "2018-07-17T16:42:06.319315+00:00",
|
||||||
|
"name": "Debian Stretch",
|
||||||
|
"organization": "51b656e3-4865-41e8-adbc-0c45bdd780db",
|
||||||
|
"public": true,
|
||||||
|
"root_volume": {
|
||||||
|
"id": "da32dfbb-c5ff-476d-ae2d-c297dd09b7dd",
|
||||||
|
"name": "snapshot-2a7229dc-d431-4dc5-b66e-95db08b773af-2018-07-17_16:18",
|
||||||
|
"size": 25000000000,
|
||||||
|
"volume_type": "l_ssd"
|
||||||
|
},
|
||||||
|
"state": "available"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
'''
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.scaleway import (
|
||||||
|
Scaleway, ScalewayException, scaleway_argument_spec, SCALEWAY_LOCATION)
|
||||||
|
|
||||||
|
|
||||||
|
class ScalewayImageInfo(Scaleway):
|
||||||
|
|
||||||
|
def __init__(self, module):
|
||||||
|
super(ScalewayImageInfo, self).__init__(module)
|
||||||
|
self.name = 'images'
|
||||||
|
|
||||||
|
region = module.params["region"]
|
||||||
|
self.module.params['api_url'] = SCALEWAY_LOCATION[region]["api_endpoint"]
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
argument_spec = scaleway_argument_spec()
|
||||||
|
argument_spec.update(dict(
|
||||||
|
region=dict(required=True, choices=SCALEWAY_LOCATION.keys()),
|
||||||
|
))
|
||||||
|
module = AnsibleModule(
|
||||||
|
argument_spec=argument_spec,
|
||||||
|
supports_check_mode=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
module.exit_json(
|
||||||
|
scaleway_image_info=ScalewayImageInfo(module).get_resources()
|
||||||
|
)
|
||||||
|
except ScalewayException as exc:
|
||||||
|
module.fail_json(msg=exc.message)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
106
lib/ansible/modules/cloud/scaleway/scaleway_ip_info.py
Normal file
106
lib/ansible/modules/cloud/scaleway/scaleway_ip_info.py
Normal file
|
@ -0,0 +1,106 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
|
# (c) 2018, Yanis Guenane <yanis+ansible@guenane.org>
|
||||||
|
# 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'}
|
||||||
|
|
||||||
|
DOCUMENTATION = r'''
|
||||||
|
---
|
||||||
|
module: scaleway_ip_info
|
||||||
|
short_description: Gather information about the Scaleway ips available.
|
||||||
|
description:
|
||||||
|
- Gather information about the Scaleway ips available.
|
||||||
|
version_added: "2.9"
|
||||||
|
author:
|
||||||
|
- "Yanis Guenane (@Spredzy)"
|
||||||
|
- "Remy Leone (@sieben)"
|
||||||
|
extends_documentation_fragment: scaleway
|
||||||
|
options:
|
||||||
|
region:
|
||||||
|
description:
|
||||||
|
- Scaleway region to use (for example C(par1)).
|
||||||
|
required: true
|
||||||
|
choices:
|
||||||
|
- ams1
|
||||||
|
- EMEA-NL-EVS
|
||||||
|
- par1
|
||||||
|
- EMEA-FR-PAR1
|
||||||
|
'''
|
||||||
|
|
||||||
|
EXAMPLES = r'''
|
||||||
|
- name: Gather Scaleway ips information
|
||||||
|
scaleway_ip_info:
|
||||||
|
region: par1
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- debug:
|
||||||
|
msg: "{{ result.scaleway_ip_info }}"
|
||||||
|
'''
|
||||||
|
|
||||||
|
RETURN = r'''
|
||||||
|
---
|
||||||
|
scaleway_ip_info:
|
||||||
|
description: Response from Scaleway API
|
||||||
|
returned: success
|
||||||
|
type: complex
|
||||||
|
contains:
|
||||||
|
"scaleway_ip_info": [
|
||||||
|
{
|
||||||
|
"address": "163.172.170.243",
|
||||||
|
"id": "ea081794-a581-8899-8451-386ddaf0a451",
|
||||||
|
"organization": "3f709602-5e6c-4619-b80c-e324324324af",
|
||||||
|
"reverse": null,
|
||||||
|
"server": {
|
||||||
|
"id": "12f19bc7-109c-4517-954c-e6b3d0311363",
|
||||||
|
"name": "scw-e0d158"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
'''
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.scaleway import (
|
||||||
|
Scaleway,
|
||||||
|
ScalewayException,
|
||||||
|
scaleway_argument_spec,
|
||||||
|
SCALEWAY_LOCATION,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class ScalewayIpInfo(Scaleway):
|
||||||
|
|
||||||
|
def __init__(self, module):
|
||||||
|
super(ScalewayIpInfo, self).__init__(module)
|
||||||
|
self.name = 'ips'
|
||||||
|
|
||||||
|
region = module.params["region"]
|
||||||
|
self.module.params['api_url'] = SCALEWAY_LOCATION[region]["api_endpoint"]
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
argument_spec = scaleway_argument_spec()
|
||||||
|
argument_spec.update(dict(
|
||||||
|
region=dict(required=True, choices=SCALEWAY_LOCATION.keys()),
|
||||||
|
))
|
||||||
|
module = AnsibleModule(
|
||||||
|
argument_spec=argument_spec,
|
||||||
|
supports_check_mode=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
module.exit_json(
|
||||||
|
scaleway_ip_info=ScalewayIpInfo(module).get_resources()
|
||||||
|
)
|
||||||
|
except ScalewayException as exc:
|
||||||
|
module.fail_json(msg=exc.message)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
107
lib/ansible/modules/cloud/scaleway/scaleway_organization_info.py
Normal file
107
lib/ansible/modules/cloud/scaleway/scaleway_organization_info.py
Normal file
|
@ -0,0 +1,107 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
|
# (c) 2018, Yanis Guenane <yanis+ansible@guenane.org>
|
||||||
|
# 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'}
|
||||||
|
|
||||||
|
DOCUMENTATION = r'''
|
||||||
|
---
|
||||||
|
module: scaleway_organization_info
|
||||||
|
short_description: Gather information about the Scaleway organizations available.
|
||||||
|
description:
|
||||||
|
- Gather information about the Scaleway organizations available.
|
||||||
|
version_added: "2.9"
|
||||||
|
author:
|
||||||
|
- "Yanis Guenane (@Spredzy)"
|
||||||
|
- "Remy Leone (@sieben)"
|
||||||
|
options:
|
||||||
|
api_url:
|
||||||
|
description:
|
||||||
|
- Scaleway API URL
|
||||||
|
default: 'https://account.scaleway.com'
|
||||||
|
aliases: ['base_url']
|
||||||
|
extends_documentation_fragment: scaleway
|
||||||
|
'''
|
||||||
|
|
||||||
|
EXAMPLES = r'''
|
||||||
|
- name: Gather Scaleway organizations information
|
||||||
|
scaleway_organization_info:
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- debug:
|
||||||
|
msg: "{{ result.scaleway_organization_info }}"
|
||||||
|
'''
|
||||||
|
|
||||||
|
RETURN = r'''
|
||||||
|
---
|
||||||
|
scaleway_organization_info:
|
||||||
|
description: Response from Scaleway API
|
||||||
|
returned: success
|
||||||
|
type: complex
|
||||||
|
contains:
|
||||||
|
"scaleway_organization_info": [
|
||||||
|
{
|
||||||
|
"address_city_name": "Paris",
|
||||||
|
"address_country_code": "FR",
|
||||||
|
"address_line1": "42 Rue de l'univers",
|
||||||
|
"address_line2": null,
|
||||||
|
"address_postal_code": "75042",
|
||||||
|
"address_subdivision_code": "FR-75",
|
||||||
|
"creation_date": "2018-08-06T13:43:28.508575+00:00",
|
||||||
|
"currency": "EUR",
|
||||||
|
"customer_class": "individual",
|
||||||
|
"id": "3f709602-5e6c-4619-b80c-e8432ferewtr",
|
||||||
|
"locale": "fr_FR",
|
||||||
|
"modification_date": "2018-08-06T14:56:41.401685+00:00",
|
||||||
|
"name": "James Bond",
|
||||||
|
"support_id": "694324",
|
||||||
|
"support_level": "basic",
|
||||||
|
"support_pin": "9324",
|
||||||
|
"users": [],
|
||||||
|
"vat_number": null,
|
||||||
|
"warnings": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
'''
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule, env_fallback
|
||||||
|
from ansible.module_utils.scaleway import (
|
||||||
|
Scaleway, ScalewayException, scaleway_argument_spec
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class ScalewayOrganizationInfo(Scaleway):
|
||||||
|
|
||||||
|
def __init__(self, module):
|
||||||
|
super(ScalewayOrganizationInfo, self).__init__(module)
|
||||||
|
self.name = 'organizations'
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
argument_spec = scaleway_argument_spec()
|
||||||
|
argument_spec.update(dict(
|
||||||
|
api_url=dict(fallback=(env_fallback, ['SCW_API_URL']), default='https://account.scaleway.com', aliases=['base_url']),
|
||||||
|
))
|
||||||
|
|
||||||
|
module = AnsibleModule(
|
||||||
|
argument_spec=argument_spec,
|
||||||
|
supports_check_mode=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
module.exit_json(
|
||||||
|
scaleway_organization_info=ScalewayOrganizationInfo(module).get_resources()
|
||||||
|
)
|
||||||
|
except ScalewayException as exc:
|
||||||
|
module.fail_json(msg=exc.message)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
|
@ -0,0 +1,110 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
|
# (c) 2018, Yanis Guenane <yanis+ansible@guenane.org>
|
||||||
|
# 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'}
|
||||||
|
|
||||||
|
DOCUMENTATION = r'''
|
||||||
|
---
|
||||||
|
module: scaleway_security_group_info
|
||||||
|
short_description: Gather information about the Scaleway security groups available.
|
||||||
|
description:
|
||||||
|
- Gather information about the Scaleway security groups available.
|
||||||
|
version_added: "2.9"
|
||||||
|
author:
|
||||||
|
- "Yanis Guenane (@Spredzy)"
|
||||||
|
- "Remy Leone (@sieben)"
|
||||||
|
options:
|
||||||
|
region:
|
||||||
|
description:
|
||||||
|
- Scaleway region to use (for example C(par1)).
|
||||||
|
required: true
|
||||||
|
choices:
|
||||||
|
- ams1
|
||||||
|
- EMEA-NL-EVS
|
||||||
|
- par1
|
||||||
|
- EMEA-FR-PAR1
|
||||||
|
extends_documentation_fragment: scaleway
|
||||||
|
'''
|
||||||
|
|
||||||
|
EXAMPLES = r'''
|
||||||
|
- name: Gather Scaleway security groups information
|
||||||
|
scaleway_security_group_info:
|
||||||
|
region: par1
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- debug:
|
||||||
|
msg: "{{ result.scaleway_security_group_info }}"
|
||||||
|
'''
|
||||||
|
|
||||||
|
RETURN = r'''
|
||||||
|
---
|
||||||
|
scaleway_security_group_info:
|
||||||
|
description: Response from Scaleway API
|
||||||
|
returned: success
|
||||||
|
type: complex
|
||||||
|
contains:
|
||||||
|
"scaleway_security_group_info": [
|
||||||
|
{
|
||||||
|
"description": "test-ams",
|
||||||
|
"enable_default_security": true,
|
||||||
|
"id": "7fcde327-8bed-43a6-95c4-6dfbc56d8b51",
|
||||||
|
"name": "test-ams",
|
||||||
|
"organization": "3f709602-5e6c-4619-b80c-e841c89734af",
|
||||||
|
"organization_default": false,
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"id": "12f19bc7-108c-4517-954c-e6b3d0311363",
|
||||||
|
"name": "scw-e0d158"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
'''
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.scaleway import (
|
||||||
|
Scaleway,
|
||||||
|
ScalewayException,
|
||||||
|
scaleway_argument_spec,
|
||||||
|
SCALEWAY_LOCATION,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class ScalewaySecurityGroupInfo(Scaleway):
|
||||||
|
|
||||||
|
def __init__(self, module):
|
||||||
|
super(ScalewaySecurityGroupInfo, self).__init__(module)
|
||||||
|
self.name = 'security_groups'
|
||||||
|
|
||||||
|
region = module.params["region"]
|
||||||
|
self.module.params['api_url'] = SCALEWAY_LOCATION[region]["api_endpoint"]
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
argument_spec = scaleway_argument_spec()
|
||||||
|
argument_spec.update(dict(
|
||||||
|
region=dict(required=True, choices=SCALEWAY_LOCATION.keys()),
|
||||||
|
))
|
||||||
|
module = AnsibleModule(
|
||||||
|
argument_spec=argument_spec,
|
||||||
|
supports_check_mode=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
module.exit_json(
|
||||||
|
scaleway_security_group_info=ScalewaySecurityGroupInfo(module).get_resources()
|
||||||
|
)
|
||||||
|
except ScalewayException as exc:
|
||||||
|
module.fail_json(msg=exc.message)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
193
lib/ansible/modules/cloud/scaleway/scaleway_server_info.py
Normal file
193
lib/ansible/modules/cloud/scaleway/scaleway_server_info.py
Normal file
|
@ -0,0 +1,193 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
|
# (c) 2018, Yanis Guenane <yanis+ansible@guenane.org>
|
||||||
|
# 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'}
|
||||||
|
|
||||||
|
DOCUMENTATION = r'''
|
||||||
|
---
|
||||||
|
module: scaleway_server_info
|
||||||
|
short_description: Gather information about the Scaleway servers available.
|
||||||
|
description:
|
||||||
|
- Gather information about the Scaleway servers available.
|
||||||
|
version_added: "2.9"
|
||||||
|
author:
|
||||||
|
- "Yanis Guenane (@Spredzy)"
|
||||||
|
- "Remy Leone (@sieben)"
|
||||||
|
extends_documentation_fragment: scaleway
|
||||||
|
options:
|
||||||
|
region:
|
||||||
|
description:
|
||||||
|
- Scaleway region to use (for example C(par1)).
|
||||||
|
required: true
|
||||||
|
choices:
|
||||||
|
- ams1
|
||||||
|
- EMEA-NL-EVS
|
||||||
|
- par1
|
||||||
|
- EMEA-FR-PAR1
|
||||||
|
'''
|
||||||
|
|
||||||
|
EXAMPLES = r'''
|
||||||
|
- name: Gather Scaleway servers information
|
||||||
|
scaleway_server_info:
|
||||||
|
region: par1
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- debug:
|
||||||
|
msg: "{{ result.scaleway_server_info }}"
|
||||||
|
'''
|
||||||
|
|
||||||
|
RETURN = r'''
|
||||||
|
---
|
||||||
|
scaleway_server_info:
|
||||||
|
description: Response from Scaleway API
|
||||||
|
returned: success
|
||||||
|
type: complex
|
||||||
|
contains:
|
||||||
|
"scaleway_server_info": [
|
||||||
|
{
|
||||||
|
"arch": "x86_64",
|
||||||
|
"boot_type": "local",
|
||||||
|
"bootscript": {
|
||||||
|
"architecture": "x86_64",
|
||||||
|
"bootcmdargs": "LINUX_COMMON scaleway boot=local nbd.max_part=16",
|
||||||
|
"default": true,
|
||||||
|
"dtb": "",
|
||||||
|
"id": "b1e68c26-a19c-4eac-9222-498b22bd7ad9",
|
||||||
|
"initrd": "http://169.254.42.24/initrd/initrd-Linux-x86_64-v3.14.5.gz",
|
||||||
|
"kernel": "http://169.254.42.24/kernel/x86_64-mainline-lts-4.4-4.4.127-rev1/vmlinuz-4.4.127",
|
||||||
|
"organization": "11111111-1111-4111-8111-111111111111",
|
||||||
|
"public": true,
|
||||||
|
"title": "x86_64 mainline 4.4.127 rev1"
|
||||||
|
},
|
||||||
|
"commercial_type": "START1-XS",
|
||||||
|
"creation_date": "2018-08-14T21:36:56.271545+00:00",
|
||||||
|
"dynamic_ip_required": false,
|
||||||
|
"enable_ipv6": false,
|
||||||
|
"extra_networks": [],
|
||||||
|
"hostname": "scw-e0d256",
|
||||||
|
"id": "12f19bc7-108c-4517-954c-e6b3d0311363",
|
||||||
|
"image": {
|
||||||
|
"arch": "x86_64",
|
||||||
|
"creation_date": "2018-04-26T12:42:21.619844+00:00",
|
||||||
|
"default_bootscript": {
|
||||||
|
"architecture": "x86_64",
|
||||||
|
"bootcmdargs": "LINUX_COMMON scaleway boot=local nbd.max_part=16",
|
||||||
|
"default": true,
|
||||||
|
"dtb": "",
|
||||||
|
"id": "b1e68c26-a19c-4eac-9222-498b22bd7ad9",
|
||||||
|
"initrd": "http://169.254.42.24/initrd/initrd-Linux-x86_64-v3.14.5.gz",
|
||||||
|
"kernel": "http://169.254.42.24/kernel/x86_64-mainline-lts-4.4-4.4.127-rev1/vmlinuz-4.4.127",
|
||||||
|
"organization": "11111111-1111-4111-8111-111111111111",
|
||||||
|
"public": true,
|
||||||
|
"title": "x86_64 mainline 4.4.127 rev1"
|
||||||
|
},
|
||||||
|
"extra_volumes": [],
|
||||||
|
"from_server": null,
|
||||||
|
"id": "67375eb1-f14d-4f02-bb42-6119cecbde51",
|
||||||
|
"modification_date": "2018-04-26T12:49:07.573004+00:00",
|
||||||
|
"name": "Ubuntu Xenial",
|
||||||
|
"organization": "51b656e3-4865-41e8-adbc-0c45bdd780db",
|
||||||
|
"public": true,
|
||||||
|
"root_volume": {
|
||||||
|
"id": "020b8d61-3867-4a0e-84a4-445c5393e05d",
|
||||||
|
"name": "snapshot-87fc282d-f252-4262-adad-86979d9074cf-2018-04-26_12:42",
|
||||||
|
"size": 25000000000,
|
||||||
|
"volume_type": "l_ssd"
|
||||||
|
},
|
||||||
|
"state": "available"
|
||||||
|
},
|
||||||
|
"ipv6": null,
|
||||||
|
"location": {
|
||||||
|
"cluster_id": "5",
|
||||||
|
"hypervisor_id": "412",
|
||||||
|
"node_id": "2",
|
||||||
|
"platform_id": "13",
|
||||||
|
"zone_id": "par1"
|
||||||
|
},
|
||||||
|
"maintenances": [],
|
||||||
|
"modification_date": "2018-08-14T21:37:28.630882+00:00",
|
||||||
|
"name": "scw-e0d256",
|
||||||
|
"organization": "3f709602-5e6c-4619-b80c-e841c89734af",
|
||||||
|
"private_ip": "10.14.222.131",
|
||||||
|
"protected": false,
|
||||||
|
"public_ip": {
|
||||||
|
"address": "163.172.170.197",
|
||||||
|
"dynamic": false,
|
||||||
|
"id": "ea081794-a581-4495-8451-386ddaf0a451"
|
||||||
|
},
|
||||||
|
"security_group": {
|
||||||
|
"id": "a37379d2-d8b0-4668-9cfb-1233fc436f7e",
|
||||||
|
"name": "Default security group"
|
||||||
|
},
|
||||||
|
"state": "running",
|
||||||
|
"state_detail": "booted",
|
||||||
|
"tags": [],
|
||||||
|
"volumes": {
|
||||||
|
"0": {
|
||||||
|
"creation_date": "2018-08-14T21:36:56.271545+00:00",
|
||||||
|
"export_uri": "device://dev/vda",
|
||||||
|
"id": "68386fae-4f55-4fbf-aabb-953036a85872",
|
||||||
|
"modification_date": "2018-08-14T21:36:56.271545+00:00",
|
||||||
|
"name": "snapshot-87fc282d-f252-4262-adad-86979d9074cf-2018-04-26_12:42",
|
||||||
|
"organization": "3f709602-5e6c-4619-b80c-e841c89734af",
|
||||||
|
"server": {
|
||||||
|
"id": "12f19bc7-108c-4517-954c-e6b3d0311363",
|
||||||
|
"name": "scw-e0d256"
|
||||||
|
},
|
||||||
|
"size": 25000000000,
|
||||||
|
"state": "available",
|
||||||
|
"volume_type": "l_ssd"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
'''
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.scaleway import (
|
||||||
|
Scaleway,
|
||||||
|
ScalewayException,
|
||||||
|
scaleway_argument_spec,
|
||||||
|
SCALEWAY_LOCATION,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class ScalewayServerInfo(Scaleway):
|
||||||
|
|
||||||
|
def __init__(self, module):
|
||||||
|
super(ScalewayServerInfo, self).__init__(module)
|
||||||
|
self.name = 'servers'
|
||||||
|
|
||||||
|
region = module.params["region"]
|
||||||
|
self.module.params['api_url'] = SCALEWAY_LOCATION[region]["api_endpoint"]
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
argument_spec = scaleway_argument_spec()
|
||||||
|
argument_spec.update(dict(
|
||||||
|
region=dict(required=True, choices=SCALEWAY_LOCATION.keys()),
|
||||||
|
))
|
||||||
|
|
||||||
|
module = AnsibleModule(
|
||||||
|
argument_spec=argument_spec,
|
||||||
|
supports_check_mode=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
module.exit_json(
|
||||||
|
scaleway_server_info=ScalewayServerInfo(module).get_resources()
|
||||||
|
)
|
||||||
|
except ScalewayException as exc:
|
||||||
|
module.fail_json(msg=exc.message)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
111
lib/ansible/modules/cloud/scaleway/scaleway_snapshot_info.py
Normal file
111
lib/ansible/modules/cloud/scaleway/scaleway_snapshot_info.py
Normal file
|
@ -0,0 +1,111 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
|
# (c) 2018, Yanis Guenane <yanis+ansible@guenane.org>
|
||||||
|
# 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'}
|
||||||
|
|
||||||
|
DOCUMENTATION = r'''
|
||||||
|
---
|
||||||
|
module: scaleway_snapshot_info
|
||||||
|
short_description: Gather information about the Scaleway snapshots available.
|
||||||
|
description:
|
||||||
|
- Gather information about the Scaleway snapshot available.
|
||||||
|
version_added: "2.9"
|
||||||
|
author:
|
||||||
|
- "Yanis Guenane (@Spredzy)"
|
||||||
|
- "Remy Leone (@sieben)"
|
||||||
|
extends_documentation_fragment: scaleway
|
||||||
|
options:
|
||||||
|
region:
|
||||||
|
description:
|
||||||
|
- Scaleway region to use (for example C(par1)).
|
||||||
|
required: true
|
||||||
|
choices:
|
||||||
|
- ams1
|
||||||
|
- EMEA-NL-EVS
|
||||||
|
- par1
|
||||||
|
- EMEA-FR-PAR1
|
||||||
|
'''
|
||||||
|
|
||||||
|
EXAMPLES = r'''
|
||||||
|
- name: Gather Scaleway snapshots information
|
||||||
|
scaleway_snapshot_info:
|
||||||
|
region: par1
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- debug:
|
||||||
|
msg: "{{ result.scaleway_snapshot_info }}"
|
||||||
|
'''
|
||||||
|
|
||||||
|
RETURN = r'''
|
||||||
|
---
|
||||||
|
scaleway_snapshot_info:
|
||||||
|
description: Response from Scaleway API
|
||||||
|
returned: success
|
||||||
|
type: complex
|
||||||
|
contains:
|
||||||
|
"scaleway_snapshot_info": [
|
||||||
|
{
|
||||||
|
"base_volume": {
|
||||||
|
"id": "68386fae-4f55-4fbf-aabb-953036a85872",
|
||||||
|
"name": "snapshot-87fc282d-f252-4262-adad-86979d9074cf-2018-04-26_12:42"
|
||||||
|
},
|
||||||
|
"creation_date": "2018-08-14T22:34:35.299461+00:00",
|
||||||
|
"id": "b61b4b03-a2e9-4da5-b5ea-e462ac0662d2",
|
||||||
|
"modification_date": "2018-08-14T22:34:54.520560+00:00",
|
||||||
|
"name": "snapshot-87fc282d-f252-4262-adad-86979d9074cf-2018-04-26_12:42 snapshot",
|
||||||
|
"organization": "3f709602-5e6c-4619-b80c-e841c89734af",
|
||||||
|
"size": 25000000000,
|
||||||
|
"state": "available",
|
||||||
|
"volume_type": "l_ssd"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
'''
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.scaleway import (
|
||||||
|
Scaleway,
|
||||||
|
ScalewayException,
|
||||||
|
scaleway_argument_spec,
|
||||||
|
SCALEWAY_LOCATION
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class ScalewaySnapshotInfo(Scaleway):
|
||||||
|
|
||||||
|
def __init__(self, module):
|
||||||
|
super(ScalewaySnapshotInfo, self).__init__(module)
|
||||||
|
self.name = 'snapshots'
|
||||||
|
|
||||||
|
region = module.params["region"]
|
||||||
|
self.module.params['api_url'] = SCALEWAY_LOCATION[region]["api_endpoint"]
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
argument_spec = scaleway_argument_spec()
|
||||||
|
argument_spec.update(dict(
|
||||||
|
region=dict(required=True, choices=SCALEWAY_LOCATION.keys()),
|
||||||
|
))
|
||||||
|
|
||||||
|
module = AnsibleModule(
|
||||||
|
argument_spec=argument_spec,
|
||||||
|
supports_check_mode=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
module.exit_json(
|
||||||
|
scaleway_snapshot_info=ScalewaySnapshotInfo(module).get_resources()
|
||||||
|
)
|
||||||
|
except ScalewayException as exc:
|
||||||
|
module.fail_json(msg=exc.message)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
106
lib/ansible/modules/cloud/scaleway/scaleway_volume_info.py
Normal file
106
lib/ansible/modules/cloud/scaleway/scaleway_volume_info.py
Normal file
|
@ -0,0 +1,106 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
|
# (c) 2018, Yanis Guenane <yanis+ansible@guenane.org>
|
||||||
|
# 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'}
|
||||||
|
|
||||||
|
DOCUMENTATION = r'''
|
||||||
|
---
|
||||||
|
module: scaleway_volume_info
|
||||||
|
short_description: Gather information about the Scaleway volumes available.
|
||||||
|
description:
|
||||||
|
- Gather information about the Scaleway volumes available.
|
||||||
|
version_added: "2.9"
|
||||||
|
author:
|
||||||
|
- "Yanis Guenane (@Spredzy)"
|
||||||
|
- "Remy Leone (@sieben)"
|
||||||
|
extends_documentation_fragment: scaleway
|
||||||
|
options:
|
||||||
|
region:
|
||||||
|
description:
|
||||||
|
- Scaleway region to use (for example C(par1)).
|
||||||
|
required: true
|
||||||
|
choices:
|
||||||
|
- ams1
|
||||||
|
- EMEA-NL-EVS
|
||||||
|
- par1
|
||||||
|
- EMEA-FR-PAR1
|
||||||
|
'''
|
||||||
|
|
||||||
|
EXAMPLES = r'''
|
||||||
|
- name: Gather Scaleway volumes information
|
||||||
|
scaleway_volume_info:
|
||||||
|
region: par1
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- debug:
|
||||||
|
msg: "{{ result.scaleway_volume_info }}"
|
||||||
|
'''
|
||||||
|
|
||||||
|
RETURN = r'''
|
||||||
|
---
|
||||||
|
scaleway_volume_info:
|
||||||
|
description: Response from Scaleway API
|
||||||
|
returned: success
|
||||||
|
type: complex
|
||||||
|
contains:
|
||||||
|
"scaleway_volume_info": [
|
||||||
|
{
|
||||||
|
"creation_date": "2018-08-14T20:56:24.949660+00:00",
|
||||||
|
"export_uri": null,
|
||||||
|
"id": "b8d51a06-daeb-4fef-9539-a8aea016c1ba",
|
||||||
|
"modification_date": "2018-08-14T20:56:24.949660+00:00",
|
||||||
|
"name": "test-volume",
|
||||||
|
"organization": "3f709602-5e6c-4619-b80c-e841c89734af",
|
||||||
|
"server": null,
|
||||||
|
"size": 50000000000,
|
||||||
|
"state": "available",
|
||||||
|
"volume_type": "l_ssd"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
'''
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from ansible.module_utils.scaleway import (
|
||||||
|
Scaleway, ScalewayException, scaleway_argument_spec,
|
||||||
|
SCALEWAY_LOCATION)
|
||||||
|
|
||||||
|
|
||||||
|
class ScalewayVolumeInfo(Scaleway):
|
||||||
|
|
||||||
|
def __init__(self, module):
|
||||||
|
super(ScalewayVolumeInfo, self).__init__(module)
|
||||||
|
self.name = 'volumes'
|
||||||
|
|
||||||
|
region = module.params["region"]
|
||||||
|
self.module.params['api_url'] = SCALEWAY_LOCATION[region]["api_endpoint"]
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
argument_spec = scaleway_argument_spec()
|
||||||
|
argument_spec.update(dict(
|
||||||
|
region=dict(required=True, choices=SCALEWAY_LOCATION.keys()),
|
||||||
|
))
|
||||||
|
|
||||||
|
module = AnsibleModule(
|
||||||
|
argument_spec=argument_spec,
|
||||||
|
supports_check_mode=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
module.exit_json(
|
||||||
|
scaleway_volume_info=ScalewayVolumeInfo(module).get_resources()
|
||||||
|
)
|
||||||
|
except ScalewayException as exc:
|
||||||
|
module.fail_json(msg=exc.message)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
|
@ -19,7 +19,7 @@
|
||||||
wait: true
|
wait: true
|
||||||
|
|
||||||
- name: Get server informations of the first page
|
- name: Get server informations of the first page
|
||||||
scaleway_server_facts:
|
scaleway_server_info:
|
||||||
region: par1
|
region: par1
|
||||||
query_parameters:
|
query_parameters:
|
||||||
per_page: 1
|
per_page: 1
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
- first_page is success
|
- first_page is success
|
||||||
|
|
||||||
- name: Get server informations of the second page
|
- name: Get server informations of the second page
|
||||||
scaleway_server_facts:
|
scaleway_server_info:
|
||||||
region: par1
|
region: par1
|
||||||
query_parameters:
|
query_parameters:
|
||||||
per_page: 1
|
per_page: 1
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- first_page.ansible_facts.scaleway_server_facts[0].id != second_page.ansible_facts.scaleway_server_facts[0].id
|
- first_page.scaleway_server_info[0].id != second_page.scaleway_server_info[0].id
|
||||||
|
|
||||||
- name: Delete first server
|
- name: Delete first server
|
||||||
scaleway_compute:
|
scaleway_compute:
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# SCW_API_KEY='XXX' ansible-playbook ./test/legacy/scaleway.yml --tags test_scaleway_image_facts
|
# SCW_API_KEY='XXX' ansible-playbook ./test/legacy/scaleway.yml --tags test_scaleway_image_info
|
||||||
|
|
||||||
|
|
||||||
- name: Get image informations and register it in a variable
|
- name: Get image informations and register it in a variable
|
||||||
scaleway_image_facts:
|
scaleway_image_info:
|
||||||
region: par1
|
region: par1
|
||||||
register: images
|
register: images
|
||||||
|
|
||||||
|
@ -10,13 +10,13 @@
|
||||||
debug:
|
debug:
|
||||||
var: images
|
var: images
|
||||||
|
|
||||||
- name: Ensure retrieval of images facts is success
|
- name: Ensure retrieval of images info is success
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- images is success
|
- images is success
|
||||||
|
|
||||||
- name: Get image informations from ams1 and register it in a variable
|
- name: Get image informations from ams1 and register it in a variable
|
||||||
scaleway_image_facts:
|
scaleway_image_info:
|
||||||
region: ams1
|
region: ams1
|
||||||
register: images_ams1
|
register: images_ams1
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
debug:
|
debug:
|
||||||
var: images_ams1
|
var: images_ams1
|
||||||
|
|
||||||
- name: Ensure retrieval of images facts is success
|
- name: Ensure retrieval of images info is success
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- images_ams1 is success
|
- images_ams1 is success
|
|
@ -1,7 +1,7 @@
|
||||||
# SCW_API_KEY='XXX' ansible-playbook ./test/legacy/scaleway.yml --tags test_scaleway_ip_facts
|
# SCW_API_KEY='XXX' ansible-playbook ./test/legacy/scaleway.yml --tags test_scaleway_ip_info
|
||||||
|
|
||||||
- name: Get ip informations and register it in a variable
|
- name: Get ip informations and register it in a variable
|
||||||
scaleway_ip_facts:
|
scaleway_ip_info:
|
||||||
region: par1
|
region: par1
|
||||||
register: ips
|
register: ips
|
||||||
|
|
||||||
|
@ -9,13 +9,13 @@
|
||||||
debug:
|
debug:
|
||||||
var: ips
|
var: ips
|
||||||
|
|
||||||
- name: Ensure retrieval of ips facts is success
|
- name: Ensure retrieval of ips info is success
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- ips is success
|
- ips is success
|
||||||
|
|
||||||
- name: Get ip informations and register it in a variable
|
- name: Get ip informations and register it in a variable
|
||||||
scaleway_ip_facts:
|
scaleway_ip_info:
|
||||||
region: ams1
|
region: ams1
|
||||||
register: ips_ams1
|
register: ips_ams1
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
debug:
|
debug:
|
||||||
var: ips_ams1
|
var: ips_ams1
|
||||||
|
|
||||||
- name: Ensure retrieval of ips facts is success
|
- name: Ensure retrieval of ips info is success
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- ips_ams1 is success
|
- ips_ams1 is success
|
|
@ -1,12 +1,12 @@
|
||||||
- name: Get organization informations and register it in a variable
|
- name: Get organization informations and register it in a variable
|
||||||
scaleway_organization_facts:
|
scaleway_organization_info:
|
||||||
register: organizations
|
register: organizations
|
||||||
|
|
||||||
- name: Display organizations variable
|
- name: Display organizations variable
|
||||||
debug:
|
debug:
|
||||||
var: organizations
|
var: organizations
|
||||||
|
|
||||||
- name: Ensure retrieval of organizations facts is success
|
- name: Ensure retrieval of organizations info is success
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- organizations is success
|
- organizations is success
|
|
@ -1,7 +1,7 @@
|
||||||
# SCW_API_KEY='XXX' ansible-playbook ./test/legacy/scaleway.yml --tags test_scaleway_security_group_facts
|
# SCW_API_KEY='XXX' ansible-playbook ./test/legacy/scaleway.yml --tags test_scaleway_security_group_info
|
||||||
|
|
||||||
- name: Get security group informations and register it in a variable
|
- name: Get security group informations and register it in a variable
|
||||||
scaleway_security_group_facts:
|
scaleway_security_group_info:
|
||||||
region: par1
|
region: par1
|
||||||
register: security_groups
|
register: security_groups
|
||||||
|
|
||||||
|
@ -9,13 +9,13 @@
|
||||||
debug:
|
debug:
|
||||||
var: security_groups
|
var: security_groups
|
||||||
|
|
||||||
- name: Ensure retrieval of security groups facts is success
|
- name: Ensure retrieval of security groups info is success
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- security_groups is success
|
- security_groups is success
|
||||||
|
|
||||||
- name: Get security group informations and register it in a variable (AMS1)
|
- name: Get security group informations and register it in a variable (AMS1)
|
||||||
scaleway_security_group_facts:
|
scaleway_security_group_info:
|
||||||
region: ams1
|
region: ams1
|
||||||
register: ams1_security_groups
|
register: ams1_security_groups
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
debug:
|
debug:
|
||||||
var: ams1_security_groups
|
var: ams1_security_groups
|
||||||
|
|
||||||
- name: Ensure retrieval of security groups facts is success (AMS1)
|
- name: Ensure retrieval of security groups info is success (AMS1)
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- ams1_security_groups is success
|
- ams1_security_groups is success
|
|
@ -1,7 +1,7 @@
|
||||||
# SCW_API_KEY='XXX' ansible-playbook ./test/legacy/scaleway.yml --tags test_scaleway_server_facts
|
# SCW_API_KEY='XXX' ansible-playbook ./test/legacy/scaleway.yml --tags test_scaleway_server_info
|
||||||
|
|
||||||
- name: Get server informations and register it in a variable
|
- name: Get server informations and register it in a variable
|
||||||
scaleway_server_facts:
|
scaleway_server_info:
|
||||||
region: par1
|
region: par1
|
||||||
register: servers
|
register: servers
|
||||||
|
|
||||||
|
@ -9,13 +9,13 @@
|
||||||
debug:
|
debug:
|
||||||
var: servers
|
var: servers
|
||||||
|
|
||||||
- name: Ensure retrieval of servers facts is success
|
- name: Ensure retrieval of servers info is success
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- servers is success
|
- servers is success
|
||||||
|
|
||||||
- name: Get server informations and register it in a variable
|
- name: Get server informations and register it in a variable
|
||||||
scaleway_server_facts:
|
scaleway_server_info:
|
||||||
region: ams1
|
region: ams1
|
||||||
register: ams1_servers
|
register: ams1_servers
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
debug:
|
debug:
|
||||||
var: ams1_servers
|
var: ams1_servers
|
||||||
|
|
||||||
- name: Ensure retrieval of servers facts is success
|
- name: Ensure retrieval of servers info is success
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- ams1_servers is success
|
- ams1_servers is success
|
|
@ -1,7 +1,7 @@
|
||||||
# SCW_API_KEY='XXX' ansible-playbook ./test/legacy/scaleway.yml --tags test_scaleway_snapshot_facts
|
# SCW_API_KEY='XXX' ansible-playbook ./test/legacy/scaleway.yml --tags test_scaleway_snapshot_info
|
||||||
|
|
||||||
- name: Get snapshot informations and register it in a variable
|
- name: Get snapshot informations and register it in a variable
|
||||||
scaleway_snapshot_facts:
|
scaleway_snapshot_info:
|
||||||
region: par1
|
region: par1
|
||||||
register: snapshots
|
register: snapshots
|
||||||
|
|
||||||
|
@ -9,13 +9,13 @@
|
||||||
debug:
|
debug:
|
||||||
var: snapshots
|
var: snapshots
|
||||||
|
|
||||||
- name: Ensure retrieval of snapshots facts is success
|
- name: Ensure retrieval of snapshots info is success
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- snapshots is success
|
- snapshots is success
|
||||||
|
|
||||||
- name: Get snapshot informations and register it in a variable (AMS1)
|
- name: Get snapshot informations and register it in a variable (AMS1)
|
||||||
scaleway_snapshot_facts:
|
scaleway_snapshot_info:
|
||||||
region: ams1
|
region: ams1
|
||||||
register: ams1_snapshots
|
register: ams1_snapshots
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
debug:
|
debug:
|
||||||
var: ams1_snapshots
|
var: ams1_snapshots
|
||||||
|
|
||||||
- name: Ensure retrieval of snapshots facts is success (AMS1)
|
- name: Ensure retrieval of snapshots info is success (AMS1)
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- ams1_snapshots is success
|
- ams1_snapshots is success
|
|
@ -1,7 +1,7 @@
|
||||||
# SCW_API_KEY='XXX' ansible-playbook ./test/legacy/scaleway.yml --tags test_scaleway_volume_facts
|
# SCW_API_KEY='XXX' ansible-playbook ./test/legacy/scaleway.yml --tags test_scaleway_volume_info
|
||||||
|
|
||||||
- name: Get volume informations and register it in a variable
|
- name: Get volume informations and register it in a variable
|
||||||
scaleway_volume_facts:
|
scaleway_volume_info:
|
||||||
region: par1
|
region: par1
|
||||||
register: volumes
|
register: volumes
|
||||||
|
|
||||||
|
@ -9,13 +9,13 @@
|
||||||
debug:
|
debug:
|
||||||
var: volumes
|
var: volumes
|
||||||
|
|
||||||
- name: Ensure retrieval of volumes facts is success
|
- name: Ensure retrieval of volumes info is success
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- volumes is success
|
- volumes is success
|
||||||
|
|
||||||
- name: Get volume informations and register it in a variable (AMS1)
|
- name: Get volume informations and register it in a variable (AMS1)
|
||||||
scaleway_volume_facts:
|
scaleway_volume_info:
|
||||||
region: ams1
|
region: ams1
|
||||||
register: ams1_volumes
|
register: ams1_volumes
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
debug:
|
debug:
|
||||||
var: ams1_volumes
|
var: ams1_volumes
|
||||||
|
|
||||||
- name: Ensure retrieval of volumes facts is success
|
- name: Ensure retrieval of volumes info is success
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- ams1_volumes is success
|
- ams1_volumes is success
|
|
@ -2022,21 +2022,27 @@ lib/ansible/modules/cloud/rackspace/rax_scaling_policy.py validate-modules:E337
|
||||||
lib/ansible/modules/cloud/rackspace/rax_scaling_policy.py validate-modules:E338
|
lib/ansible/modules/cloud/rackspace/rax_scaling_policy.py validate-modules:E338
|
||||||
lib/ansible/modules/cloud/scaleway/scaleway_compute.py validate-modules:E337
|
lib/ansible/modules/cloud/scaleway/scaleway_compute.py validate-modules:E337
|
||||||
lib/ansible/modules/cloud/scaleway/scaleway_compute.py validate-modules:E338
|
lib/ansible/modules/cloud/scaleway/scaleway_compute.py validate-modules:E338
|
||||||
lib/ansible/modules/cloud/scaleway/scaleway_image_facts.py validate-modules:E338
|
lib/ansible/modules/cloud/scaleway/_scaleway_image_facts.py validate-modules:E338
|
||||||
|
lib/ansible/modules/cloud/scaleway/scaleway_image_info.py validate-modules:E338
|
||||||
lib/ansible/modules/cloud/scaleway/scaleway_ip.py validate-modules:E338
|
lib/ansible/modules/cloud/scaleway/scaleway_ip.py validate-modules:E338
|
||||||
lib/ansible/modules/cloud/scaleway/scaleway_ip_facts.py validate-modules:E338
|
lib/ansible/modules/cloud/scaleway/_scaleway_ip_facts.py validate-modules:E338
|
||||||
|
lib/ansible/modules/cloud/scaleway/scaleway_ip_info.py validate-modules:E338
|
||||||
lib/ansible/modules/cloud/scaleway/scaleway_lb.py validate-modules:E337
|
lib/ansible/modules/cloud/scaleway/scaleway_lb.py validate-modules:E337
|
||||||
lib/ansible/modules/cloud/scaleway/scaleway_lb.py validate-modules:E338
|
lib/ansible/modules/cloud/scaleway/scaleway_lb.py validate-modules:E338
|
||||||
lib/ansible/modules/cloud/scaleway/scaleway_security_group_facts.py validate-modules:E338
|
lib/ansible/modules/cloud/scaleway/_scaleway_security_group_facts.py validate-modules:E338
|
||||||
|
lib/ansible/modules/cloud/scaleway/scaleway_security_group_info.py validate-modules:E338
|
||||||
lib/ansible/modules/cloud/scaleway/scaleway_security_group_rule.py validate-modules:E337
|
lib/ansible/modules/cloud/scaleway/scaleway_security_group_rule.py validate-modules:E337
|
||||||
lib/ansible/modules/cloud/scaleway/scaleway_server_facts.py validate-modules:E338
|
lib/ansible/modules/cloud/scaleway/_scaleway_server_facts.py validate-modules:E338
|
||||||
lib/ansible/modules/cloud/scaleway/scaleway_snapshot_facts.py validate-modules:E338
|
lib/ansible/modules/cloud/scaleway/scaleway_server_info.py validate-modules:E338
|
||||||
|
lib/ansible/modules/cloud/scaleway/_scaleway_snapshot_facts.py validate-modules:E338
|
||||||
|
lib/ansible/modules/cloud/scaleway/scaleway_snapshot_info.py validate-modules:E338
|
||||||
lib/ansible/modules/cloud/scaleway/scaleway_sshkey.py validate-modules:E338
|
lib/ansible/modules/cloud/scaleway/scaleway_sshkey.py validate-modules:E338
|
||||||
lib/ansible/modules/cloud/scaleway/scaleway_user_data.py validate-modules:E337
|
lib/ansible/modules/cloud/scaleway/scaleway_user_data.py validate-modules:E337
|
||||||
lib/ansible/modules/cloud/scaleway/scaleway_user_data.py validate-modules:E338
|
lib/ansible/modules/cloud/scaleway/scaleway_user_data.py validate-modules:E338
|
||||||
lib/ansible/modules/cloud/scaleway/scaleway_volume.py validate-modules:E337
|
lib/ansible/modules/cloud/scaleway/scaleway_volume.py validate-modules:E337
|
||||||
lib/ansible/modules/cloud/scaleway/scaleway_volume.py validate-modules:E338
|
lib/ansible/modules/cloud/scaleway/scaleway_volume.py validate-modules:E338
|
||||||
lib/ansible/modules/cloud/scaleway/scaleway_volume_facts.py validate-modules:E338
|
lib/ansible/modules/cloud/scaleway/_scaleway_volume_facts.py validate-modules:E338
|
||||||
|
lib/ansible/modules/cloud/scaleway/scaleway_volume_info.py validate-modules:E338
|
||||||
lib/ansible/modules/cloud/smartos/imgadm.py validate-modules:E317
|
lib/ansible/modules/cloud/smartos/imgadm.py validate-modules:E317
|
||||||
lib/ansible/modules/cloud/smartos/imgadm.py validate-modules:E338
|
lib/ansible/modules/cloud/smartos/imgadm.py validate-modules:E338
|
||||||
lib/ansible/modules/cloud/smartos/smartos_image_facts.py validate-modules:E338
|
lib/ansible/modules/cloud/smartos/smartos_image_facts.py validate-modules:E338
|
||||||
|
|
Loading…
Reference in a new issue