diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-18 05:52:22 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-18 05:52:22 +0000 |
commit | 38b7c80217c4e72b1d8988eb1e60bb6e77334114 (patch) | |
tree | 356e9fd3762877d07cde52d21e77070aeff7e789 /ansible_collections/ngine_io | |
parent | Adding upstream version 7.7.0+dfsg. (diff) | |
download | ansible-38b7c80217c4e72b1d8988eb1e60bb6e77334114.tar.xz ansible-38b7c80217c4e72b1d8988eb1e60bb6e77334114.zip |
Adding upstream version 9.4.0+dfsg.upstream/9.4.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ansible_collections/ngine_io')
132 files changed, 321 insertions, 12818 deletions
diff --git a/ansible_collections/ngine_io/vultr/.github/dependabot.yml b/ansible_collections/ngine_io/exoscale/.github/dependabot.yml index 607e7e1a2..607e7e1a2 100644 --- a/ansible_collections/ngine_io/vultr/.github/dependabot.yml +++ b/ansible_collections/ngine_io/exoscale/.github/dependabot.yml diff --git a/ansible_collections/ngine_io/exoscale/.github/workflows/publish.yml b/ansible_collections/ngine_io/exoscale/.github/workflows/publish.yml index 0318edfc4..2bcd079fe 100644 --- a/ansible_collections/ngine_io/exoscale/.github/workflows/publish.yml +++ b/ansible_collections/ngine_io/exoscale/.github/workflows/publish.yml @@ -7,19 +7,24 @@ on: jobs: deploy: runs-on: ubuntu-latest + defaults: + run: + working-directory: ansible_collections/ngine_io/exoscale steps: - - uses: actions/checkout@v1 - - name: Set up Python - uses: actions/setup-python@v1 - with: - python-version: '3.x' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install ansible - - name: Build and publish - env: - ANSIBLE_GALAXY_API_KEY: ${{ secrets.ANSIBLE_GALAXY_API_KEY }} - run: | - ansible-galaxy collection build . - ansible-galaxy collection publish *.tar.gz --api-key $ANSIBLE_GALAXY_API_KEY + - uses: actions/checkout@v3 + with: + path: ansible_collections/ngine_io/exoscale + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.x" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install ansible + - name: Build and publish + env: + ANSIBLE_GALAXY_API_KEY: ${{ secrets.ANSIBLE_GALAXY_API_KEY }} + run: | + ansible-galaxy collection build . + ansible-galaxy collection publish *.tar.gz --api-key $ANSIBLE_GALAXY_API_KEY diff --git a/ansible_collections/ngine_io/exoscale/.github/workflows/sanity.yml b/ansible_collections/ngine_io/exoscale/.github/workflows/sanity.yml index 7e0fab5b9..b646882e0 100644 --- a/ansible_collections/ngine_io/exoscale/.github/workflows/sanity.yml +++ b/ansible_collections/ngine_io/exoscale/.github/workflows/sanity.yml @@ -1,31 +1,42 @@ name: Sanity on: -- pull_request + push: + branches: + - master + schedule: + - cron: "5 12 * * *" + pull_request: + workflow_call: + workflow_dispatch: jobs: sanity: name: Sanity (${{ matrix.ansible }}) + runs-on: ubuntu-20.04 + defaults: + run: + working-directory: ansible_collections/ngine_io/exoscale strategy: matrix: ansible: - - stable-2.10 - - stable-2.9 - - devel - runs-on: ubuntu-latest + - stable-2.14 + - devel steps: + - name: Check out code + uses: actions/checkout@v3 + with: + path: ansible_collections/ngine_io/exoscale - - name: Check out code - uses: actions/checkout@v1 - with: - path: ansible_collections/ngine_io/exoscale + - name: Set up Python 3 + uses: actions/setup-python@v4 + with: + python-version: "3.10" - - name: Set up Python 3.6 - uses: actions/setup-python@v1 - with: - python-version: 3.6 + - name: Install ansible-base (${{ matrix.ansible }}) + run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check - - name: Install ansible-base (${{ matrix.ansible }}) - run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check + - name: Install dependencies + run: ansible-galaxy collection install -p ../../ ngine_io.cloudstack - - name: Run sanity tests - run: ansible-test sanity --docker -v --color --python 3.6 + - name: Run sanity tests + run: ansible-test sanity --docker -v --color diff --git a/ansible_collections/ngine_io/exoscale/CHANGELOG.rst b/ansible_collections/ngine_io/exoscale/CHANGELOG.rst index 54909f89b..c2292e89e 100644 --- a/ansible_collections/ngine_io/exoscale/CHANGELOG.rst +++ b/ansible_collections/ngine_io/exoscale/CHANGELOG.rst @@ -5,5 +5,13 @@ Exoscale Ansible Collection Release Notes .. contents:: Topics +v1.1.0 +====== + +New Modules +----------- + +- ngine_io.exoscale.instance_rdns_record - Manages reverse DNS records for Exoscale compute instances. + v1.0.0 ====== diff --git a/ansible_collections/ngine_io/exoscale/FILES.json b/ansible_collections/ngine_io/exoscale/FILES.json index f725ab2d6..5c567253c 100644 --- a/ansible_collections/ngine_io/exoscale/FILES.json +++ b/ansible_collections/ngine_io/exoscale/FILES.json @@ -8,6 +8,13 @@ "format": 1 }, { + "name": "CHANGELOG.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8933e18b420ebf5ac2f08614062358f129ac675b653e6123994a89475199d2b3", + "format": 1 + }, + { "name": "tests", "ftype": "dir", "chksum_type": null, @@ -22,6 +29,13 @@ "format": 1 }, { + "name": "tests/legacy/exoscale.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "38d542d66924d6e8fd7991ffc2e73544cfd7f88cdd4734ba47734b8ec86ea3fb", + "format": 1 + }, + { "name": "tests/legacy/roles", "ftype": "dir", "chksum_type": null, @@ -64,45 +78,45 @@ "format": 1 }, { - "name": "tests/legacy/exoscale.yml", + "name": "changelogs", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "changelogs/changelog.yaml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "38d542d66924d6e8fd7991ffc2e73544cfd7f88cdd4734ba47734b8ec86ea3fb", + "chksum_sha256": "3e8edd11d87e03989560cbe31d55b406ecc5f3253afa4382cc20f79aa6ea4f25", "format": 1 }, { - "name": "CHANGELOG.rst", + "name": "changelogs/config.yaml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "f3a697694dc57ace9e8600b5b2afbff42deeb76739d55cf66d844aec1ebb5dbf", + "chksum_sha256": "6077ffbd67c5ad687d45cb43010521973fe662e82c2f167c5121016803861cea", "format": 1 }, { - "name": "CONTRIBUTING.md", + "name": "changelogs/.gitignore", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "d61725d614410e2ee0a900fb0f6b6d742ad8fb689ae27c4d6a3a7f89e82fc791", + "chksum_sha256": "919ef00776e7d2ff349950ac4b806132aa9faf006e214d5285de54533e443b33", "format": 1 }, { - "name": "meta", + "name": "changelogs/fragments", "ftype": "dir", "chksum_type": null, "chksum_sha256": null, "format": 1 }, { - "name": "meta/runtime.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "65ddf4c03edf730c4bf7da2184d83dfd28e790cb816ef1f9d82904273cb0c854", - "format": 1 - }, - { - "name": "README.md", + "name": "changelogs/fragments/.keep", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "476a74dcdd9be0337c38135c7ab2f0f65de2ab4fdff679ceaa66b04f3e844811", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "format": 1 }, { @@ -130,7 +144,7 @@ "name": "plugins/doc_fragments/exoscale.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "c484b770aa74ea4fbd70bf2f673af2e7f469ad732e818223152a356a5b9fd861", + "chksum_sha256": "d86f0fc819f87865a54d53e557c43c06ebe2307fe6d6bed3398a3620e6694016", "format": 1 }, { @@ -144,7 +158,7 @@ "name": "plugins/module_utils/exoscale.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "27754664282f766b3ad37dde8ac45d67495e3bc599e4bfa4a089a11819038311", + "chksum_sha256": "1eb5c5bb5f470db43015ea80b3b83a82c8f54ba0145dfd1ce2dff961455bfc54", "format": 1 }, { @@ -158,7 +172,7 @@ "name": "plugins/modules/exo_dns_domain.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "fe708671d29b57cdf89f39aee4b0f81672db58030a92b832bf6b78008e080b80", + "chksum_sha256": "c935301e351f7edf575a57690a18d414d533474411fbc0545a09597ef16a84f3", "format": 1 }, { @@ -169,52 +183,45 @@ "format": 1 }, { - "name": "plugins/modules/exo_dns_record.py", + "name": "plugins/modules/instance_rdns_record.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "920ee4da3ced628cec9e998467ec04cd84db296b47e36225cf0693445fa483a9", - "format": 1 - }, - { - "name": "changelogs", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, + "chksum_sha256": "23076872f3e72d7f40235a451c4a9379c2ee3a3c95a8720852d824999f6d8422", "format": 1 }, { - "name": "changelogs/config.yaml", + "name": "plugins/modules/exo_dns_record.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "6077ffbd67c5ad687d45cb43010521973fe662e82c2f167c5121016803861cea", + "chksum_sha256": "12ba02ca52c73008913c66b33550873605d0b0c224aca18781f65c8aa39581aa", "format": 1 }, { - "name": "changelogs/fragments", + "name": "meta", "ftype": "dir", "chksum_type": null, "chksum_sha256": null, "format": 1 }, { - "name": "changelogs/fragments/.keep", + "name": "meta/runtime.yml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "chksum_sha256": "65ddf4c03edf730c4bf7da2184d83dfd28e790cb816ef1f9d82904273cb0c854", "format": 1 }, { - "name": "changelogs/.gitignore", + "name": "README.md", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "919ef00776e7d2ff349950ac4b806132aa9faf006e214d5285de54533e443b33", + "chksum_sha256": "9a597bfa46bbaf1cf2af965225a512c850b7b97b6f2b8b56cf75d853da649467", "format": 1 }, { - "name": "changelogs/changelog.yaml", + "name": "CONTRIBUTING.md", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "2dbaa843cb55fda031c7fa291a37ff6a59c596763cce1eaf97fd72b3a1761d92", + "chksum_sha256": "d61725d614410e2ee0a900fb0f6b6d742ad8fb689ae27c4d6a3a7f89e82fc791", "format": 1 }, { @@ -235,14 +242,21 @@ "name": ".github/workflows/publish.yml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "c529e2810ae1f02ea98dcae1b78241d21a5988496ed5389b2ce8c37395323756", + "chksum_sha256": "968d296da538330e7547e13d72957e5efd43eda675d75febb3d2e7a041ec0047", "format": 1 }, { "name": ".github/workflows/sanity.yml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "33964a78f085244db7db9904c39776a726cd4cfef48c3b1dcb5e1cf57714d223", + "chksum_sha256": "45a61141d4e4e0f72d0ba02045b0d6b0f0662fa7565e05c5bff5c8d53ca5d858", + "format": 1 + }, + { + "name": ".github/dependabot.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d207e80d10726360f2046d4b2473a3cfd9f9eca99590281fa39d88f78e745145", "format": 1 } ], diff --git a/ansible_collections/ngine_io/exoscale/MANIFEST.json b/ansible_collections/ngine_io/exoscale/MANIFEST.json index acebe1576..f707a1aaf 100644 --- a/ansible_collections/ngine_io/exoscale/MANIFEST.json +++ b/ansible_collections/ngine_io/exoscale/MANIFEST.json @@ -2,7 +2,7 @@ "collection_info": { "namespace": "ngine_io", "name": "exoscale", - "version": "1.0.0", + "version": "1.1.0", "authors": [ "Ren\u00e9 Moser <mail@renemoser.net>" ], @@ -18,7 +18,9 @@ "GPL-3.0-or-later" ], "license_file": null, - "dependencies": {}, + "dependencies": { + "ngine_io.cloudstack": ">=1.0.0" + }, "repository": "https://github.com/ngine-io/ansible-collection-exoscale", "documentation": "", "homepage": "https://github.com/ngine-io/ansible-collection-exoscale", @@ -28,7 +30,7 @@ "name": "FILES.json", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "dbbe7cf8b0656632d858a3bcec7ed6049ee30663c1ed9488392b80c53311d4a4", + "chksum_sha256": "45043adcb9cba1598dc0e4fd8b7d896a1cf1e547c07168d6e60e7d383031d2c4", "format": 1 }, "format": 1 diff --git a/ansible_collections/ngine_io/exoscale/README.md b/ansible_collections/ngine_io/exoscale/README.md index 824f6b779..efae55085 100644 --- a/ansible_collections/ngine_io/exoscale/README.md +++ b/ansible_collections/ngine_io/exoscale/README.md @@ -1,5 +1,4 @@ -![Collection integration](https://github.com/ngine-io/ansible-collection-exoscale/workflows/Collection%20integration/badge.svg) - [![Codecov](https://img.shields.io/codecov/c/github/ngine-io/ansible-collection-exoscale)](https://codecov.io/gh/ngine-io/ansible-collection-exoscale) +![Collection integration](https://github.com/ngine-io/ansible-collection-exoscale/workflows/Sanity/badge.svg) [![License](https://img.shields.io/badge/license-GPL%20v3.0-brightgreen.svg)](LICENSE) # Ansible Collection for exoscale Cloud diff --git a/ansible_collections/ngine_io/exoscale/changelogs/changelog.yaml b/ansible_collections/ngine_io/exoscale/changelogs/changelog.yaml index 4eef701ce..948507e75 100644 --- a/ansible_collections/ngine_io/exoscale/changelogs/changelog.yaml +++ b/ansible_collections/ngine_io/exoscale/changelogs/changelog.yaml @@ -2,3 +2,9 @@ ancestor: null releases: 1.0.0: release_date: '2020-08-15' + 1.1.0: + modules: + - description: Manages reverse DNS records for Exoscale compute instances. + name: instance_rdns_record + namespace: '' + release_date: '2023-08-23' diff --git a/ansible_collections/ngine_io/exoscale/plugins/doc_fragments/exoscale.py b/ansible_collections/ngine_io/exoscale/plugins/doc_fragments/exoscale.py index 52ea2cd49..28081074f 100644 --- a/ansible_collections/ngine_io/exoscale/plugins/doc_fragments/exoscale.py +++ b/ansible_collections/ngine_io/exoscale/plugins/doc_fragments/exoscale.py @@ -4,6 +4,7 @@ # 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 @@ -38,7 +39,7 @@ options: description: - Validate SSL certs of the Exoscale DNS API. type: bool - default: yes + default: true requirements: - python >= 2.6 notes: diff --git a/ansible_collections/ngine_io/exoscale/plugins/module_utils/exoscale.py b/ansible_collections/ngine_io/exoscale/plugins/module_utils/exoscale.py index 44933b1b0..9e1d32fc7 100644 --- a/ansible_collections/ngine_io/exoscale/plugins/module_utils/exoscale.py +++ b/ansible_collections/ngine_io/exoscale/plugins/module_utils/exoscale.py @@ -2,13 +2,14 @@ # Copyright (c) 2016, René Moser <mail@renemoser.net> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function + __metaclass__ = type import os -from ansible.module_utils.six.moves import configparser -from ansible.module_utils.six import integer_types, string_types from ansible.module_utils._text import to_native, to_text +from ansible.module_utils.six import integer_types, string_types +from ansible.module_utils.six.moves import configparser from ansible.module_utils.urls import fetch_url EXO_DNS_BASEURL = "https://api.exoscale.ch/dns/v1" @@ -80,7 +81,7 @@ class ExoDns(object): # Look at CLOUDSTACK_CONFIG first if present if 'CLOUDSTACK_CONFIG' in os.environ: paths += (os.path.expanduser(os.environ['CLOUDSTACK_CONFIG']),) - if not any([os.path.exists(c) for c in paths]): + if not any([os.path.exists(c) for c in paths]): # pylint: disable=use-a-generator self.module.fail_json(msg="Config file not found. Tried : %s" % ", ".join(paths)) conf = configparser.ConfigParser() diff --git a/ansible_collections/ngine_io/exoscale/plugins/modules/exo_dns_domain.py b/ansible_collections/ngine_io/exoscale/plugins/modules/exo_dns_domain.py index 334c5c02b..a8573b51f 100644 --- a/ansible_collections/ngine_io/exoscale/plugins/modules/exo_dns_domain.py +++ b/ansible_collections/ngine_io/exoscale/plugins/modules/exo_dns_domain.py @@ -5,6 +5,7 @@ # 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 @@ -132,7 +133,9 @@ exo_dns_domain: ''' from ansible.module_utils.basic import AnsibleModule -from ..module_utils.exoscale import ExoDns, exo_dns_argument_spec, exo_dns_required_together + +from ..module_utils.exoscale import (ExoDns, exo_dns_argument_spec, + exo_dns_required_together) class ExoDnsDomain(ExoDns): diff --git a/ansible_collections/ngine_io/exoscale/plugins/modules/exo_dns_record.py b/ansible_collections/ngine_io/exoscale/plugins/modules/exo_dns_record.py index 8da3491eb..8153ff849 100644 --- a/ansible_collections/ngine_io/exoscale/plugins/modules/exo_dns_record.py +++ b/ansible_collections/ngine_io/exoscale/plugins/modules/exo_dns_record.py @@ -5,6 +5,7 @@ # 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 @@ -56,7 +57,7 @@ options: - Only allowed for a few record types, e.g. C(record_type=A), C(record_type=NS) or C(record_type=MX). - I(content) will not be updated, instead it is used as a key to find existing records. type: bool - default: no + default: false state: description: - State of the record. @@ -186,8 +187,9 @@ exo_dns_record: ''' from ansible.module_utils.basic import AnsibleModule -from ..module_utils.exoscale import ExoDns, exo_dns_argument_spec, exo_dns_required_together +from ..module_utils.exoscale import (ExoDns, exo_dns_argument_spec, + exo_dns_required_together) EXO_RECORD_TYPES = [ 'A', diff --git a/ansible_collections/ngine_io/exoscale/plugins/modules/instance_rdns_record.py b/ansible_collections/ngine_io/exoscale/plugins/modules/instance_rdns_record.py new file mode 100644 index 000000000..863370d17 --- /dev/null +++ b/ansible_collections/ngine_io/exoscale/plugins/modules/instance_rdns_record.py @@ -0,0 +1,186 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# (c) 2019, Lorenz Schori <lo@znerol.ch> +# 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 + + +DOCUMENTATION = ''' +--- +module: instance_rdns_record +short_description: Manages reverse DNS records for Exoscale compute instances. +description: + - Set and unset reverse DNS record on Exoscale instance. +version_added: "1.1.0" +author: "Lorenz Schori (@znerol)" +options: + name: + description: + - Name of the compute instance + required: true + type: str + content: + aliases: [ 'value' ] + description: + - Reverse DSN name of the compute instance. Required if state=present. + type: str + state: + description: + - State of the record. + default: present + choices: [ 'present', 'absent' ] + type: str +extends_documentation_fragment: ngine_io.cloudstack.cloudstack +''' + +EXAMPLES = ''' +- name: Set the reverse DNS for a compute instance + ngine_io.exoscale.instance_rdns_record: + name: web-vm-1 + content: www.example.com + +- name: Delete the reverse DNS for a compute instance + ngine_io.exoscale.instance_rdns_record: + name: web-vm-1 + state: absent +''' + +RETURN = ''' +--- +instance_rdns_domain: + description: Reverse DSN name of the compute instance + returned: success + type: str +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.ngine_io.cloudstack.plugins.module_utils.cloudstack import ( + AnsibleCloudStack, cs_argument_spec, cs_required_together) + + +class InstanceRdnsRecord(AnsibleCloudStack): + + def __init__(self, module): + super(InstanceRdnsRecord, self).__init__(module) + + self.name = self.module.params.get('name') + self.content = self.module.params.get('content') + + self.returns = { + 'domain': 'domain' + } + + self.instance = None + + def get_instance(self): + instance = self.instance + if not instance: + args = { + 'fetch_list': True, + } + # Do not pass zoneid, as the instance name must be unique across + # zones. + instances = self.query_api('listVirtualMachines', **args) + if instances: + for v in instances: + if self.name.lower() in [v['name'].lower(), v['displayname'].lower(), v['id']]: + self.instance = v + break + + return self.instance + + def get_record(self, instance): + result = {} + + res = self.query_api('queryReverseDnsForVirtualMachine', + id=instance['id']) + nics = res['virtualmachine'].get('nic', []) + + defaultnics = [nic for nic in nics if nic.get('isdefault', False)] + + if len(defaultnics) > 0: + domains = [record['domainname'] for record + in defaultnics[0].get('reversedns', []) + if 'domainname' in record] + + if len(domains) > 0: + result = { + 'domainname': domains[0], + } + + return result + + def present_record(self): + instance = self.get_instance() + + if not instance: + self.module.fail_json( + msg="No compute instance with name=%s found. " % self.name) + + data = { + 'domainname': self.content, + } + record = self.get_record(instance) + if self.has_changed(data, record): + self.result['changed'] = True + self.result['diff']['before'] = record + self.result['diff']['after'] = data + if not self.module.check_mode: + self.query_api('updateReverseDnsForVirtualMachine', + id=instance['id'], + domainname=data['domainname']) + + return data + + def absent_record(self): + instance = self.get_instance() + + if instance: + record = self.get_record(instance) + if record: + self.result['diff']['before'] = record + self.result['changed'] = True + if not self.module.check_mode: + self.query_api('deleteReverseDnsFromVirtualMachine', + id=instance['id']) + + return record + + def get_result(self, resource): + self.result['instance_rdns_domain'] = resource + return self.result + + +def main(): + argument_spec = cs_argument_spec() + argument_spec.update(dict( + name=dict(required=True), + content=dict(aliases=['value']), + state=dict(choices=['present', 'absent'], default='present'), + )) + + module = AnsibleModule( + argument_spec=argument_spec, + required_together=cs_required_together(), + required_if=[ + ('state', 'present', ['content']), + ], + supports_check_mode=True, + ) + + instance_rdns_record = InstanceRdnsRecord(module) + if module.params.get('state') == "present": + record = instance_rdns_record.present_record() + else: + record = instance_rdns_record.absent_record() + + result = instance_rdns_record.get_result(record) + module.exit_json(**result) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/ngine_io/vultr/.github/workflows/integration.yml b/ansible_collections/ngine_io/vultr/.github/workflows/integration.yml deleted file mode 100644 index 7c3d7e9ce..000000000 --- a/ansible_collections/ngine_io/vultr/.github/workflows/integration.yml +++ /dev/null @@ -1,74 +0,0 @@ -name: Collection integration - -on: - push: - schedule: - - cron: 31 6 * * 2 # Run weekly - -jobs: - integration-test: - name: Integration test using Python ${{ matrix.python-version }} - runs-on: ubuntu-20.04 - defaults: - run: - working-directory: ansible_collections/ngine_io/vultr - strategy: - fail-fast: false - matrix: - runner-python-version: - - 3.6 - python-version: - - 3.6 - - 2.7 - steps: - - name: Check out code - uses: actions/checkout@v3 - with: - path: ansible_collections/ngine_io/vultr - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - - name: Install ansible and collection dependencies - run: | - python -m pip install --upgrade pip - pip install ansible - - - name: Build and install collection - run: | - ansible-galaxy collection build . - ansible-galaxy collection install *.gz - - - name: Add config file - env: - CONFIG_FILE: ${{ secrets.CONFIG_FILE }} - run: | - echo "$CONFIG_FILE" > tests/integration/cloud-config-vultr.ini - - - name: Run the tests - run: >- - ansible-test - integration - --docker - -v - --diff - --color - --retry-on-error - --python ${{ matrix.python-version }} - --continue-on-error - --coverage - smoke/vultr/ - - - name: Generate coverage report - run: >- - ansible-test - coverage xml - -v - --requirements - --group-by command - --group-by version - - uses: codecov/codecov-action@v3 - with: - fail_ci_if_error: false diff --git a/ansible_collections/ngine_io/vultr/.github/workflows/publish.yml b/ansible_collections/ngine_io/vultr/.github/workflows/publish.yml deleted file mode 100644 index b6b1ab53b..000000000 --- a/ansible_collections/ngine_io/vultr/.github/workflows/publish.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Upload release to Galaxy - -on: - release: - types: [created] -jobs: - call-sanity-workflow: - uses: ./.github/workflows/sanity.yml - deploy: - runs-on: ubuntu-latest - defaults: - run: - working-directory: ansible_collections/ngine_io/vultr - steps: - - uses: actions/checkout@v3 - with: - path: ansible_collections/ngine_io/vultr - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.x" - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install ansible - - - name: Build and publish - env: - ANSIBLE_GALAXY_API_KEY: ${{ secrets.ANSIBLE_GALAXY_API_KEY }} - run: | - ansible-galaxy collection build . - ansible-galaxy collection publish *.tar.gz --api-key $ANSIBLE_GALAXY_API_KEY diff --git a/ansible_collections/ngine_io/vultr/.github/workflows/sanity.yml b/ansible_collections/ngine_io/vultr/.github/workflows/sanity.yml deleted file mode 100644 index c2ca42529..000000000 --- a/ansible_collections/ngine_io/vultr/.github/workflows/sanity.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Sanity - -on: - push: - branches: - - master - schedule: - - cron: "5 12 * * *" - pull_request: - workflow_call: - workflow_dispatch: - -jobs: - sanity: - name: Sanity (${{ matrix.ansible }}) - runs-on: ubuntu-20.04 - defaults: - run: - working-directory: ansible_collections/ngine_io/vultr - strategy: - matrix: - ansible: - - stable-2.14 - - stable-2.13 - - stable-2.12 - - devel - steps: - - name: Check out code - uses: actions/checkout@v3 - with: - path: ansible_collections/ngine_io/vultr - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.10" - - - name: Install ansible-base (${{ matrix.ansible }}) - run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check - - - name: Run sanity tests - run: ansible-test sanity --docker -v --color diff --git a/ansible_collections/ngine_io/vultr/.gitignore b/ansible_collections/ngine_io/vultr/.gitignore deleted file mode 100644 index d9bd8c659..000000000 --- a/ansible_collections/ngine_io/vultr/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -tests/output/ -cloud-config-vultr.ini diff --git a/ansible_collections/ngine_io/vultr/CHANGELOG.rst b/ansible_collections/ngine_io/vultr/CHANGELOG.rst deleted file mode 100644 index 252fa1649..000000000 --- a/ansible_collections/ngine_io/vultr/CHANGELOG.rst +++ /dev/null @@ -1,68 +0,0 @@ -============================== -Vultr Collection Release Notes -============================== - -.. contents:: Topics - - -v1.1.3 -====== - -Bugfixes --------- - -- iventory - Fixed ``allowed_bandwidth_gb`` to be returned as float (https://github.com/ngine-io/ansible-collection-vultr/pull/35). -- vultr_server - Fixed ``allowed_bandwidth_gb`` to be returned as float (https://github.com/ngine-io/ansible-collection-vultr/pull/35). -- vultr_server_baremetal - Fixed ``allowed_bandwidth_gb`` to be returned as float (https://github.com/ngine-io/ansible-collection-vultr/pull/35). - -v1.1.2 -====== - -Release Summary ---------------- - -This collection has turned into maintenance mode. We encourage you to add new features to its successor at https://galaxy.ansible.com/vultr/cloud. - - -Minor Changes -------------- - -- Documentation fixes. - -v1.1.1 -====== - -Bugfixes --------- - -- vultr_server - Fix user data not handled correctly (https://github.com/ngine-io/ansible-collection-vultr/pull/26). - -v1.1.0 -====== - -Minor Changes -------------- - -- vultr_block_storage - Included ability to resize, attach and detach Block Storage Volumes. - -v1.0.0 -====== - -v0.3.0 -====== - -Minor Changes -------------- - -- vultr_server_info, vultr_server - Improved handling of discontinued plans (https://github.com/ansible/ansible/issues/66707). - -Bugfixes --------- - -- vultr - Fixed the issue retry max delay param was ignored. - -New Modules ------------ - -- vultr_plan_baremetal_info - Gather information about the Vultr Bare Metal plans available. -- vultr_server_baremetal - Manages baremetal servers on Vultr. diff --git a/ansible_collections/ngine_io/vultr/CONTRIBUTING.md b/ansible_collections/ngine_io/vultr/CONTRIBUTING.md deleted file mode 100644 index 44683c135..000000000 --- a/ansible_collections/ngine_io/vultr/CONTRIBUTING.md +++ /dev/null @@ -1,6 +0,0 @@ -# Contributing - -Any contribution is welcome and we only ask contributors to: - -- Create an issues for any significant contribution that would change a large portion of the code base. -- Provide at least integration tests for any contribution diff --git a/ansible_collections/ngine_io/vultr/COPYING b/ansible_collections/ngine_io/vultr/COPYING deleted file mode 100644 index 94a045322..000000000 --- a/ansible_collections/ngine_io/vultr/COPYING +++ /dev/null @@ -1,621 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS diff --git a/ansible_collections/ngine_io/vultr/FILES.json b/ansible_collections/ngine_io/vultr/FILES.json deleted file mode 100644 index 8cf5b7268..000000000 --- a/ansible_collections/ngine_io/vultr/FILES.json +++ /dev/null @@ -1,1405 +0,0 @@ -{ - "files": [ - { - "name": ".", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": ".github", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": ".github/workflows", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": ".github/workflows/sanity.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "e35c78dc82a238007205388e3be388522878ee28e08bbd5504f58f8a56ab8fc1", - "format": 1 - }, - { - "name": ".github/workflows/integration.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "7e969a69b5dc9360f38f82614eb578e3426036c7ac5e6bb5edbecdb7759095e6", - "format": 1 - }, - { - "name": ".github/workflows/publish.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "b93a1c2ed79b3504f50fe2d1b47830515c1857e04ca1f4bff97bbe6bba25303f", - "format": 1 - }, - { - "name": ".github/dependabot.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "d207e80d10726360f2046d4b2473a3cfd9f9eca99590281fa39d88f78e745145", - "format": 1 - }, - { - "name": "codecov.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "0271dcfe609d71afb466112f2d1c4c13943580fa97bb42b2baa08a1c37bb1c14", - "format": 1 - }, - { - "name": "changelogs", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "changelogs/config.yaml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "563c1581cbb9e56aba11a8a22fbce75c922563a23e397788dbbba5678771ebfb", - "format": 1 - }, - { - "name": "changelogs/fragments", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "changelogs/fragments/.keep", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "format": 1 - }, - { - "name": "changelogs/.gitignore", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "919ef00776e7d2ff349950ac4b806132aa9faf006e214d5285de54533e443b33", - "format": 1 - }, - { - "name": "changelogs/changelog.yaml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "2688e075ba2c0b676ab9de2d5040c604e20b8ce2ac10cacf51296e14674e9e38", - "format": 1 - }, - { - "name": "CHANGELOG.rst", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "4742a037f0a9d5bd5c14efb9b4f162a9310b1845ca62ceb564cb2a4496a65c63", - "format": 1 - }, - { - "name": ".gitignore", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "7d6610703389d4c3abb22cda6e2f6b429f15db830eef016a34f916b5e5f9cfe7", - "format": 1 - }, - { - "name": "plugins", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "plugins/doc_fragments", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "plugins/doc_fragments/vultr.py", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "0fc3cbb0cba1768526231546d18fcd5651483f65fb8caf7e1619d14edcc2399f", - "format": 1 - }, - { - "name": "plugins/doc_fragments/__init__.py", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "format": 1 - }, - { - "name": "plugins/modules", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "plugins/modules/vultr_server_baremetal.py", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "3dc461a580515134172b78be7c0b6c896da5b82ea7afc3750147868d877111bc", - "format": 1 - }, - { - "name": "plugins/modules/vultr_network.py", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "5c8e9d690e660eebfdac87e9853c9289aefa16449f58b3584a0b16a5cc61dba8", - "format": 1 - }, - { - "name": "plugins/modules/vultr_startup_script_info.py", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "a5671941f5ea7accf04d5fc8b9e60bcdff79d5d75794842ba8c7c2c3702228d1", - "format": 1 - }, - { - "name": "plugins/modules/vultr_user.py", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "b31751880825def7c9b749a622adb94f42b2afa81990dd2cc1f64246814549ed", - "format": 1 - }, - { - "name": "plugins/modules/vultr_block_storage_info.py", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "f5c942415dd687493fc46b4a927b3f085a06c420d13147405319712ae5b7ad11", - "format": 1 - }, - { - "name": "plugins/modules/vultr_ssh_key_info.py", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "30fc759d9b6361143f04b53b376a12c723b1ae0adc796454ca38d4a735e730b9", - "format": 1 - }, - { - "name": "plugins/modules/vultr_block_storage.py", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "67c440733c447f241bb2018bdb4ca6872193a3531c2df4fad6a107b82c6d436e", - "format": 1 - }, - { - "name": "plugins/modules/vultr_server_info.py", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "37c7a7dbd287ff00455c4924cdc61c99dbae367fd49dc570aaef1073dc12d0d5", - "format": 1 - }, - { - "name": "plugins/modules/vultr_plan_info.py", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "0108582ad1ee7a3f7c24a4f9257e35022a68b8cf701b2d1b0db807f02fb30143", - "format": 1 - }, - { - "name": "plugins/modules/vultr_os_info.py", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "2158f66c5a3b59fdb2ced1fa29c1fa8263f106a6f46d4630655fc66fda5a6819", - "format": 1 - }, - { - "name": "plugins/modules/vultr_ssh_key.py", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "30db2d89d2e946b32606aa821789a3b4967f45f2364d6d992e20d73fcc9cba38", - "format": 1 - }, - { - "name": "plugins/modules/vultr_firewall_group.py", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "d089be1c1b13ffbbe9f5896e4424bad3f31e3302dc0fe1e7b880f8a2146a4284", - "format": 1 - }, - { - "name": "plugins/modules/vultr_network_info.py", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "50194b45d86e273ecad00e3139c97eba38bb2a22afc1e560e035133d62fed1f1", - "format": 1 - }, - { - "name": "plugins/modules/vultr_firewall_group_info.py", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "94258da259c9a38b878692e3303a2a0c937c5e05ffa3b5ccdb8f0a85ced3cb26", - "format": 1 - }, - { - "name": "plugins/modules/vultr_startup_script.py", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "03cffa0a6294bad833e51fc30c83fd00a3da63dde34820f4f918ee669313d5a1", - "format": 1 - }, - { - "name": "plugins/modules/vultr_region_info.py", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "ee0648ffad648505eac184d07d1ed4f657ca4931c0aed9530da5a415edd4edf6", - "format": 1 - }, - { - "name": "plugins/modules/__init__.py", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "format": 1 - }, - { - "name": "plugins/modules/vultr_firewall_rule.py", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "491e9f3a06a7f4e7c9069ab92e3c1596ec26948428a8f88a39e52b3b90cb53c9", - "format": 1 - }, - { - "name": "plugins/modules/vultr_plan_baremetal_info.py", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "1fab8b861ea930ecffcb502b3979002f7be0ff391d77bbb87fcbfd717adc29bf", - "format": 1 - }, - { - "name": "plugins/modules/vultr_dns_domain.py", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "1a208d26279d7858ee55e740a0a24f2ee072ecdc6de43be436f8e87b9e45da90", - "format": 1 - }, - { - "name": "plugins/modules/vultr_account_info.py", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "b6dcf9d0f7c4a225045294f1483404891378826f317104b95b986df1c05f698d", - "format": 1 - }, - { - "name": "plugins/modules/vultr_dns_record.py", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "64422dcff674d4ae5083d6b79992226c8f84223ecd495d365a2e6bab67ef69fa", - "format": 1 - }, - { - "name": "plugins/modules/vultr_user_info.py", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "ba07097ec26ef2112020b5e009056607a2c16869af83ea6463d200675798d9be", - "format": 1 - }, - { - "name": "plugins/modules/vultr_server.py", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "6afbbfcd53352de1c216f0d76a8d07a878963fe1324a0402a5aff40b4b47aab2", - "format": 1 - }, - { - "name": "plugins/modules/vultr_dns_domain_info.py", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "4ca4982d27a9f56d3a326eff153ff47f909e30027d93732deecfa6163069f1d2", - "format": 1 - }, - { - "name": "plugins/module_utils", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "plugins/module_utils/vultr.py", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "528ba35e2d038565b7975ee67ad2bb87f955d19849cd2709a63e2c35707c56ea", - "format": 1 - }, - { - "name": "plugins/inventory", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "plugins/inventory/vultr.py", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "374befb4a073327b898f476328584700b1b2ca33c699e3aa63b85fa890eab172", - "format": 1 - }, - { - "name": "plugins/inventory/__init__.py", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "format": 1 - }, - { - "name": "meta", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "meta/runtime.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "04696fbd217cbc5e9a0e779e9e454dd4ea2ccaa2e64e2085e347a7462bf79f4c", - "format": 1 - }, - { - "name": "CONTRIBUTING.md", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "d61725d614410e2ee0a900fb0f6b6d742ad8fb689ae27c4d6a3a7f89e82fc791", - "format": 1 - }, - { - "name": "COPYING", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "c61f12da7cdad526bdcbed47a4c0a603e60dbbfdaf8b66933cd088e9132c303f", - "format": 1 - }, - { - "name": "README.md", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "4df3dc2d6bcff98ce5764962a4113aa532b6b64a8d1424574f5e8ca9797b9c10", - "format": 1 - }, - { - "name": "tests", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/sanity", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/sanity/ignore-2.10.txt", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "format": 1 - }, - { - "name": "tests/integration", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_server_baremetal", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_server_baremetal/tasks", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_server_baremetal/tasks/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "68833971624986eaae87ba589430fb3b2aba3832e19146122cd114d20ff1faf1", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_server_baremetal/defaults", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_server_baremetal/defaults/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "a75a95397dd5ff4e75aa41b33a7b142cd4b8e3298f351e3ad7ee7ee65ef26cb6", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_server_baremetal/aliases", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "dc2ce6b1319ce6a5d14015a0ce0e61945a5fcb9f4b1cc1e3f2705ba7a5d4b466", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_plan_info", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_plan_info/tasks", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_plan_info/tasks/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "3d923883d3a71a5555afc52cc37e231e1008876c9e842a16bf8377768b0f21ae", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_plan_info/aliases", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "dc2ce6b1319ce6a5d14015a0ce0e61945a5fcb9f4b1cc1e3f2705ba7a5d4b466", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_network", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_network/tasks", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_network/tasks/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "2372e00148dd2e1989fed47315130a9f75b01f22183759f2905a1b78833fa5bb", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_network/defaults", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_network/defaults/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "0405938e979d0f501873c49595a0eec4541488843f81e4a96b59a73da0813044", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_network/aliases", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "dc2ce6b1319ce6a5d14015a0ce0e61945a5fcb9f4b1cc1e3f2705ba7a5d4b466", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_ssh_key", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_ssh_key/tasks", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_ssh_key/tasks/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "0acb1ee578a5103b8b2031b0029387ab47773a2d44426eb3a41a16515145c5cd", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_ssh_key/defaults", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_ssh_key/defaults/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "87bc2569f04cdd9da8579f970937ca75f29a934b5f561e3900684003bdb2e097", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_ssh_key/aliases", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "dc2ce6b1319ce6a5d14015a0ce0e61945a5fcb9f4b1cc1e3f2705ba7a5d4b466", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_dns_record", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_dns_record/tasks", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_dns_record/tasks/test_fail_multiple.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "3a94ab90dcc82900b65490a746281c87160d580526d4ec38367feba99befa20d", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_dns_record/tasks/record.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "4c8c1b02a45598f03fa27946a87939e2b17b1719a8edb68650abb01482c64240", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_dns_record/tasks/update_record.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "8a814ab6ef117b021c046f01a8e03e53572716bbc6103262cd6627804d2f860b", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_dns_record/tasks/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "b47d658ee4a20e470eacefc5c0af57b907bb59f6452ef26bc7a0c70c064d90b5", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_dns_record/tasks/remove_record.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "01024888321c9e35dade95aba129279ec0cb6427a455a4ac2b26e0cb5a3da7ab", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_dns_record/tasks/create_record.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "6e3b6d7add4f8473e4595e678ade0804741ec1068e087839efbec0c5274ccdc9", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_dns_record/defaults", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_dns_record/defaults/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "7c3fd3f2a66a26ce7bd0a214f10a8a38a7cc32c929e1cb0edb2afa8d3f5c645a", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_dns_record/aliases", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "dc2ce6b1319ce6a5d14015a0ce0e61945a5fcb9f4b1cc1e3f2705ba7a5d4b466", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_block_storage", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_block_storage/tasks", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_block_storage/tasks/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "0564f7ada76804ade4f8f7859d596cdcff1346d5cbcab4231169e37077085480", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_block_storage/defaults", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_block_storage/defaults/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "60f56cb0a4e068a6cf706fb1f4274a7124fab21aba34cb4cc67e73f6f815cb3c", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_block_storage/aliases", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "dc2ce6b1319ce6a5d14015a0ce0e61945a5fcb9f4b1cc1e3f2705ba7a5d4b466", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_firewall_group_info", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_firewall_group_info/tasks", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_firewall_group_info/tasks/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "a13acf223b7c92f2f0f983c444cbc607f9ca72cd82ecb23ec50da8f31fac9913", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_firewall_group_info/defaults", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_firewall_group_info/defaults/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "9cc9cf623c20f06134f0d2e26b4d00483c42144fc6e136274419f138820e3c4e", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_firewall_group_info/aliases", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "dc2ce6b1319ce6a5d14015a0ce0e61945a5fcb9f4b1cc1e3f2705ba7a5d4b466", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_dns_domain", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_dns_domain/tasks", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_dns_domain/tasks/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "22b70287f62d5562b9095e154e25fe2673254a88e6d0a6b7cce9f6f830b605f0", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_dns_domain/defaults", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_dns_domain/defaults/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "d6f8edf2333ade957235db03f9c8412db265aefe56736ac06f24fd534e50e356", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_dns_domain/aliases", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "dc2ce6b1319ce6a5d14015a0ce0e61945a5fcb9f4b1cc1e3f2705ba7a5d4b466", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_account_info", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_account_info/tasks", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_account_info/tasks/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "5148a9bfd2dcc70aa62d5353969369689b4cd87e45d552084e17a1c7ef8b79c8", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_account_info/aliases", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "a9f61a9487700a83508395d74ce06374baecfcaf4306b30f008d8b726c626a69", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_user_info", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_user_info/tasks", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_user_info/tasks/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "a11142abb34964253786b2ea016c9a2ed58309aa051410b083226cf162742b9e", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_user_info/defaults", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_user_info/defaults/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "e9a72a5ae88e71690565abf81fe1845976e98e4b60c6025f0679921da414ceac", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_user_info/aliases", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "dc2ce6b1319ce6a5d14015a0ce0e61945a5fcb9f4b1cc1e3f2705ba7a5d4b466", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_server_info", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_server_info/tasks", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_server_info/tasks/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "6688640d74d536b63a99aa454af8d95926d3414f3bd079db044f4a1aeab66995", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_server_info/defaults", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_server_info/defaults/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "3583c2e51479f99f2789216687ca7d6e6a79c46c15fba4f60e846c25ec995595", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_server_info/aliases", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "dc2ce6b1319ce6a5d14015a0ce0e61945a5fcb9f4b1cc1e3f2705ba7a5d4b466", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_plan_baremetal_info", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_plan_baremetal_info/tasks", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_plan_baremetal_info/tasks/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "01c4fbfc268b765fc270e362466b72b398fa2f112249592afcf11ba5f2c6418d", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_plan_baremetal_info/aliases", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "dc2ce6b1319ce6a5d14015a0ce0e61945a5fcb9f4b1cc1e3f2705ba7a5d4b466", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_user", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_user/tasks", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_user/tasks/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "970b3f3fa2d747586bee87eff012ab07a9b3a2ad52673363a63c0bd6c5def496", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_user/defaults", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_user/defaults/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "9a42f029a3a8daba55ddff38d2f57bf3450b9a3974926000961a0947edf7fdfb", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_user/aliases", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "dc2ce6b1319ce6a5d14015a0ce0e61945a5fcb9f4b1cc1e3f2705ba7a5d4b466", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_dns_domain_info", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_dns_domain_info/tasks", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_dns_domain_info/tasks/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "9fba8e6bc585ec240c3f3bffb23cfff580ac96af614abcb3cb1b48dda34b0899", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_dns_domain_info/defaults", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_dns_domain_info/defaults/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "92fad4ee0d5c2d22cb6aafdda4a9183fd62c27c97a56d70decbb0fb945eb1b2b", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_dns_domain_info/aliases", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "dc2ce6b1319ce6a5d14015a0ce0e61945a5fcb9f4b1cc1e3f2705ba7a5d4b466", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_firewall_group", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_firewall_group/tasks", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_firewall_group/tasks/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "e2ac0c621416243b85b0d0f2299a5943039f7bf1954831fc7a27399c334c2b2e", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_firewall_group/defaults", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_firewall_group/defaults/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "cf60b23a46df48b08ffce07e4def1d3291299bf8944b0d3dd3231b848febeb4e", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_firewall_group/aliases", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "dc2ce6b1319ce6a5d14015a0ce0e61945a5fcb9f4b1cc1e3f2705ba7a5d4b466", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_block_storage_info", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_block_storage_info/tasks", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_block_storage_info/tasks/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "94b223424a4ddc5ba9b41c6a2379cc42f92c772a44a70798cc2e884b5272f8f1", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_block_storage_info/defaults", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_block_storage_info/defaults/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "a4609951c802849cf47485f3ac1f8a2456a7a983dc766a401c3b1e8abfec1f46", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_block_storage_info/aliases", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "dc2ce6b1319ce6a5d14015a0ce0e61945a5fcb9f4b1cc1e3f2705ba7a5d4b466", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_server", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_server/tasks", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_server/tasks/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "3732f439f529df507d7eab14482c3169b5c5ba21ae00587f67aded27ad3d5206", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_server/defaults", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_server/defaults/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "0d9ebc00866bc772b097af315ebb7319b2a778a307505fd7d2094d3752f2b34f", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_server/aliases", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "dc2ce6b1319ce6a5d14015a0ce0e61945a5fcb9f4b1cc1e3f2705ba7a5d4b466", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_region_info", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_region_info/tasks", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_region_info/tasks/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "758a60a461a9519fdb262d236962529c80e9517291ce9381e207db92337c768c", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_region_info/aliases", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "dc2ce6b1319ce6a5d14015a0ce0e61945a5fcb9f4b1cc1e3f2705ba7a5d4b466", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_firewall_rule", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_firewall_rule/tasks", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_firewall_rule/tasks/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "c3df36fb3e46b9e23422f0ed4e4071ed281d20f46b6ed901e857be0abe6742e3", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_firewall_rule/defaults", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_firewall_rule/defaults/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "cf60b23a46df48b08ffce07e4def1d3291299bf8944b0d3dd3231b848febeb4e", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_firewall_rule/aliases", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "dc2ce6b1319ce6a5d14015a0ce0e61945a5fcb9f4b1cc1e3f2705ba7a5d4b466", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_os_info", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_os_info/tasks", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_os_info/tasks/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "8d515e570329548c517d733888f9911af92d74b74b20b4a60cbb618580661fc9", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_os_info/aliases", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "dc2ce6b1319ce6a5d14015a0ce0e61945a5fcb9f4b1cc1e3f2705ba7a5d4b466", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_ssh_key_info", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_ssh_key_info/tasks", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_ssh_key_info/tasks/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "be07a1772baa2f0d1fd9eb364ce8b2cf8f576c7b4811c1c0b301673083c095bf", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_ssh_key_info/defaults", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_ssh_key_info/defaults/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "554685b32769bcb7ee18dc94b2348362f45b7ca002ecb6d77d7f333703307431", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_ssh_key_info/aliases", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "dc2ce6b1319ce6a5d14015a0ce0e61945a5fcb9f4b1cc1e3f2705ba7a5d4b466", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_startup_script", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_startup_script/tasks", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_startup_script/tasks/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "ac16afb521ac559c983c0156ad13c3740a096db69beae749893791fbbdf915a2", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_startup_script/defaults", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_startup_script/defaults/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "c80c20cc2e0d5de0eaf1face10b2ca3c25ed1e2e0aed1b1ca8ee848e96a018fb", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_startup_script/aliases", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "dc2ce6b1319ce6a5d14015a0ce0e61945a5fcb9f4b1cc1e3f2705ba7a5d4b466", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_network_info", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_network_info/tasks", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_network_info/tasks/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "b9b380a86e35239430dc7422da32dfff6f6ec22f06e5409ff441369fdccd507e", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_network_info/defaults", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_network_info/defaults/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "d9cd08d5e6dbd37f17ffbe7c917de9612232dc51f54a6cb71dfc212d8d202571", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_network_info/aliases", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "dc2ce6b1319ce6a5d14015a0ce0e61945a5fcb9f4b1cc1e3f2705ba7a5d4b466", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_startup_script_info", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_startup_script_info/tasks", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_startup_script_info/tasks/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "271718ae1ecbe2fecf47d77888141cf0630d33122689c8830b9053d49210e2b1", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_startup_script_info/defaults", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_startup_script_info/defaults/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "f1cb3b66756569be69eb64f65f904c293d21125084629ebeb272d5bc69687712", - "format": 1 - }, - { - "name": "tests/integration/targets/vultr_startup_script_info/aliases", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "dc2ce6b1319ce6a5d14015a0ce0e61945a5fcb9f4b1cc1e3f2705ba7a5d4b466", - "format": 1 - } - ], - "format": 1 -}
\ No newline at end of file diff --git a/ansible_collections/ngine_io/vultr/MANIFEST.json b/ansible_collections/ngine_io/vultr/MANIFEST.json deleted file mode 100644 index 2525ae931..000000000 --- a/ansible_collections/ngine_io/vultr/MANIFEST.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "collection_info": { - "namespace": "ngine_io", - "name": "vultr", - "version": "1.1.3", - "authors": [ - "Ren\u00e9 Moser (@resmo)", - "Yanis Guenane (@Spredzy)" - ], - "readme": "README.md", - "tags": [ - "cloud", - "vultr", - "ngine_io" - ], - "description": "Ansible Collection for Vultr Cloud", - "license": [ - "GPL-3.0-or-later" - ], - "license_file": null, - "dependencies": {}, - "repository": "https://github.com/ngine-io/ansible-collection-vultr", - "documentation": "", - "homepage": "https://github.com/ngine-io/ansible-collection-vultr", - "issues": "https://github.com/ngine-io/ansible-collection-vultr/issues" - }, - "file_manifest_file": { - "name": "FILES.json", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "83cdcf4ba11d97bfe889b2c8134dfdf3cfdbd083dd8ff3c95bf6f7e4186d3e5e", - "format": 1 - }, - "format": 1 -}
\ No newline at end of file diff --git a/ansible_collections/ngine_io/vultr/README.md b/ansible_collections/ngine_io/vultr/README.md deleted file mode 100644 index 68d74c1b1..000000000 --- a/ansible_collections/ngine_io/vultr/README.md +++ /dev/null @@ -1,87 +0,0 @@ - -# !!! NOTE !!! - -This collection is in maintance mode: bug fixes only. For new features, please visit https://github.com/vultr/ansible-collection-vultr/. - ----- - -![Collection integration](https://github.com/ngine-io/ansible-collection-vultr/workflows/Collection%20integration/badge.svg) - [![Codecov](https://img.shields.io/codecov/c/github/ngine-io/ansible-collection-vultr)](https://codecov.io/gh/ngine-io/ansible-collection-vultr) -[![License](https://img.shields.io/badge/license-GPL%20v3.0-brightgreen.svg)](LICENSE) - -# Ansible Collection for Vultr Cloud - -This collection provides a series of Ansible modules and plugins for interacting with the [Vultr](https://www.vultr.com) Cloud. - -## Requirements - -- ansible version >= 2.9 - -## Installation - -To install the collection hosted in Galaxy: - -```bash -ansible-galaxy collection install ngine_io.vultr -``` - -To upgrade to the latest version of the collection: - -```bash -ansible-galaxy collection install ngine_io.vultr --force -``` - -## Usage - -### Playbooks - -To use a module from Vultr collection, please reference the full namespace, collection name, and modules name that you want to use: - -```yaml ---- -- name: Using Vultr collection - hosts: localhost - tasks: - - ngine_io.vultr.vultr_server: - ... -``` - -Or you can add full namepsace and collecton name in the `collections` element: - -```yaml ---- -- name: Using Vultr collection - hosts: localhost - collections: - - ngine_io.vultr - tasks: - - vultr_server: - ... -``` - -### Roles - -For existing Ansible roles, please also reference the full namespace, collection name, and modules name which used in tasks instead of just modules name. - -### Plugins - -To use a pluign, please reference the full namespace, collection name, and plugins name that you want to use: - -```yaml -plugin: ngine_io.vultr.vultr -``` - -## Contributing - -There are many ways in which you can participate in the project, for example: - -- Submit bugs and feature requests, and help us verify as they are checked in -- Review source code changes -- Review the documentation and make pull requests for anything from typos to new content -- If you are interested in fixing issues and contributing directly to the code base, please see the [CONTRIBUTING](CONTRIBUTING.md) document. - -## License - -GNU General Public License v3.0 - -See [COPYING](COPYING) to see the full text. diff --git a/ansible_collections/ngine_io/vultr/changelogs/.gitignore b/ansible_collections/ngine_io/vultr/changelogs/.gitignore deleted file mode 100644 index 6be6b5331..000000000 --- a/ansible_collections/ngine_io/vultr/changelogs/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/.plugin-cache.yaml diff --git a/ansible_collections/ngine_io/vultr/changelogs/changelog.yaml b/ansible_collections/ngine_io/vultr/changelogs/changelog.yaml deleted file mode 100644 index 37cba1d19..000000000 --- a/ansible_collections/ngine_io/vultr/changelogs/changelog.yaml +++ /dev/null @@ -1,59 +0,0 @@ -ancestor: null -releases: - 0.3.0: - changes: - bugfixes: - - vultr - Fixed the issue retry max delay param was ignored. - minor_changes: - - vultr_server_info, vultr_server - Improved handling of discontinued plans - (https://github.com/ansible/ansible/issues/66707). - fragments: - - 66792-vultr-improve-plan.yml - - 67437-vultr-fix-retry-max-delay-param.yml - modules: - - description: Gather information about the Vultr Bare Metal plans available. - name: vultr_plan_baremetal_info - namespace: '' - - description: Manages baremetal servers on Vultr. - name: vultr_server_baremetal - namespace: '' - release_date: '2020-07-03' - 1.0.0: - release_date: '2020-08-16' - 1.1.0: - changes: - minor_changes: - - vultr_block_storage - Included ability to resize, attach and detach Block - Storage Volumes. - fragments: - - 14-attach-detach-and-resize-volumes.yml - release_date: '2021-02-02' - 1.1.1: - changes: - bugfixes: - - vultr_server - Fix user data not handled correctly (https://github.com/ngine-io/ansible-collection-vultr/pull/26). - fragments: - - 26-fix-user-data.yml - release_date: '2022-03-27' - 1.1.2: - changes: - minor_changes: - - Documentation fixes. - release_summary: 'This collection has turned into maintenance mode. We encourage - you to add new features to its successor at https://galaxy.ansible.com/vultr/cloud. - - ' - fragments: - - sanity.yml - - summary.yml - release_date: '2022-06-08' - 1.1.3: - changes: - bugfixes: - - iventory - Fixed ``allowed_bandwidth_gb`` to be returned as float (https://github.com/ngine-io/ansible-collection-vultr/pull/35). - - vultr_server - Fixed ``allowed_bandwidth_gb`` to be returned as float (https://github.com/ngine-io/ansible-collection-vultr/pull/35). - - vultr_server_baremetal - Fixed ``allowed_bandwidth_gb`` to be returned as - float (https://github.com/ngine-io/ansible-collection-vultr/pull/35). - fragments: - - allowed_bandwidth_gb.yml - release_date: '2023-01-23' diff --git a/ansible_collections/ngine_io/vultr/changelogs/config.yaml b/ansible_collections/ngine_io/vultr/changelogs/config.yaml deleted file mode 100644 index bd5621fa0..000000000 --- a/ansible_collections/ngine_io/vultr/changelogs/config.yaml +++ /dev/null @@ -1,29 +0,0 @@ -changelog_filename_template: ../CHANGELOG.rst -changelog_filename_version_depth: 0 -changes_file: changelog.yaml -changes_format: combined -keep_fragments: false -mention_ancestor: true -new_plugins_after_name: removed_features -notesdir: fragments -prelude_section_name: release_summary -prelude_section_title: Release Summary -sections: - - - major_changes - - Major Changes - - - minor_changes - - Minor Changes - - - breaking_changes - - Breaking Changes / Porting Guide - - - deprecated_features - - Deprecated Features - - - removed_features - - Removed Features (previously deprecated) - - - security_fixes - - Security Fixes - - - bugfixes - - Bugfixes - - - known_issues - - Known Issues -title: Vultr Collection -trivial_section_name: trivial diff --git a/ansible_collections/ngine_io/vultr/changelogs/fragments/.keep b/ansible_collections/ngine_io/vultr/changelogs/fragments/.keep deleted file mode 100644 index e69de29bb..000000000 --- a/ansible_collections/ngine_io/vultr/changelogs/fragments/.keep +++ /dev/null diff --git a/ansible_collections/ngine_io/vultr/codecov.yml b/ansible_collections/ngine_io/vultr/codecov.yml deleted file mode 100644 index 33c8f6eee..000000000 --- a/ansible_collections/ngine_io/vultr/codecov.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -coverage: - precision: 2 - round: down - range: "70...100" diff --git a/ansible_collections/ngine_io/vultr/meta/runtime.yml b/ansible_collections/ngine_io/vultr/meta/runtime.yml deleted file mode 100644 index d366b4b05..000000000 --- a/ansible_collections/ngine_io/vultr/meta/runtime.yml +++ /dev/null @@ -1,135 +0,0 @@ -requires_ansible: '>=2.9.10' -action_groups: - vultr: - - vultr_user - - vultr_plan_baremetal_info - - vultr_user_info - - vultr_block_storage - - vultr_plan_info - - vultr_ssh_key_info - - vultr_network_info - - vultr_firewall_group_info - - vultr_ssh_key - - vultr_dns_domain - - vultr_server_info - - vultr_dns_record - - vultr_server_baremetal - - vultr_block_storage_info - - vultr_firewall_group - - vultr_region_info - - vultr_network - - vultr_account_info - - vultr_firewall_rule - - vultr_dns_domain_info - - vultr_server - - vultr_startup_script - - vultr_os_info - - vultr_startup_script_info - -plugin_routing: - modules: - vr_account_facts: - deprecation: - removal_date: 2021-12-12 - warning_text: module was renamed, use ngine_io.vultr.vultr_account_info - redirect: ngine_io.vultr.vultr_account_info - vr_dns_domain: - deprecation: - removal_date: 2021-12-12 - warning_text: module was renamed, use ngine_io.vultr.vultr_dns_domain - redirect: ngine_io.vultr.vultr_dns_domain - vr_dns_record: - deprecation: - removal_date: 2021-12-12 - warning_text: module was renamed, use ngine_io.vultr.vultr_dns_record - redirect: ngine_io.vultr.vultr_dns_record - vr_firewall_group: - deprecation: - removal_date: 2021-12-12 - warning_text: module was renamed, use ngine_io.vultr.vultr_firewall_group - redirect: ngine_io.vultr.vultr_firewall_group - vr_firewall_rule: - deprecation: - removal_date: 2021-12-12 - warning_text: module was renamed, use ngine_io.vultr.vultr_firewall_rule - redirect: ngine_io.vultr.vultr_firewall_rule - vr_server: - deprecation: - removal_date: 2021-12-12 - warning_text: module was renamed, use ngine_io.vultr.vultr_server - redirect: ngine_io.vultr.vultr_server - vr_ssh_key: - deprecation: - removal_date: 2021-12-12 - warning_text: module was renamed, use ngine_io.vultr.vultr_ssh_key - redirect: ngine_io.vultr.vultr_ssh_key - vr_startup_script: - deprecation: - removal_date: 2021-12-12 - warning_text: module was renamed, use ngine_io.vultr.vultr_startup_script - redirect: ngine_io.vultr.vultr_startup_script - vr_user: - deprecation: - removal_date: 2021-12-12 - warning_text: module was renamed, use ngine_io.vultr.vultr_user - redirect: ngine_io.vultr.vultr_user - vultr_account_facts: - deprecation: - removal_date: 2021-12-12 - warning_text: module was renamed, use ngine_io.vultr.vultr_account_info - redirect: ngine_io.vultr.vultr_account_info - vultr_block_storage_facts: - deprecation: - removal_date: 2021-12-12 - warning_text: module was renamed, use ngine_io.vultr.vultr_block_storage_info - redirect: ngine_io.vultr.vultr_block_storage_info - vultr_dns_domain_facts: - deprecation: - removal_date: 2021-12-12 - warning_text: module was renamed, use ngine_io.vultr.vultr_dns_domain_info - redirect: ngine_io.vultr.vultr_dns_domain_info - vultr_firewall_group_facts: - deprecation: - removal_date: 2021-12-12 - warning_text: module was renamed, use ngine_io.vultr.vultr_firewall_group_info - redirect: ngine_io.vultr.vultr_firewall_group_info - vultr_network_facts: - deprecation: - removal_date: 2021-12-12 - warning_text: module was renamed, use ngine_io.vultr.vultr_network_info - redirect: ngine_io.vultr.vultr_network_info - vultr_os_facts: - deprecation: - removal_date: 2021-12-12 - warning_text: module was renamed, use ngine_io.vultr.vultr_os_info - redirect: ngine_io.vultr.vultr_os_info - vultr_plan_facts: - deprecation: - removal_date: 2021-12-12 - warning_text: module was renamed, use ngine_io.vultr.vultr_plan_info - redirect: ngine_io.vultr.vultr_plan_info - vultr_region_facts: - deprecation: - removal_date: 2021-12-12 - warning_text: module was renamed, use ngine_io.vultr.vultr_region_info - redirect: ngine_io.vultr.vultr_region_info - vultr_server_facts: - deprecation: - removal_date: 2021-12-12 - warning_text: module was renamed, use ngine_io.vultr.vultr_server_info - redirect: ngine_io.vultr.vultr_server_info - vultr_ssh_key_facts: - deprecation: - removal_date: 2021-12-12 - warning_text: module was renamed, use ngine_io.vultr.vultr_ssh_key_info - redirect: ngine_io.vultr.vultr_ssh_key_info - vultr_startup_script_facts: - deprecation: - removal_date: 2021-12-12 - warning_text: module was renamed, use ngine_io.vultr.vultr_startup_script_info - redirect: ngine_io.vultr.vultr_startup_script_info - vultr_user_facts: - deprecation: - removal_date: 2021-12-12 - warning_text: module was renamed, use ngine_io.vultr.vultr_user_info - redirect: ngine_io.vultr.vultr_user_info diff --git a/ansible_collections/ngine_io/vultr/plugins/doc_fragments/__init__.py b/ansible_collections/ngine_io/vultr/plugins/doc_fragments/__init__.py deleted file mode 100644 index e69de29bb..000000000 --- a/ansible_collections/ngine_io/vultr/plugins/doc_fragments/__init__.py +++ /dev/null diff --git a/ansible_collections/ngine_io/vultr/plugins/doc_fragments/vultr.py b/ansible_collections/ngine_io/vultr/plugins/doc_fragments/vultr.py deleted file mode 100644 index cb5cfb64f..000000000 --- a/ansible_collections/ngine_io/vultr/plugins/doc_fragments/vultr.py +++ /dev/null @@ -1,58 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright (c) 2017 René Moser <mail@renemoser.net> -# 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 - - -class ModuleDocFragment(object): - - # Standard documentation fragment - DOCUMENTATION = r''' -options: - api_key: - description: - - API key of the Vultr API. - - The ENV variable C(VULTR_API_KEY) is used as default, when defined. - type: str - api_timeout: - description: - - HTTP timeout to Vultr API. - - The ENV variable C(VULTR_API_TIMEOUT) is used as default, when defined. - - Fallback value is 60 seconds if not specified. - type: int - api_retries: - description: - - Amount of retries in case of the Vultr API retuns an HTTP 503 code. - - The ENV variable C(VULTR_API_RETRIES) is used as default, when defined. - - Fallback value is 5 retries if not specified. - type: int - api_retry_max_delay: - description: - - Retry backoff delay in seconds is exponential up to this max. value, in seconds. - - The ENV variable C(VULTR_API_RETRY_MAX_DELAY) is used as default, when defined. - - Fallback value is 12 seconds. - type: int - api_account: - description: - - Name of the ini section in the C(vultr.ini) file. - - The ENV variable C(VULTR_API_ACCOUNT) is used as default, when defined. - type: str - default: default - api_endpoint: - description: - - URL to API endpint (without trailing slash). - - The ENV variable C(VULTR_API_ENDPOINT) is used as default, when defined. - - Fallback value is U(https://api.vultr.com) if not specified. - type: str - validate_certs: - description: - - Validate SSL certs of the Vultr API. - type: bool - default: yes -requirements: - - python >= 2.6 -notes: - - Also see the API documentation on https://www.vultr.com/api/. -''' diff --git a/ansible_collections/ngine_io/vultr/plugins/inventory/__init__.py b/ansible_collections/ngine_io/vultr/plugins/inventory/__init__.py deleted file mode 100644 index e69de29bb..000000000 --- a/ansible_collections/ngine_io/vultr/plugins/inventory/__init__.py +++ /dev/null diff --git a/ansible_collections/ngine_io/vultr/plugins/inventory/vultr.py b/ansible_collections/ngine_io/vultr/plugins/inventory/vultr.py deleted file mode 100644 index a44b47178..000000000 --- a/ansible_collections/ngine_io/vultr/plugins/inventory/vultr.py +++ /dev/null @@ -1,200 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2018, Yanis Guenane <yanis+ansible@guenane.org> -# Copyright (c) 2019, René Moser <mail@renemoser.net> -# 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 - -DOCUMENTATION = r''' - name: vultr - author: - - Yanis Guenane (@Spredzy) - - René Moser (@resmo) - short_description: Vultr inventory source - extends_documentation_fragment: - - constructed - description: - - Get inventory hosts from Vultr public cloud. - - Uses an YAML configuration file ending with either I(vultr.yml) or I(vultr.yaml) to set parameter values (also see examples). - - Uses I(api_config), I(~/.vultr.ini), I(./vultr.ini) or C(VULTR_API_CONFIG) pointing to a Vultr credentials INI file - (see U(https://docs.ansible.com/ansible/latest/scenario_guides/guide_vultr.html)). - options: - plugin: - description: Token that ensures this is a source file for the 'vultr' plugin. - type: string - required: True - choices: [ vultr ] - api_account: - description: Specify the account to be used. - type: string - default: default - api_config: - description: Path to the vultr configuration file. If not specified will be taken from regular Vultr configuration. - type: path - env: - - name: VULTR_API_CONFIG - api_key: - description: Vultr API key. If not specified will be taken from regular Vultr configuration. - type: string - env: - - name: VULTR_API_KEY - hostname: - description: Field to match the hostname. Note v4_main_ip corresponds to the main_ip field returned from the API and name to label. - type: string - default: v4_main_ip - choices: - - v4_main_ip - - v6_main_ip - - name - filter_by_tag: - description: Only return servers filtered by this tag - type: string -''' - -EXAMPLES = r''' -# inventory_vultr.yml file in YAML format -# Example command line: ansible-inventory --list -i inventory_vultr.yml - -# Group by a region as lower case and with prefix e.g. "vultr_region_amsterdam" and by OS without prefix e.g. "CentOS_7_x64" -plugin: vultr -keyed_groups: - - prefix: vultr_region - key: region | lower - - separator: "" - key: os - -# Pass a tag filter to the API -plugin: vultr -filter_by_tag: Cache -''' - -import json - -from ansible.errors import AnsibleError -from ansible.plugins.inventory import BaseInventoryPlugin, Constructable -from ansible.module_utils.six.moves import configparser -from ansible.module_utils.urls import open_url -from ansible.module_utils._text import to_native -from ..module_utils.vultr import Vultr, VULTR_API_ENDPOINT, VULTR_USER_AGENT -from ansible.module_utils.six.moves.urllib.parse import quote - - -SCHEMA = { - 'SUBID': dict(key='id'), - 'label': dict(key='name'), - 'date_created': dict(), - 'allowed_bandwidth_gb': dict(convert_to='float'), - 'auto_backups': dict(key='auto_backup_enabled', convert_to='bool'), - 'current_bandwidth_gb': dict(), - 'kvm_url': dict(), - 'default_password': dict(), - 'internal_ip': dict(), - 'disk': dict(), - 'cost_per_month': dict(convert_to='float'), - 'location': dict(key='region'), - 'main_ip': dict(key='v4_main_ip'), - 'network_v4': dict(key='v4_network'), - 'gateway_v4': dict(key='v4_gateway'), - 'os': dict(), - 'pending_charges': dict(convert_to='float'), - 'power_status': dict(), - 'ram': dict(), - 'plan': dict(), - 'server_state': dict(), - 'status': dict(), - 'firewall_group': dict(), - 'tag': dict(), - 'v6_main_ip': dict(), - 'v6_network': dict(), - 'v6_network_size': dict(), - 'v6_networks': dict(), - 'vcpu_count': dict(convert_to='int'), -} - - -def _load_conf(path, account): - - if path: - conf = configparser.ConfigParser() - conf.read(path) - - if not conf._sections.get(account): - return None - - return dict(conf.items(account)) - else: - return Vultr.read_ini_config(account) - - -def _retrieve_servers(api_key, tag_filter=None): - api_url = '%s/v1/server/list' % VULTR_API_ENDPOINT - if tag_filter is not None: - api_url = api_url + '?tag=%s' % quote(tag_filter) - - try: - response = open_url( - api_url, headers={'API-Key': api_key, 'Content-type': 'application/json'}, - http_agent=VULTR_USER_AGENT, - ) - servers_list = json.loads(response.read()) - - return servers_list.values() if servers_list else [] - except ValueError: - raise AnsibleError("Incorrect JSON payload") - except Exception as e: - raise AnsibleError("Error while fetching %s: %s" % (api_url, to_native(e))) - - -class InventoryModule(BaseInventoryPlugin, Constructable): - - NAME = 'ngine_io.vultr.vultr' - - def verify_file(self, path): - valid = False - if super(InventoryModule, self).verify_file(path): - if path.endswith(('vultr.yaml', 'vultr.yml')): - valid = True - return valid - - def parse(self, inventory, loader, path, cache=True): - super(InventoryModule, self).parse(inventory, loader, path) - self._read_config_data(path=path) - - conf = _load_conf(self.get_option('api_config'), self.get_option('api_account')) - try: - api_key = self.get_option('api_key') or conf.get('key') - except Exception: - raise AnsibleError('Could not find an API key. Check inventory file and Vultr configuration files.') - - hostname_preference = self.get_option('hostname') - - # Add a top group 'vultr' - self.inventory.add_group(group='vultr') - - # Filter by tag is supported by the api with a query - filter_by_tag = self.get_option('filter_by_tag') - for server in _retrieve_servers(api_key, filter_by_tag): - - server = Vultr.normalize_result(server, SCHEMA) - - self.inventory.add_host(host=server['name'], group='vultr') - - for attribute, value in server.items(): - self.inventory.set_variable(server['name'], attribute, value) - - if hostname_preference != 'name': - self.inventory.set_variable(server['name'], 'ansible_host', server[hostname_preference]) - - # Use constructed if applicable - strict = self.get_option('strict') - - # Composed variables - self._set_composite_vars(self.get_option('compose'), server, server['name'], strict=strict) - - # Complex groups based on jinja2 conditionals, hosts that meet the conditional are added to group - self._add_host_to_composed_groups(self.get_option('groups'), server, server['name'], strict=strict) - - # Create groups based on variable values and add the corresponding hosts to it - self._add_host_to_keyed_groups(self.get_option('keyed_groups'), server, server['name'], strict=strict) diff --git a/ansible_collections/ngine_io/vultr/plugins/module_utils/vultr.py b/ansible_collections/ngine_io/vultr/plugins/module_utils/vultr.py deleted file mode 100644 index 81e7b62cb..000000000 --- a/ansible_collections/ngine_io/vultr/plugins/module_utils/vultr.py +++ /dev/null @@ -1,336 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2017, René Moser <mail@renemoser.net> -# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -import os -import time -import random -import urllib -from ansible.module_utils.six.moves import configparser -from ansible.module_utils._text import to_text, to_native -from ansible.module_utils.urls import fetch_url - - -VULTR_API_ENDPOINT = "https://api.vultr.com" -VULTR_USER_AGENT = 'Ansible Vultr' - - -def vultr_argument_spec(): - return dict( - api_key=dict(type='str', default=os.environ.get('VULTR_API_KEY'), no_log=True), - api_timeout=dict(type='int', default=os.environ.get('VULTR_API_TIMEOUT')), - api_retries=dict(type='int', default=os.environ.get('VULTR_API_RETRIES')), - api_retry_max_delay=dict(type='int', default=os.environ.get('VULTR_API_RETRY_MAX_DELAY')), - api_account=dict(type='str', default=os.environ.get('VULTR_API_ACCOUNT') or 'default'), - api_endpoint=dict(type='str', default=os.environ.get('VULTR_API_ENDPOINT')), - validate_certs=dict(type='bool', default=True), - ) - - -class Vultr: - - def __init__(self, module, namespace): - - if module._name.startswith('vr_'): - module.deprecate( - "The Vultr modules were renamed. The prefix of the modules changed from vr_ to vultr_", - collection_name='ngine_io.vultr', - version='2.0.0') # Was Ansbile 2.11 - - self.module = module - - # Namespace use for returns - self.namespace = namespace - self.result = { - 'changed': False, - namespace: dict(), - 'diff': dict(before=dict(), after=dict()) - } - - # For caching HTTP API responses - self.api_cache = dict() - - try: - config = self.read_env_variables() - config.update(Vultr.read_ini_config(self.module.params.get('api_account'))) - except KeyError: - config = {} - - try: - self.api_config = { - 'api_key': self.module.params.get('api_key') or config.get('key'), - 'api_timeout': self.module.params.get('api_timeout') or int(config.get('timeout') or 60), - 'api_retries': self.module.params.get('api_retries') or int(config.get('retries') or 5), - 'api_retry_max_delay': self.module.params.get('api_retry_max_delay') or int(config.get('retry_max_delay') or 12), - 'api_endpoint': self.module.params.get('api_endpoint') or config.get('endpoint') or VULTR_API_ENDPOINT, - } - except ValueError as e: - self.fail_json(msg="One of the following settings, " - "in section '%s' in the ini config file has not an int value: timeout, retries. " - "Error was %s" % (self.module.params.get('api_account'), to_native(e))) - - if not self.api_config.get('api_key'): - self.module.fail_json(msg="No API key was specified. Please refer to the documentation.") - - # Common vultr returns - self.result['vultr_api'] = { - 'api_account': self.module.params.get('api_account'), - 'api_timeout': self.api_config['api_timeout'], - 'api_retries': self.api_config['api_retries'], - 'api_retry_max_delay': self.api_config['api_retry_max_delay'], - 'api_endpoint': self.api_config['api_endpoint'], - } - - # Headers to be passed to the API - self.headers = { - 'API-Key': "%s" % self.api_config['api_key'], - 'User-Agent': VULTR_USER_AGENT, - 'Accept': 'application/json', - } - - def read_env_variables(self): - keys = ['key', 'timeout', 'retries', 'retry_max_delay', 'endpoint'] - env_conf = {} - for key in keys: - if 'VULTR_API_%s' % key.upper() not in os.environ: - continue - env_conf[key] = os.environ['VULTR_API_%s' % key.upper()] - - return env_conf - - @staticmethod - def read_ini_config(ini_group): - paths = ( - os.path.join(os.path.expanduser('~'), '.vultr.ini'), - os.path.join(os.getcwd(), 'vultr.ini'), - ) - if 'VULTR_API_CONFIG' in os.environ: - paths += (os.path.expanduser(os.environ['VULTR_API_CONFIG']),) - - conf = configparser.ConfigParser() - conf.read(paths) - - if not conf._sections.get(ini_group): - return dict() - - return dict(conf.items(ini_group)) - - def fail_json(self, **kwargs): - self.result.update(kwargs) - self.module.fail_json(**self.result) - - def get_yes_or_no(self, key): - if self.module.params.get(key) is not None: - return 'yes' if self.module.params.get(key) is True else 'no' - - def switch_enable_disable(self, resource, param_key, resource_key=None): - if resource_key is None: - resource_key = param_key - - param = self.module.params.get(param_key) - if param is None: - return - - r_value = resource.get(resource_key) - if r_value in ['yes', 'no']: - if param and r_value != 'yes': - return "enable" - elif not param and r_value != 'no': - return "disable" - else: - if param and not r_value: - return "enable" - elif not param and r_value: - return "disable" - - def api_query(self, path="/", method="GET", data=None): - url = self.api_config['api_endpoint'] + path - - if data: - data_encoded = dict() - data_list = "" - for k, v in data.items(): - if isinstance(v, list): - for s in v: - try: - data_list += '&%s[]=%s' % (k, urllib.quote(s)) - except AttributeError: - data_list += '&%s[]=%s' % (k, urllib.parse.quote(s)) - elif v is not None: - data_encoded[k] = v - try: - data = urllib.urlencode(data_encoded) + data_list - except AttributeError: - data = urllib.parse.urlencode(data_encoded) + data_list - - retry_max_delay = self.api_config['api_retry_max_delay'] - randomness = random.randint(0, 1000) / 1000.0 - - for retry in range(0, self.api_config['api_retries']): - response, info = fetch_url( - module=self.module, - url=url, - data=data, - method=method, - headers=self.headers, - timeout=self.api_config['api_timeout'], - ) - - if info.get('status') == 200: - break - - # Vultr has a rate limiting requests per second, try to be polite - # Use exponential backoff plus a little bit of randomness - delay = 2 ** retry + randomness - if delay > retry_max_delay: - delay = retry_max_delay + randomness - time.sleep(delay) - - else: - self.fail_json(msg="Reached API retries limit %s for URL %s, method %s with data %s. Returned %s, with body: %s %s" % ( - self.api_config['api_retries'], - url, - method, - data, - info['status'], - info['msg'], - info.get('body') - )) - - if info.get('status') != 200: - self.fail_json(msg="URL %s, method %s with data %s. Returned %s, with body: %s %s" % ( - url, - method, - data, - info['status'], - info['msg'], - info.get('body') - )) - - res = response.read() - if not res: - return {} - - try: - return self.module.from_json(to_native(res)) or {} - except ValueError as e: - self.module.fail_json(msg="Could not process response into json: %s" % e) - - def query_resource_by_key(self, key, value, resource='regions', query_by='list', params=None, use_cache=False, id_key=None, optional=False): - if not value: - return {} - - r_list = None - if use_cache: - r_list = self.api_cache.get(resource) - - if not r_list: - r_list = self.api_query(path="/v1/%s/%s" % (resource, query_by), data=params) - if use_cache: - self.api_cache.update({ - resource: r_list - }) - - if not r_list: - return {} - - elif isinstance(r_list, list): - for r_data in r_list: - if str(r_data[key]) == str(value): - return r_data - if id_key is not None and to_text(r_data[id_key]) == to_text(value): - return r_data - elif isinstance(r_list, dict): - for r_id, r_data in r_list.items(): - if str(r_data[key]) == str(value): - return r_data - if id_key is not None and to_text(r_data[id_key]) == to_text(value): - return r_data - if not optional: - if id_key: - msg = "Could not find %s with ID or %s: %s" % (resource, key, value) - else: - msg = "Could not find %s with %s: %s" % (resource, key, value) - self.module.fail_json(msg=msg) - return {} - - @staticmethod - def normalize_result(resource, schema, remove_missing_keys=True): - if remove_missing_keys: - fields_to_remove = set(resource.keys()) - set(schema.keys()) - for field in fields_to_remove: - resource.pop(field) - - for search_key, config in schema.items(): - if search_key in resource: - if 'convert_to' in config: - if config['convert_to'] == 'int': - resource[search_key] = int(resource[search_key]) - elif config['convert_to'] == 'float': - resource[search_key] = float(resource[search_key]) - elif config['convert_to'] == 'bool': - resource[search_key] = True if resource[search_key] == 'yes' else False - - if 'transform' in config: - resource[search_key] = config['transform'](resource[search_key]) - - if 'key' in config: - resource[config['key']] = resource[search_key] - del resource[search_key] - - return resource - - def get_result(self, resource): - if resource: - if isinstance(resource, list): - self.result[self.namespace] = [Vultr.normalize_result(item, self.returns) for item in resource] - else: - self.result[self.namespace] = Vultr.normalize_result(resource, self.returns) - - return self.result - - def get_plan(self, plan=None, key='name', optional=False): - value = plan or self.module.params.get('plan') - - return self.query_resource_by_key( - key=key, - value=value, - resource='plans', - use_cache=True, - id_key='VPSPLANID', - optional=optional, - ) - - def get_firewallgroup(self, firewallgroup=None, key='description'): - value = firewallgroup or self.module.params.get('firewallgroup') - - return self.query_resource_by_key( - key=key, - value=value, - resource='firewall', - query_by='group_list', - use_cache=True - ) - - def get_application(self, application=None, key='name'): - value = application or self.module.params.get('application') - - return self.query_resource_by_key( - key=key, - value=value, - resource='app', - use_cache=True - ) - - def get_region(self, region=None, key='name'): - value = region or self.module.params.get('region') - - return self.query_resource_by_key( - key=key, - value=value, - resource='regions', - use_cache=True - ) diff --git a/ansible_collections/ngine_io/vultr/plugins/modules/__init__.py b/ansible_collections/ngine_io/vultr/plugins/modules/__init__.py deleted file mode 100644 index e69de29bb..000000000 --- a/ansible_collections/ngine_io/vultr/plugins/modules/__init__.py +++ /dev/null diff --git a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_account_info.py b/ansible_collections/ngine_io/vultr/plugins/modules/vultr_account_info.py deleted file mode 100644 index 1718ff664..000000000 --- a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_account_info.py +++ /dev/null @@ -1,130 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -# -# Copyright (c) 2019, René Moser <mail@renemoser.net> -# 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 - - -DOCUMENTATION = r''' ---- -module: vultr_account_info -short_description: Get information about the Vultr account. -description: - - Get infos about account balance, charges and payments. -version_added: "0.1.0" -author: "René Moser (@resmo)" -extends_documentation_fragment: -- ngine_io.vultr.vultr - -''' - -EXAMPLES = r''' -- name: Get Vultr account infos - ngine_io.vultr.vultr_account_info: - register: result - -- name: Print the infos - debug: - var: result.vultr_account_info -''' - -RETURN = r''' ---- -vultr_api: - description: Response from Vultr API with a few additions/modification - returned: success - type: complex - contains: - api_account: - description: Account used in the ini file to select the key - returned: success - type: str - sample: default - api_timeout: - description: Timeout used for the API requests - returned: success - type: int - sample: 60 - api_retries: - description: Amount of max retries for the API requests - returned: success - type: int - sample: 5 - api_retry_max_delay: - description: Exponential backoff delay in seconds between retries up to this max delay value. - returned: success - type: int - sample: 12 - api_endpoint: - description: Endpoint used for the API requests - returned: success - type: str - sample: "https://api.vultr.com" -vultr_account_info: - description: Response from Vultr API - returned: success - type: complex - contains: - balance: - description: Your account balance. - returned: success - type: float - sample: -214.69 - pending_charges: - description: Charges pending. - returned: success - type: float - sample: 57.03 - last_payment_date: - description: Date of the last payment. - returned: success - type: str - sample: "2017-08-26 12:47:48" - last_payment_amount: - description: The amount of the last payment transaction. - returned: success - type: float - sample: -250.0 -''' - -from ansible.module_utils.basic import AnsibleModule -from ..module_utils.vultr import ( - Vultr, - vultr_argument_spec, -) - - -class AnsibleVultrAccountInfo(Vultr): - - def __init__(self, module): - super(AnsibleVultrAccountInfo, self).__init__(module, "vultr_account_info") - - self.returns = { - 'balance': dict(convert_to='float'), - 'pending_charges': dict(convert_to='float'), - 'last_payment_date': dict(), - 'last_payment_amount': dict(convert_to='float'), - } - - def get_account_info(self): - return self.api_query(path="/v1/account/info") - - -def main(): - argument_spec = vultr_argument_spec() - - module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True, - ) - - account_info = AnsibleVultrAccountInfo(module) - result = account_info.get_result(account_info.get_account_info()) - module.exit_json(**result) - - -if __name__ == '__main__': - main() diff --git a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_block_storage.py b/ansible_collections/ngine_io/vultr/plugins/modules/vultr_block_storage.py deleted file mode 100644 index 5cda1cd1a..000000000 --- a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_block_storage.py +++ /dev/null @@ -1,382 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -# -# Copyright (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 - - -DOCUMENTATION = ''' ---- -module: vultr_block_storage -short_description: Manages block storage volumes on Vultr. -description: - - Manage block storage volumes on Vultr. -author: "Yanis Guenane (@Spredzy)" -version_added: "0.1.0" -options: - name: - description: - - Name of the block storage volume. - required: true - aliases: [ description, label ] - type: str - size: - description: - - Size of the block storage volume in GB. - - Required if I(state) is present. - - If it's larger than the volume's current size, the volume will be resized. - type: int - region: - description: - - Region the block storage volume is deployed into. - - Required if I(state) is present. - type: str - state: - description: - - State of the block storage volume. - default: present - choices: [ present, absent, attached, detached ] - type: str - attached_to_SUBID: - description: - - The ID of the server the volume is attached to. - - Required if I(state) is attached. - aliases: [ attached_to_id ] - type: int - live_attachment: - description: - - Whether the volume should be attached/detached, even if the server not stopped. - type: bool - default: True -extends_documentation_fragment: -- ngine_io.vultr.vultr - -''' - -EXAMPLES = ''' -- name: Ensure a block storage volume is present - ngine_io.vultr.vultr_block_storage: - name: myvolume - size: 10 - region: Amsterdam - -- name: Ensure a block storage volume is absent - ngine_io.vultr.vultr_block_storage: - name: myvolume - state: absent - -- name: Ensure a block storage volume exists and is attached to server 114 - ngine_io.vultr.vultr_block_storage: - name: myvolume - state: attached - attached_to_id: 114 - size: 10 - -- name: Ensure a block storage volume exists and is not attached to any server - ngine_io.vultr.vultr_block_storage: - name: myvolume - state: detached - size: 10 -''' - -RETURN = ''' ---- -vultr_api: - description: Response from Vultr API with a few additions/modification - returned: success - type: complex - contains: - api_account: - description: Account used in the ini file to select the key - returned: success - type: str - sample: default - api_timeout: - description: Timeout used for the API requests - returned: success - type: int - sample: 60 - api_retries: - description: Amount of max retries for the API requests - returned: success - type: int - sample: 5 - api_retry_max_delay: - description: Exponential backoff delay in seconds between retries up to this max delay value. - returned: success - type: int - sample: 12 - api_endpoint: - description: Endpoint used for the API requests - returned: success - type: str - sample: "https://api.vultr.com" -vultr_block_storage: - description: Response from Vultr API - returned: success - type: complex - contains: - attached_to_id: - description: The ID of the server the volume is attached to - returned: success - type: str - sample: "10194376" - cost_per_month: - description: Cost per month for the volume - returned: success - type: float - sample: 1.00 - date_created: - description: Date when the volume was created - returned: success - type: str - sample: "2017-08-26 12:47:48" - id: - description: ID of the block storage volume - returned: success - type: str - sample: "1234abcd" - name: - description: Name of the volume - returned: success - type: str - sample: "ansible-test-volume" - region: - description: Region the volume was deployed into - returned: success - type: str - sample: "New Jersey" - size: - description: Information about the volume size in GB - returned: success - type: int - sample: 10 - status: - description: Status about the deployment of the volume - returned: success - type: str - sample: "active" - -''' -from ansible.module_utils.basic import AnsibleModule -from ..module_utils.vultr import ( - Vultr, - vultr_argument_spec, -) - - -class AnsibleVultrBlockStorage(Vultr): - - def __init__(self, module): - super(AnsibleVultrBlockStorage, self).__init__(module, "vultr_block_storage") - - self.returns = { - 'SUBID': dict(key='id'), - 'label': dict(key='name'), - 'DCID': dict(key='region', transform=self._get_region_name), - 'attached_to_SUBID': dict(key='attached_to_id'), - 'cost_per_month': dict(convert_to='float'), - 'date_created': dict(), - 'size_gb': dict(key='size', convert_to='int'), - 'status': dict() - } - - def _get_region_name(self, region): - return self.get_region(region, 'DCID').get('name') - - def get_block_storage_volumes(self): - volumes = self.api_query(path="/v1/block/list") - if volumes: - for volume in volumes: - if volume.get('label') == self.module.params.get('name'): - return volume - return {} - - def present_block_storage_volume(self): - volume = self.get_block_storage_volumes() - if not volume: - volume = self._create_block_storage_volume(volume) - return volume - - def _create_block_storage_volume(self, volume): - self.result['changed'] = True - data = { - 'label': self.module.params.get('name'), - 'DCID': self.get_region().get('DCID'), - 'size_gb': self.module.params.get('size') - } - self.result['diff']['before'] = {} - self.result['diff']['after'] = data - - if not self.module.check_mode: - self.api_query( - path="/v1/block/create", - method="POST", - data=data - ) - volume = self.get_block_storage_volumes() - return volume - - def absent_block_storage_volume(self): - volume = self.get_block_storage_volumes() - if volume: - self.result['changed'] = True - - data = { - 'SUBID': volume['SUBID'], - } - - self.result['diff']['before'] = volume - self.result['diff']['after'] = {} - - if not self.module.check_mode: - self.api_query( - path="/v1/block/delete", - method="POST", - data=data - ) - return volume - - def detached_block_storage_volume(self): - volume = self.present_block_storage_volume() - if volume.get('attached_to_SUBID') is None: - return volume - - self.result['changed'] = True - - if not self.module.check_mode: - data = { - 'SUBID': volume['SUBID'], - 'live': self.get_yes_or_no('live_attachment') - } - self.api_query( - path='/v1/block/detach', - method='POST', - data=data - ) - - volume = self.get_block_storage_volumes() - else: - volume['attached_to_SUBID'] = None - - self.result['diff']['after'] = volume - - return volume - - def attached_block_storage_volume(self): - expected_server = self.module.params.get('attached_to_SUBID') - volume = self.present_block_storage_volume() - server = volume.get('attached_to_SUBID') - if server == expected_server: - return volume - - if server is not None: - self.module.fail_json( - msg='Volume already attached to server %s' % server - ) - - self.result['changed'] = True - - if not self.module.check_mode: - data = { - 'SUBID': volume['SUBID'], - # This API call expects a param called attach_to_SUBID, - # but all the BlockStorage API response payloads call - # this parameter attached_to_SUBID. So we'll standardize - # to the latter and attached_to_id, but we'll pass the - # expected attach_to_SUBID to this API call. - 'attach_to_SUBID': expected_server, - 'live': self.get_yes_or_no('live_attachment'), - } - self.api_query( - path='/v1/block/attach', - method='POST', - data=data - ) - volume = self.get_block_storage_volumes() - else: - volume['attached_to_SUBID'] = expected_server - - self.result['diff']['after'] = volume - - return volume - - def ensure_volume_size(self, volume, expected_size): - curr_size = volume.get('size_gb') - # When creating, attaching, or detaching a volume in check_mode, - # sadly, size_gb doesn't exist, because those methods return the - # result of get_block_storage_volumes, which is {} on check_mode. - if curr_size is None or curr_size >= expected_size: - # we only resize volumes that are smaller than - # expected. There's no shrinking operation. - return volume - - self.result['changed'] = True - - volume['size_gb'] = expected_size - self.result['diff']['after'] = volume - - if not self.module.check_mode: - data = {'SUBID': volume['SUBID'], 'size_gb': expected_size} - self.api_query( - path='/v1/block/resize', - method='POST', - data=data, - ) - - return volume - - -def main(): - argument_spec = vultr_argument_spec() - argument_spec.update(dict( - name=dict(type='str', required=True, aliases=['description', 'label']), - size=dict(type='int'), - region=dict(type='str'), - state=dict( - type='str', - choices=['present', 'absent', 'attached', 'detached'], - default='present' - ), - attached_to_SUBID=dict(type='int', aliases=['attached_to_id']), - live_attachment=dict(type='bool', default=True) - )) - - module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True, - required_if=[ - ['state', 'present', ['size', 'region']], - ['state', 'detached', ['size', 'region']], - ['state', 'attached', ['size', 'region', 'attached_to_SUBID']], - ] - ) - - vultr_block_storage = AnsibleVultrBlockStorage(module) - - desired_state = module.params.get('state') - if desired_state == "absent": - volume = vultr_block_storage.absent_block_storage_volume() - elif desired_state == 'attached': - volume = vultr_block_storage.attached_block_storage_volume() - elif desired_state == 'detached': - volume = vultr_block_storage.detached_block_storage_volume() - else: - volume = vultr_block_storage.present_block_storage_volume() - - expected_size = module.params.get('size') - if expected_size and desired_state != 'absent': - volume = vultr_block_storage.ensure_volume_size( - volume, - expected_size - ) - - result = vultr_block_storage.get_result(volume) - module.exit_json(**result) - - -if __name__ == '__main__': - main() diff --git a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_block_storage_info.py b/ansible_collections/ngine_io/vultr/plugins/modules/vultr_block_storage_info.py deleted file mode 100644 index 46bdbecb3..000000000 --- a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_block_storage_info.py +++ /dev/null @@ -1,160 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -# -# Copyright (c) 2018, Yanis Guenane <yanis+ansible@guenane.org> -# Copyright (c) 2019, René Moser <mail@renemoser.net> -# 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 - - -DOCUMENTATION = r''' ---- -module: vultr_block_storage_info -short_description: Get information about the Vultr block storage volumes available. -description: - - Get infos about block storage volumes available in Vultr. -version_added: "0.1.0" -author: - - "Yanis Guenane (@Spredzy)" - - "René Moser (@resmo)" -extends_documentation_fragment: -- ngine_io.vultr.vultr - -''' - -EXAMPLES = r''' -- name: Get Vultr block storage infos - ngine_io.vultr.vultr_block_storage_info: - register: result - -- name: Print the infos - debug: - var: result.vultr_block_storage_info -''' - -RETURN = r''' ---- -vultr_api: - description: Response from Vultr API with a few additions/modification - returned: success - type: complex - contains: - api_account: - description: Account used in the ini file to select the key - returned: success - type: str - sample: default - api_timeout: - description: Timeout used for the API requests - returned: success - type: int - sample: 60 - api_retries: - description: Amount of max retries for the API requests - returned: success - type: int - sample: 5 - api_retry_max_delay: - description: Exponential backoff delay in seconds between retries up to this max delay value. - returned: success - type: int - sample: 12 - api_endpoint: - description: Endpoint used for the API requests - returned: success - type: str - sample: "https://api.vultr.com" -vultr_block_storage_info: - description: Response from Vultr API as list - returned: success - type: complex - contains: - id: - description: ID of the block storage. - returned: success - type: int - sample: 17332323 - size: - description: Size in GB of the block storage. - returned: success - type: int - sample: 10 - region: - description: Region the block storage is located in. - returned: success - type: str - sample: New Jersey - name: - description: Name of the block storage. - returned: success - type: str - sample: my volume - cost_per_month: - description: Cost per month of the block storage. - returned: success - type: float - sample: 1.0 - date_created: - description: Date created of the block storage. - returned: success - type: str - sample: "2018-07-24 12:59:59" - status: - description: Status of the block storage. - returned: success - type: str - sample: active - attached_to_id: - description: Block storage is attached to this server ID. - returned: success - type: str - sample: null -''' - -from ansible.module_utils.basic import AnsibleModule -from ..module_utils.vultr import ( - Vultr, - vultr_argument_spec, -) - - -class AnsibleVultrBlockStorageFacts(Vultr): - - def __init__(self, module): - super(AnsibleVultrBlockStorageFacts, self).__init__(module, "vultr_block_storage_info") - - self.returns = { - 'attached_to_SUBID': dict(key='attached_to_id'), - 'cost_per_month': dict(convert_to='float'), - 'date_created': dict(), - 'SUBID': dict(key='id'), - 'label': dict(key='name'), - 'DCID': dict(key='region', transform=self._get_region_name), - 'size_gb': dict(key='size', convert_to='int'), - 'status': dict() - } - - def _get_region_name(self, region): - return self.get_region(region, 'DCID').get('name') - - def get_block_storage_volumes(self): - return self.api_query(path="/v1/block/list") - - -def main(): - argument_spec = vultr_argument_spec() - - module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True, - ) - - volume_info = AnsibleVultrBlockStorageFacts(module) - result = volume_info.get_result(volume_info.get_block_storage_volumes()) - module.exit_json(**result) - - -if __name__ == '__main__': - main() diff --git a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_dns_domain.py b/ansible_collections/ngine_io/vultr/plugins/modules/vultr_dns_domain.py deleted file mode 100644 index bb83d3733..000000000 --- a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_dns_domain.py +++ /dev/null @@ -1,201 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -# -# Copyright (c) 2017, René Moser <mail@renemoser.net> -# 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 - - -DOCUMENTATION = r''' ---- -module: vultr_dns_domain -short_description: Manages DNS domains on Vultr. -description: - - Create and remove DNS domains. -version_added: "0.1.0" -author: "René Moser (@resmo)" -options: - name: - description: - - The domain name. - required: true - aliases: [ domain ] - type: str - server_ip: - description: - - The default server IP. - - Use M(ngine_io.vultr.vultr_dns_record) to change it once the domain is created. - - Required if C(state=present). - type: str - state: - description: - - State of the DNS domain. - default: present - choices: [ present, absent ] - type: str -extends_documentation_fragment: -- ngine_io.vultr.vultr - -''' - -EXAMPLES = r''' -- name: Ensure a domain exists - ngine_io.vultr.vultr_dns_domain: - name: example.com - server_ip: 10.10.10.10 - -- name: Ensure a domain is absent - ngine_io.vultr.vultr_dns_domain: - name: example.com - state: absent -''' - -RETURN = r''' ---- -vultr_api: - description: Response from Vultr API with a few additions/modification - returned: success - type: complex - contains: - api_account: - description: Account used in the ini file to select the key - returned: success - type: str - sample: default - api_timeout: - description: Timeout used for the API requests - returned: success - type: int - sample: 60 - api_retries: - description: Amount of max retries for the API requests - returned: success - type: int - sample: 5 - api_retry_max_delay: - description: Exponential backoff delay in seconds between retries up to this max delay value. - returned: success - type: int - sample: 12 - api_endpoint: - description: Endpoint used for the API requests - returned: success - type: str - sample: "https://api.vultr.com" -vultr_dns_domain: - description: Response from Vultr API - returned: success - type: complex - contains: - name: - description: Name of the DNS Domain. - returned: success - type: str - sample: example.com - date_created: - description: Date the DNS domain was created. - returned: success - type: str - sample: "2017-08-26 12:47:48" -''' - -from ansible.module_utils.basic import AnsibleModule - -from ..module_utils.vultr import Vultr, vultr_argument_spec - - -class AnsibleVultrDnsDomain(Vultr): - - def __init__(self, module): - super(AnsibleVultrDnsDomain, self).__init__(module, "vultr_dns_domain") - - self.returns = { - 'domain': dict(key='name'), - 'date_created': dict(), - } - - def get_domain(self): - domains = self.api_query(path="/v1/dns/list") - name = self.module.params.get('name').lower() - if domains: - for domain in domains: - if domain.get('domain').lower() == name: - return domain - return {} - - def present_domain(self): - domain = self.get_domain() - if not domain: - domain = self._create_domain(domain) - return domain - - def _create_domain(self, domain): - self.result['changed'] = True - data = { - 'domain': self.module.params.get('name'), - 'serverip': self.module.params.get('server_ip'), - } - self.result['diff']['before'] = {} - self.result['diff']['after'] = data - - if not self.module.check_mode: - self.api_query( - path="/v1/dns/create_domain", - method="POST", - data=data - ) - domain = self.get_domain() - return domain - - def absent_domain(self): - domain = self.get_domain() - if domain: - self.result['changed'] = True - - data = { - 'domain': domain['domain'], - } - - self.result['diff']['before'] = domain - self.result['diff']['after'] = {} - - if not self.module.check_mode: - self.api_query( - path="/v1/dns/delete_domain", - method="POST", - data=data - ) - return domain - - -def main(): - argument_spec = vultr_argument_spec() - argument_spec.update(dict( - name=dict(type='str', required=True, aliases=['domain']), - server_ip=dict(type='str',), - state=dict(type='str', choices=['present', 'absent'], default='present'), - )) - - module = AnsibleModule( - argument_spec=argument_spec, - required_if=[ - ('state', 'present', ['server_ip']), - ], - supports_check_mode=True, - ) - - vultr_domain = AnsibleVultrDnsDomain(module) - if module.params.get('state') == "absent": - domain = vultr_domain.absent_domain() - else: - domain = vultr_domain.present_domain() - - result = vultr_domain.get_result(domain) - module.exit_json(**result) - - -if __name__ == '__main__': - main() diff --git a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_dns_domain_info.py b/ansible_collections/ngine_io/vultr/plugins/modules/vultr_dns_domain_info.py deleted file mode 100644 index 35a47d701..000000000 --- a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_dns_domain_info.py +++ /dev/null @@ -1,117 +0,0 @@ -#!/usr/bin/python -# -# Copyright (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 - - -DOCUMENTATION = r''' ---- -module: vultr_dns_domain_info -short_description: Gather information about the Vultr DNS domains available. -description: - - Gather information about DNS domains available in Vultr. -version_added: "0.1.0" -author: "Yanis Guenane (@Spredzy)" -extends_documentation_fragment: -- ngine_io.vultr.vultr - -''' - -EXAMPLES = r''' -- name: Gather Vultr DNS domains information - ngine_io.vultr.vultr_dns_domains_info: - register: result - -- name: Print the gathered information - debug: - var: result.vultr_dns_domain_info -''' - -RETURN = r''' ---- -vultr_api: - description: Response from Vultr API with a few additions/modification - returned: success - type: complex - contains: - api_account: - description: Account used in the ini file to select the key - returned: success - type: str - sample: default - api_timeout: - description: Timeout used for the API requests - returned: success - type: int - sample: 60 - api_retries: - description: Amount of max retries for the API requests - returned: success - type: int - sample: 5 - api_retry_max_delay: - description: Exponential backoff delay in seconds between retries up to this max delay value. - returned: success - type: int - sample: 12 - api_endpoint: - description: Endpoint used for the API requests - returned: success - type: str - sample: "https://api.vultr.com" -vultr_dns_domain_info: - description: Response from Vultr API - returned: success - type: complex - contains: - domain: - description: Name of the DNS Domain. - returned: success - type: str - sample: example.com - date_created: - description: Date the DNS domain was created. - returned: success - type: str - sample: "2017-08-26 12:47:48" -''' - -from ansible.module_utils.basic import AnsibleModule -from ..module_utils.vultr import ( - Vultr, - vultr_argument_spec, -) - - -class AnsibleVultrDnsDomainInfo(Vultr): - - def __init__(self, module): - super(AnsibleVultrDnsDomainInfo, self).__init__(module, "vultr_dns_domain_info") - - self.returns = { - "date_created": dict(), - "domain": dict(), - } - - def get_domains(self): - return self.api_query(path="/v1/dns/list") - - -def main(): - argument_spec = vultr_argument_spec() - - module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True, - ) - - domain_info = AnsibleVultrDnsDomainInfo(module) - result = domain_info.get_result(domain_info.get_domains()) - module.exit_json(**result) - - -if __name__ == '__main__': - main() diff --git a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_dns_record.py b/ansible_collections/ngine_io/vultr/plugins/modules/vultr_dns_record.py deleted file mode 100644 index bab11c4c0..000000000 --- a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_dns_record.py +++ /dev/null @@ -1,376 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -# -# Copyright (c) 2017, René Moser <mail@renemoser.net> -# 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 - - -DOCUMENTATION = ''' ---- -module: vultr_dns_record -short_description: Manages DNS records on Vultr. -description: - - Create, update and remove DNS records. -version_added: "0.1.0" -author: "René Moser (@resmo)" -options: - name: - description: - - The record name (subrecord). - default: "" - aliases: [ subrecord ] - type: str - domain: - description: - - The domain the record is related to. - type: str - required: true - record_type: - description: - - Type of the record. - default: A - choices: - - A - - AAAA - - CNAME - - MX - - SRV - - CAA - - TXT - - NS - - SSHFP - aliases: [ type ] - type: str - data: - description: - - Data of the record. - - Required if C(state=present) or C(multiple=yes). - type: str - ttl: - description: - - TTL of the record. - default: 300 - type: int - multiple: - description: - - Whether to use more than one record with similar C(name) including no name and C(record_type). - - Only allowed for a few record types, e.g. C(record_type=A), C(record_type=NS) or C(record_type=MX). - - C(data) will not be updated, instead it is used as a key to find existing records. - default: no - type: bool - priority: - description: - - Priority of the record. - default: 0 - type: int - state: - description: - - State of the DNS record. - default: present - choices: [ present, absent ] - type: str -extends_documentation_fragment: -- ngine_io.vultr.vultr - -''' - -EXAMPLES = ''' -- name: Ensure an A record exists - ngine_io.vultr.vultr_dns_record: - name: www - domain: example.com - data: 10.10.10.10 - ttl: 3600 - -- name: Ensure a second A record exists for round robin LB - ngine_io.vultr.vultr_dns_record: - name: www - domain: example.com - data: 10.10.10.11 - ttl: 60 - multiple: yes - -- name: Ensure a CNAME record exists - ngine_io.vultr.vultr_dns_record: - name: web - record_type: CNAME - domain: example.com - data: www.example.com - -- name: Ensure MX record exists - ngine_io.vultr.vultr_dns_record: - record_type: MX - domain: example.com - data: "{{ item.data }}" - priority: "{{ item.priority }}" - multiple: yes - with_items: - - { data: mx1.example.com, priority: 10 } - - { data: mx2.example.com, priority: 10 } - - { data: mx3.example.com, priority: 20 } - -- name: Ensure a record is absent - ngine_io.vultr.vultr_dns_record: - name: www - domain: example.com - state: absent - -- name: Ensure MX record is absent in case multiple exists - ngine_io.vultr.vultr_dns_record: - record_type: MX - domain: example.com - data: mx1.example.com - multiple: yes - state: absent -''' - -RETURN = ''' ---- -vultr_api: - description: Response from Vultr API with a few additions/modification - returned: success - type: complex - contains: - api_account: - description: Account used in the ini file to select the key - returned: success - type: str - sample: default - api_timeout: - description: Timeout used for the API requests - returned: success - type: int - sample: 60 - api_retries: - description: Amount of max retries for the API requests - returned: success - type: int - sample: 5 - api_retry_max_delay: - description: Exponential backoff delay in seconds between retries up to this max delay value. - returned: success - type: int - sample: 12 - api_endpoint: - description: Endpoint used for the API requests - returned: success - type: str - sample: "https://api.vultr.com" -vultr_dns_record: - description: Response from Vultr API - returned: success - type: complex - contains: - id: - description: The ID of the DNS record. - returned: success - type: int - sample: 1265277 - name: - description: The name of the DNS record. - returned: success - type: str - sample: web - record_type: - description: The name of the DNS record. - returned: success - type: str - sample: web - data: - description: Data of the DNS record. - returned: success - type: str - sample: 10.10.10.10 - domain: - description: Domain the DNS record is related to. - returned: success - type: str - sample: example.com - priority: - description: Priority of the DNS record. - returned: success - type: int - sample: 10 - ttl: - description: Time to live of the DNS record. - returned: success - type: int - sample: 300 -''' - -from ansible.module_utils.basic import AnsibleModule -from ..module_utils.vultr import ( - Vultr, - vultr_argument_spec, -) - -RECORD_TYPES = [ - 'A', - 'AAAA', - 'CNAME', - 'MX', - 'TXT', - 'NS', - 'SRV', - 'CAA', - 'SSHFP' -] - - -class AnsibleVultrDnsRecord(Vultr): - - def __init__(self, module): - super(AnsibleVultrDnsRecord, self).__init__(module, "vultr_dns_record") - - self.returns = { - 'RECORDID': dict(key='id'), - 'name': dict(), - 'record': dict(), - 'priority': dict(), - 'data': dict(), - 'type': dict(key='record_type'), - 'ttl': dict(), - } - - def get_record(self): - records = self.api_query(path="/v1/dns/records?domain=%s" % self.module.params.get('domain')) - - multiple = self.module.params.get('multiple') - data = self.module.params.get('data') - name = self.module.params.get('name') - record_type = self.module.params.get('record_type') - - result = {} - for record in records or []: - if record.get('type') != record_type: - continue - - if record.get('name') == name: - if not multiple: - if result: - self.module.fail_json(msg="More than one record with record_type=%s and name=%s params. " - "Use multiple=yes for more than one record." % (record_type, name)) - else: - result = record - elif record.get('data') == data: - return record - - return result - - def present_record(self): - record = self.get_record() - if not record: - record = self._create_record(record) - else: - record = self._update_record(record) - return record - - def _create_record(self, record): - self.result['changed'] = True - data = { - 'name': self.module.params.get('name'), - 'domain': self.module.params.get('domain'), - 'data': self.module.params.get('data'), - 'type': self.module.params.get('record_type'), - 'priority': self.module.params.get('priority'), - 'ttl': self.module.params.get('ttl'), - } - self.result['diff']['before'] = {} - self.result['diff']['after'] = data - - if not self.module.check_mode: - self.api_query( - path="/v1/dns/create_record", - method="POST", - data=data - ) - record = self.get_record() - return record - - def _update_record(self, record): - data = { - 'RECORDID': record['RECORDID'], - 'name': self.module.params.get('name'), - 'domain': self.module.params.get('domain'), - 'data': self.module.params.get('data'), - 'type': self.module.params.get('record_type'), - 'priority': self.module.params.get('priority'), - 'ttl': self.module.params.get('ttl'), - } - has_changed = [k for k in data if k in record and data[k] != record[k]] - if has_changed: - self.result['changed'] = True - - self.result['diff']['before'] = record - self.result['diff']['after'] = record.copy() - self.result['diff']['after'].update(data) - - if not self.module.check_mode: - self.api_query( - path="/v1/dns/update_record", - method="POST", - data=data - ) - record = self.get_record() - return record - - def absent_record(self): - record = self.get_record() - if record: - self.result['changed'] = True - - data = { - 'RECORDID': record['RECORDID'], - 'domain': self.module.params.get('domain'), - } - - self.result['diff']['before'] = record - self.result['diff']['after'] = {} - - if not self.module.check_mode: - self.api_query( - path="/v1/dns/delete_record", - method="POST", - data=data - ) - return record - - -def main(): - argument_spec = vultr_argument_spec() - argument_spec.update(dict( - domain=dict(type='str', required=True), - name=dict(type='str', default="", aliases=['subrecord']), - state=dict(type='str', choices=['present', 'absent'], default='present'), - ttl=dict(type='int', default=300), - record_type=dict(type='str', choices=RECORD_TYPES, default='A', aliases=['type']), - multiple=dict(type='bool', default=False), - priority=dict(type='int', default=0), - data=dict(type='str',) - )) - - module = AnsibleModule( - argument_spec=argument_spec, - required_if=[ - ('state', 'present', ['data']), - ('multiple', True, ['data']), - ], - - supports_check_mode=True, - ) - - vultr_record = AnsibleVultrDnsRecord(module) - if module.params.get('state') == "absent": - record = vultr_record.absent_record() - else: - record = vultr_record.present_record() - - result = vultr_record.get_result(record) - module.exit_json(**result) - - -if __name__ == '__main__': - main() diff --git a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_firewall_group.py b/ansible_collections/ngine_io/vultr/plugins/modules/vultr_firewall_group.py deleted file mode 100644 index 36ef3b435..000000000 --- a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_firewall_group.py +++ /dev/null @@ -1,201 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -# -# Copyright (c) 2017, René Moser <mail@renemoser.net> -# 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 - - -DOCUMENTATION = ''' ---- -module: vultr_firewall_group -short_description: Manages firewall groups on Vultr. -description: - - Create and remove firewall groups. -version_added: "0.1.0" -author: "René Moser (@resmo)" -options: - name: - description: - - Name of the firewall group. - required: true - aliases: [ description ] - type: str - state: - description: - - State of the firewall group. - default: present - choices: [ present, absent ] - type: str -extends_documentation_fragment: -- ngine_io.vultr.vultr - -''' - -EXAMPLES = ''' -- name: ensure a firewall group is present - ngine_io.vultr.vultr_firewall_group: - name: my http firewall - -- name: ensure a firewall group is absent - ngine_io.vultr.vultr_firewall_group: - name: my http firewall - state: absent -''' - -RETURN = ''' ---- -vultr_api: - description: Response from Vultr API with a few additions/modification - returned: success - type: complex - contains: - api_account: - description: Account used in the ini file to select the key - returned: success - type: str - sample: default - api_timeout: - description: Timeout used for the API requests - returned: success - type: int - sample: 60 - api_retries: - description: Amount of max retries for the API requests - returned: success - type: int - sample: 5 - api_retry_max_delay: - description: Exponential backoff delay in seconds between retries up to this max delay value. - returned: success - type: int - sample: 12 - api_endpoint: - description: Endpoint used for the API requests - returned: success - type: str - sample: "https://api.vultr.com" -vultr_firewall_group: - description: Response from Vultr API - returned: success - type: complex - contains: - id: - description: ID of the firewall group - returned: success - type: str - sample: 1234abcd - name: - description: Name of the firewall group - returned: success - type: str - sample: my firewall group - date_created: - description: Date the firewall group was created - returned: success - type: str - sample: "2017-08-26 12:47:48" - date_modified: - description: Date the firewall group was modified - returned: success - type: str - sample: "2017-08-26 12:47:48" -''' - -from ansible.module_utils.basic import AnsibleModule -from ..module_utils.vultr import ( - Vultr, - vultr_argument_spec, -) - - -class AnsibleVultrFirewallGroup(Vultr): - - def __init__(self, module): - super(AnsibleVultrFirewallGroup, self).__init__(module, "vultr_firewall_group") - - self.returns = { - 'FIREWALLGROUPID': dict(key='id'), - 'description': dict(key='name'), - 'date_created': dict(), - 'date_modified': dict(), - } - - def get_firewall_group(self): - firewall_groups = self.api_query(path="/v1/firewall/group_list") - if firewall_groups: - for firewall_group_id, firewall_group_data in firewall_groups.items(): - if firewall_group_data.get('description') == self.module.params.get('name'): - return firewall_group_data - return {} - - def present_firewall_group(self): - firewall_group = self.get_firewall_group() - if not firewall_group: - firewall_group = self._create_firewall_group(firewall_group) - return firewall_group - - def _create_firewall_group(self, firewall_group): - self.result['changed'] = True - data = { - 'description': self.module.params.get('name'), - } - self.result['diff']['before'] = {} - self.result['diff']['after'] = data - - if not self.module.check_mode: - self.api_query( - path="/v1/firewall/group_create", - method="POST", - data=data - ) - firewall_group = self.get_firewall_group() - return firewall_group - - def absent_firewall_group(self): - firewall_group = self.get_firewall_group() - if firewall_group: - self.result['changed'] = True - - data = { - 'FIREWALLGROUPID': firewall_group['FIREWALLGROUPID'], - } - - self.result['diff']['before'] = firewall_group - self.result['diff']['after'] = {} - - if not self.module.check_mode: - self.api_query( - path="/v1/firewall/group_delete", - method="POST", - data=data - ) - return firewall_group - - -def main(): - argument_spec = vultr_argument_spec() - argument_spec.update(dict( - name=dict(type='str', required=True, aliases=['description']), - state=dict(type='str', choices=['present', 'absent'], default='present'), - )) - - module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True, - ) - - vultr_firewall_group = AnsibleVultrFirewallGroup(module) - if module.params.get('state') == "absent": - firewall_group = vultr_firewall_group.absent_firewall_group() - else: - firewall_group = vultr_firewall_group.present_firewall_group() - - result = vultr_firewall_group.get_result(firewall_group) - module.exit_json(**result) - - -if __name__ == '__main__': - main() diff --git a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_firewall_group_info.py b/ansible_collections/ngine_io/vultr/plugins/modules/vultr_firewall_group_info.py deleted file mode 100644 index 52b3eb0ae..000000000 --- a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_firewall_group_info.py +++ /dev/null @@ -1,139 +0,0 @@ -#!/usr/bin/python -# -# Copyright (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 - - -DOCUMENTATION = r''' ---- -module: vultr_firewall_group_info -short_description: Gather information about the Vultr firewall groups available. -description: - - Gather information about firewall groups available in Vultr. -version_added: "0.1.0" -author: "Yanis Guenane (@Spredzy)" -extends_documentation_fragment: -- ngine_io.vultr.vultr - -''' - -EXAMPLES = r''' -- name: Gather Vultr firewall groups information - ngine_io.vultr.vultr_firewall_group_info: - register: result - -- name: Print the gathered information - debug: - var: result.vultr_firewall_group_info -''' - -RETURN = r''' ---- -vultr_api: - description: Response from Vultr API with a few additions/modification - returned: success - type: complex - contains: - api_account: - description: Account used in the ini file to select the key - returned: success - type: str - sample: default - api_timeout: - description: Timeout used for the API requests - returned: success - type: int - sample: 60 - api_retries: - description: Amount of max retries for the API requests - returned: success - type: int - sample: 5 - api_retry_max_delay: - description: Exponential backoff delay in seconds between retries up to this max delay value. - returned: success - type: int - sample: 12 - api_endpoint: - description: Endpoint used for the API requests - returned: success - type: str - sample: "https://api.vultr.com" -vultr_firewall_group_info: - description: Response from Vultr API - returned: success - type: complex - contains: - id: - description: ID of the firewall group - returned: success - type: str - sample: 1234abcd - description: - description: Name of the firewall group - returned: success - type: str - sample: my firewall group - date_created: - description: Date the firewall group was created - returned: success - type: str - sample: "2017-08-26 12:47:48" - date_modified: - description: Date the firewall group was modified - returned: success - type: str - sample: "2017-08-26 12:47:48" -''' - -from ansible.module_utils.basic import AnsibleModule -from ..module_utils.vultr import ( - Vultr, - vultr_argument_spec, -) - - -class AnsibleVultrFirewallGroupInfo(Vultr): - - def __init__(self, module): - super(AnsibleVultrFirewallGroupInfo, self).__init__(module, "vultr_firewall_group_info") - - self.returns = { - "FIREWALLGROUPID": dict(key='id'), - "date_created": dict(), - "date_modified": dict(), - "description": dict(), - "instance_count": dict(convert_to='int'), - "max_rule_count": dict(convert_to='int'), - "rule_count": dict(convert_to='int') - } - - def get_firewall_group(self): - return self.api_query(path="/v1/firewall/group_list") - - -def parse_fw_group_list(fwgroups_list): - if not fwgroups_list: - return [] - - return [group for id, group in fwgroups_list.items()] - - -def main(): - argument_spec = vultr_argument_spec() - - module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True, - ) - - fw_group_info = AnsibleVultrFirewallGroupInfo(module) - result = fw_group_info.get_result(parse_fw_group_list(fw_group_info.get_firewall_group())) - module.exit_json(**result) - - -if __name__ == '__main__': - main() diff --git a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_firewall_rule.py b/ansible_collections/ngine_io/vultr/plugins/modules/vultr_firewall_rule.py deleted file mode 100644 index f9a59b2b0..000000000 --- a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_firewall_rule.py +++ /dev/null @@ -1,384 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -# -# Copyright (c) 2017, René Moser <mail@renemoser.net> -# 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 - - -DOCUMENTATION = ''' ---- -module: vultr_firewall_rule -short_description: Manages firewall rules on Vultr. -description: - - Create and remove firewall rules. -version_added: "0.1.0" -author: "René Moser (@resmo)" -options: - group: - description: - - Name of the firewall group. - required: true - type: str - ip_version: - description: - - IP address version - choices: [ v4, v6 ] - default: v4 - aliases: [ ip_type ] - type: str - protocol: - description: - - Protocol of the firewall rule. - choices: [ icmp, tcp, udp, gre ] - default: tcp - type: str - cidr: - description: - - Network in CIDR format - - The CIDR format must match with the C(ip_version) value. - - Required if C(state=present). - - Defaulted to 0.0.0.0/0 or ::/0 depending on C(ip_version). - type: str - start_port: - description: - - Start port for the firewall rule. - - Required if C(protocol) is tcp or udp and I(state=present). - aliases: [ port ] - type: int - end_port: - description: - - End port for the firewall rule. - - Only considered if C(protocol) is tcp or udp and I(state=present). - type: int - state: - description: - - State of the firewall rule. - default: present - choices: [ present, absent ] - type: str -extends_documentation_fragment: -- ngine_io.vultr.vultr - -''' - -EXAMPLES = ''' -- name: ensure a firewall rule is present - ngine_io.vultr.vultr_firewall_rule: - group: application - protocol: tcp - start_port: 8000 - end_port: 9000 - cidr: 17.17.17.0/24 - -- name: open DNS port for all ipv4 and ipv6 - ngine_io.vultr.vultr_firewall_rule: - group: dns - protocol: udp - port: 53 - ip_version: "{{ item }}" - with_items: [ v4, v6 ] - -- name: allow ping - ngine_io.vultr.vultr_firewall_rule: - group: web - protocol: icmp - -- name: ensure a firewall rule is absent - ngine_io.vultr.vultr_firewall_rule: - group: application - protocol: tcp - start_port: 8000 - end_port: 9000 - cidr: 17.17.17.0/24 - state: absent -''' - -RETURN = ''' ---- -vultr_api: - description: Response from Vultr API with a few additions/modification - returned: success - type: complex - contains: - api_account: - description: Account used in the ini file to select the key - returned: success - type: str - sample: default - api_timeout: - description: Timeout used for the API requests - returned: success - type: int - sample: 60 - api_retries: - description: Amount of max retries for the API requests - returned: success - type: int - sample: 5 - api_retry_max_delay: - description: Exponential backoff delay in seconds between retries up to this max delay value. - returned: success - type: int - sample: 12 - api_endpoint: - description: Endpoint used for the API requests - returned: success - type: str - sample: "https://api.vultr.com" -vultr_firewall_rule: - description: Response from Vultr API - returned: success - type: complex - contains: - rule_number: - description: Rule number of the firewall rule - returned: success - type: int - sample: 2 - action: - description: Action of the firewall rule - returned: success - type: str - sample: accept - protocol: - description: Protocol of the firewall rule - returned: success - type: str - sample: tcp - start_port: - description: Start port of the firewall rule - returned: success and protocol is tcp or udp - type: int - sample: 80 - end_port: - description: End port of the firewall rule - returned: success and when port range and protocol is tcp or udp - type: int - sample: 8080 - cidr: - description: CIDR of the firewall rule (IPv4 or IPv6) - returned: success and when port range - type: str - sample: 0.0.0.0/0 - group: - description: Firewall group the rule is into. - returned: success - type: str - sample: web -''' - -from ansible.module_utils.basic import AnsibleModule -from ..module_utils.vultr import ( - Vultr, - vultr_argument_spec, -) - - -class AnsibleVultrFirewallRule(Vultr): - - def __init__(self, module): - super(AnsibleVultrFirewallRule, self).__init__(module, "vultr_firewall_rule") - - self.returns = { - 'rulenumber': dict(key='rule_number'), - 'action': dict(), - 'protocol': dict(), - 'start_port': dict(convert_to='int'), - 'end_port': dict(convert_to='int'), - 'cidr': dict(), - 'group': dict(), - } - self.firewall_group = None - - def get_firewall_group(self): - if self.firewall_group is not None: - return self.firewall_group - - firewall_groups = self.api_query(path="/v1/firewall/group_list") - if firewall_groups: - for firewall_group_id, firewall_group_data in firewall_groups.items(): - if firewall_group_data.get('description') == self.module.params.get('group'): - self.firewall_group = firewall_group_data - return self.firewall_group - self.fail_json(msg="Firewall group not found: %s" % self.module.params.get('group')) - - def _transform_cidr(self): - cidr = self.module.params.get('cidr') - ip_version = self.module.params.get('ip_version') - if cidr is None: - if ip_version == "v6": - cidr = "::/0" - else: - cidr = "0.0.0.0/0" - elif cidr.count('/') != 1: - self.fail_json(msg="CIDR has an invalid format: %s" % cidr) - - return cidr.split('/') - - def get_firewall_rule(self): - ip_version = self.module.params.get('ip_version') - firewall_group_id = self.get_firewall_group()['FIREWALLGROUPID'] - - firewall_rules = self.api_query( - path="/v1/firewall/rule_list" - "?FIREWALLGROUPID=%s" - "&direction=in" - "&ip_type=%s" - % (firewall_group_id, ip_version)) - - if firewall_rules: - subnet, subnet_size = self._transform_cidr() - - for firewall_rule_id, firewall_rule_data in firewall_rules.items(): - if firewall_rule_data.get('protocol') != self.module.params.get('protocol'): - continue - - if ip_version == 'v4' and (firewall_rule_data.get('subnet') or "0.0.0.0") != subnet: - continue - - if ip_version == 'v6' and (firewall_rule_data.get('subnet') or "::") != subnet: - continue - - if int(firewall_rule_data.get('subnet_size')) != int(subnet_size): - continue - - if firewall_rule_data.get('protocol') in ['tcp', 'udp']: - rule_port = firewall_rule_data.get('port') - - end_port = self.module.params.get('end_port') - start_port = self.module.params.get('start_port') - - # Port range "8000 - 8080" from the API - if ' - ' in rule_port: - if end_port is None: - continue - - port_range = "%s - %s" % (start_port, end_port) - if rule_port == port_range: - return firewall_rule_data - - # Single port - elif int(rule_port) == start_port: - return firewall_rule_data - - else: - return firewall_rule_data - - return {} - - def present_firewall_rule(self): - firewall_rule = self.get_firewall_rule() - if not firewall_rule: - firewall_rule = self._create_firewall_rule(firewall_rule) - return firewall_rule - - def _create_firewall_rule(self, firewall_rule): - protocol = self.module.params.get('protocol') - if protocol in ['tcp', 'udp']: - start_port = self.module.params.get('start_port') - - if start_port is None: - self.module.fail_on_missing_params(['start_port']) - - end_port = self.module.params.get('end_port') - if end_port is not None: - - if start_port >= end_port: - self.module.fail_json(msg="end_port must be higher than start_port") - - port_range = "%s:%s" % (start_port, end_port) - else: - port_range = start_port - else: - port_range = None - - self.result['changed'] = True - - subnet, subnet_size = self._transform_cidr() - - data = { - 'FIREWALLGROUPID': self.get_firewall_group()['FIREWALLGROUPID'], - 'direction': 'in', # currently the only option - 'ip_type': self.module.params.get('ip_version'), - 'protocol': protocol, - 'subnet': subnet, - 'subnet_size': subnet_size, - 'port': port_range - } - - self.result['diff']['after'] = data - - if not self.module.check_mode: - self.api_query( - path="/v1/firewall/rule_create", - method="POST", - data=data - ) - firewall_rule = self.get_firewall_rule() - return firewall_rule - - def absent_firewall_rule(self): - firewall_rule = self.get_firewall_rule() - if firewall_rule: - self.result['changed'] = True - - data = { - 'FIREWALLGROUPID': self.get_firewall_group()['FIREWALLGROUPID'], - 'rulenumber': firewall_rule['rulenumber'] - } - - self.result['diff']['before'] = firewall_rule - - if not self.module.check_mode: - self.api_query( - path="/v1/firewall/rule_delete", - method="POST", - data=data - ) - return firewall_rule - - def get_result(self, resource): - if resource: - if 'port' in resource and resource['protocol'] in ['tcp', 'udp']: - if ' - ' in resource['port']: - resource['start_port'], resource['end_port'] = resource['port'].split(' - ') - else: - resource['start_port'] = resource['port'] - if 'subnet' in resource: - resource['cidr'] = "%s/%s" % (resource['subnet'], resource['subnet_size']) - resource['group'] = self.get_firewall_group()['description'] - return super(AnsibleVultrFirewallRule, self).get_result(resource) - - -def main(): - argument_spec = vultr_argument_spec() - argument_spec.update(dict( - group=dict(type='str', required=True), - start_port=dict(type='int', aliases=['port']), - end_port=dict(type='int'), - protocol=dict(type='str', choices=['tcp', 'udp', 'gre', 'icmp'], default='tcp'), - cidr=dict(type='str',), - ip_version=dict(type='str', choices=['v4', 'v6'], default='v4', aliases=['ip_type']), - state=dict(type='str', choices=['present', 'absent'], default='present'), - )) - - module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True, - ) - - vultr_firewall_rule = AnsibleVultrFirewallRule(module) - if module.params.get('state') == "absent": - firewall_rule = vultr_firewall_rule.absent_firewall_rule() - else: - firewall_rule = vultr_firewall_rule.present_firewall_rule() - - result = vultr_firewall_rule.get_result(firewall_rule) - module.exit_json(**result) - - -if __name__ == '__main__': - main() diff --git a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_network.py b/ansible_collections/ngine_io/vultr/plugins/modules/vultr_network.py deleted file mode 100644 index 3992e3d1e..000000000 --- a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_network.py +++ /dev/null @@ -1,232 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -# -# Copyright (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 - - -DOCUMENTATION = ''' ---- -module: vultr_network -short_description: Manages networks on Vultr. -description: - - Manage networks on Vultr. A network cannot be updated. It needs to be deleted and re-created. -version_added: "0.1.0" -author: "Yanis Guenane (@Spredzy)" -options: - name: - description: - - Name of the network. - required: true - aliases: [ description, label ] - type: str - cidr: - description: - - The CIDR IPv4 network block to be used when attaching servers to this network. Required if I(state=present). - type: str - region: - description: - - Region the network is deployed into. Required if I(state=present). - type: str - state: - description: - - State of the network. - default: present - choices: [ present, absent ] - type: str -extends_documentation_fragment: -- ngine_io.vultr.vultr - -''' - -EXAMPLES = ''' -- name: Ensure a network is present - ngine_io.vultr.vultr_network: - name: mynet - cidr: 192.168.42.0/24 - region: Amsterdam - -- name: Ensure a network is absent - ngine_io.vultr.vultr_network: - name: mynet - state: absent -''' - -RETURN = ''' ---- -vultr_api: - description: Response from Vultr API with a few additions/modification - returned: success - type: complex - contains: - api_account: - description: Account used in the ini file to select the key - returned: success - type: str - sample: default - api_timeout: - description: Timeout used for the API requests - returned: success - type: int - sample: 60 - api_retries: - description: Amount of max retries for the API requests - returned: success - type: int - sample: 5 - api_retry_max_delay: - description: Exponential backoff delay in seconds between retries up to this max delay value. - returned: success - type: int - sample: 12 - api_endpoint: - description: Endpoint used for the API requests - returned: success - type: str - sample: "https://api.vultr.com" -vultr_network: - description: Response from Vultr API - returned: success - type: complex - contains: - id: - description: ID of the network - returned: success - type: str - sample: "net5b62c6dc63ef5" - name: - description: Name (label) of the network - returned: success - type: str - sample: "mynetwork" - date_created: - description: Date when the network was created - returned: success - type: str - sample: "2018-08-02 08:54:52" - region: - description: Region the network was deployed into - returned: success - type: str - sample: "Amsterdam" - v4_subnet: - description: IPv4 Network address - returned: success - type: str - sample: "192.168.42.0" - v4_subnet_mask: - description: Ipv4 Network mask - returned: success - type: int - sample: 24 -''' - -from ansible.module_utils.basic import AnsibleModule -from ..module_utils.vultr import ( - Vultr, - vultr_argument_spec, -) - - -class AnsibleVultrNetwork(Vultr): - - def __init__(self, module): - super(AnsibleVultrNetwork, self).__init__(module, "vultr_network") - - self.returns = { - 'NETWORKID': dict(key='id'), - 'DCID': dict(key='region', transform=self._get_region_name), - 'date_created': dict(), - 'description': dict(key='name'), - 'v4_subnet': dict(), - 'v4_subnet_mask': dict(convert_to='int'), - } - - def _get_region_name(self, region_id=None): - return self.get_region().get('name') - - def get_network(self): - networks = self.api_query(path="/v1/network/list") - if networks: - for id, network in networks.items(): - if network.get('description') == self.module.params.get('name'): - return network - return {} - - def present_network(self): - network = self.get_network() - if not network: - network = self._create_network(network) - return network - - def _create_network(self, network): - self.result['changed'] = True - data = { - 'description': self.module.params.get('name'), - 'DCID': self.get_region()['DCID'], - 'v4_subnet': self.module.params.get('cidr').split('/')[0], - 'v4_subnet_mask': self.module.params.get('cidr').split('/')[1] - } - self.result['diff']['before'] = {} - self.result['diff']['after'] = data - - if not self.module.check_mode: - self.api_query( - path="/v1/network/create", - method="POST", - data=data - ) - network = self.get_network() - return network - - def absent_network(self): - network = self.get_network() - if network: - self.result['changed'] = True - - data = { - 'NETWORKID': network['NETWORKID'], - } - - self.result['diff']['before'] = network - self.result['diff']['after'] = {} - - if not self.module.check_mode: - self.api_query( - path="/v1/network/destroy", - method="POST", - data=data - ) - return network - - -def main(): - argument_spec = vultr_argument_spec() - argument_spec.update(dict( - name=dict(type='str', required=True, aliases=['description', 'label']), - cidr=dict(type='str',), - region=dict(type='str',), - state=dict(choices=['present', 'absent'], default='present'), - )) - - module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True, - required_if=[['state', 'present', ['cidr', 'region']]] - ) - - vultr_network = AnsibleVultrNetwork(module) - if module.params.get('state') == "absent": - network = vultr_network.absent_network() - else: - network = vultr_network.present_network() - - result = vultr_network.get_result(network) - module.exit_json(**result) - - -if __name__ == '__main__': - main() diff --git a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_network_info.py b/ansible_collections/ngine_io/vultr/plugins/modules/vultr_network_info.py deleted file mode 100644 index 85f6471ab..000000000 --- a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_network_info.py +++ /dev/null @@ -1,156 +0,0 @@ -#!/usr/bin/python -# -# Copyright (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 - - -DOCUMENTATION = r''' ---- -module: vultr_network_info -short_description: Gather information about the Vultr networks available. -description: - - Gather information about networks available in Vultr. -version_added: "0.1.0" -author: "Yanis Guenane (@Spredzy)" -extends_documentation_fragment: -- ngine_io.vultr.vultr - -''' - -EXAMPLES = r''' -- name: Gather Vultr networks information - ngine_io.vultr.vultr_network_info: - register: result - -- name: Print the gathered information - debug: - var: result.vultr_network_info -''' - -RETURN = r''' ---- -vultr_api: - description: Response from Vultr API with a few additions/modification - returned: success - type: complex - contains: - api_account: - description: Account used in the ini file to select the key - returned: success - type: str - sample: default - api_timeout: - description: Timeout used for the API requests - returned: success - type: int - sample: 60 - api_retries: - description: Amount of max retries for the API requests - returned: success - type: int - sample: 5 - api_retry_max_delay: - description: Exponential backoff delay in seconds between retries up to this max delay value. - returned: success - type: int - sample: 12 - api_endpoint: - description: Endpoint used for the API requests - returned: success - type: str - sample: "https://api.vultr.com" -vultr_network_info: - description: Response from Vultr API - returned: success - type: complex - contains: - id: - description: ID of the network - returned: success - type: str - sample: "net5b62c6dc63ef5" - name: - description: Name (label) of the network - returned: success - type: str - sample: "mynetwork" - date_created: - description: Date when the network was created - returned: success - type: str - sample: "2018-08-02 08:54:52" - region: - description: Region the network was deployed into - returned: success - type: str - sample: "Amsterdam" - v4_subnet: - description: IPv4 Network address - returned: success - type: str - sample: "192.168.42.0" - v4_subnet_mask: - description: Ipv4 Network mask - returned: success - type: int - sample: 24 -''' - -from ansible.module_utils.basic import AnsibleModule -from ..module_utils.vultr import ( - Vultr, - vultr_argument_spec, -) - - -class AnsibleVultrNetworkInfo(Vultr): - - def __init__(self, module): - super(AnsibleVultrNetworkInfo, self).__init__(module, "vultr_network_info") - - self.returns = { - 'DCID': dict(key='region', transform=self._get_region_name), - 'NETWORKID': dict(key='id'), - 'date_created': dict(), - 'description': dict(key='name'), - 'v4_subnet': dict(), - 'v4_subnet_mask': dict(convert_to='int'), - } - - def _get_region_name(self, region): - return self.query_resource_by_key( - key='DCID', - value=region, - resource='regions', - use_cache=True - )['name'] - - def get_networks(self): - return self.api_query(path="/v1/network/list") - - -def parse_network_list(network_list): - if isinstance(network_list, list): - return [] - - return [network for id, network in network_list.items()] - - -def main(): - argument_spec = vultr_argument_spec() - - module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True, - ) - - network_info = AnsibleVultrNetworkInfo(module) - result = network_info.get_result(parse_network_list(network_info.get_networks())) - module.exit_json(**result) - - -if __name__ == '__main__': - main() diff --git a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_os_info.py b/ansible_collections/ngine_io/vultr/plugins/modules/vultr_os_info.py deleted file mode 100644 index 258b50d52..000000000 --- a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_os_info.py +++ /dev/null @@ -1,137 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -# -# Copyright (c) 2018, Yanis Guenane <yanis+ansible@guenane.org> -# Copyright (c) 2019, René Moser <mail@renemoser.net> -# 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 - - -DOCUMENTATION = r''' ---- -module: vultr_os_info -short_description: Get information about the Vultr OSes available. -description: - - Get infos about OSes available to boot servers. -version_added: "0.1.0" -author: - - "Yanis Guenane (@Spredzy)" - - "René Moser (@resmo)" -extends_documentation_fragment: -- ngine_io.vultr.vultr - -''' - -EXAMPLES = r''' -- name: Get Vultr OSes infos - ngine_io.vultr.vultr_os_info: - register: results - -- name: Print the gathered infos - debug: - var: results.vultr_os_info -''' - -RETURN = r''' ---- -vultr_api: - description: Response from Vultr API with a few additions/modification - returned: success - type: complex - contains: - api_account: - description: Account used in the ini file to select the key - returned: success - type: str - sample: default - api_timeout: - description: Timeout used for the API requests - returned: success - type: int - sample: 60 - api_retries: - description: Amount of max retries for the API requests - returned: success - type: int - sample: 5 - api_retry_max_delay: - description: Exponential backoff delay in seconds between retries up to this max delay value. - returned: success - type: int - sample: 12 - api_endpoint: - description: Endpoint used for the API requests - returned: success - type: str - sample: "https://api.vultr.com" -vultr_os_info: - description: Response from Vultr API as list - returned: available - type: complex - contains: - arch: - description: OS Architecture - returned: success - type: str - sample: x64 - family: - description: OS family - returned: success - type: str - sample: openbsd - name: - description: OS name - returned: success - type: str - sample: OpenBSD 6 x64 - windows: - description: OS is a MS Windows - returned: success - type: bool -''' - -from ansible.module_utils.basic import AnsibleModule -from ..module_utils.vultr import ( - Vultr, - vultr_argument_spec, -) - - -class AnsibleVultrOSInfo(Vultr): - - def __init__(self, module): - super(AnsibleVultrOSInfo, self).__init__(module, "vultr_os_info") - - self.returns = { - "OSID": dict(key='id', convert_to='int'), - "arch": dict(), - "family": dict(), - "name": dict(), - "windows": dict(convert_to='bool') - } - - def get_oses(self): - return self.api_query(path="/v1/os/list") - - -def parse_oses_list(oses_list): - return [os for id, os in oses_list.items()] - - -def main(): - argument_spec = vultr_argument_spec() - - module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True, - ) - - os_info = AnsibleVultrOSInfo(module) - result = os_info.get_result(parse_oses_list(os_info.get_oses())) - module.exit_json(**result) - - -if __name__ == '__main__': - main() diff --git a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_plan_baremetal_info.py b/ansible_collections/ngine_io/vultr/plugins/modules/vultr_plan_baremetal_info.py deleted file mode 100644 index 040ca2d94..000000000 --- a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_plan_baremetal_info.py +++ /dev/null @@ -1,140 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -# -# (c) 2018, Yanis Guenane <yanis+ansible@guenane.org> -# (c) 2020, Simon Baerlocher <s.baerlocher@sbaerlocher.ch> -# 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 - -DOCUMENTATION = r''' ---- -module: vultr_plan_baremetal_info -short_description: Gather information about the Vultr Bare Metal plans available. -description: - - Gather information about Bare Metal plans available to boot servers. -version_added: "0.3.0" -author: "Simon Baerlocher (@sbaerlocher)" -extends_documentation_fragment: -- ngine_io.vultr.vultr -''' - -EXAMPLES = r''' -- name: Gather Vultr Bare Metal plans information - ngine_io.vultr.vultr_baremetal_plan_info: - register: result - -- name: Print the gathered information - debug: - var: result.vultr_baremetal_plan_info -''' - -RETURN = r''' ---- -vultr_api: - description: Response from Vultr API with a few additions/modification - returned: success - type: complex - contains: - api_account: - description: Account used in the ini file to select the key - returned: success - type: str - sample: default - api_timeout: - description: Timeout used for the API requests - returned: success - type: int - sample: 60 - api_retries: - description: Amount of max retries for the API requests - returned: success - type: int - sample: 5 - api_retry_max_delay: - description: Exponential backoff delay in seconds between retries up to this max delay value. - returned: success - type: int - sample: 12 - api_endpoint: - description: Endpoint used for the API requests - returned: success - type: str - sample: "https://api.vultr.com" -vultr_plan_baremetal_info: - description: Response from Vultr API - returned: success - type: complex - contains: - plan: - description: List of the Bare Metal plans available. - returned: success - type: list - sample: [{ - "available_locations": [ - 1 - ], - "bandwidth": 40.0, - "bandwidth_gb": 40960, - "disk": 110, - "id": 118, - "name": "32768 MB RAM,110 GB SSD,40.00 TB BW", - "plan_type": "DEDICATED", - "price_per_month": 240.0, - "ram": 32768, - "vcpu_count": 8, - "windows": false - }] -''' - -from ansible.module_utils.basic import AnsibleModule -from ..module_utils.vultr import ( - Vultr, - vultr_argument_spec, -) - - -class AnsibleVultrPlanInfo(Vultr): - - def __init__(self, module): - super(AnsibleVultrPlanInfo, self).__init__(module, "vultr_plan_baremetal_info") - - self.returns = { - "METALPLANID": dict(key='id', convert_to='int'), - "available_locations": dict(), - "bandwidth_tb": dict(convert_to='int'), - "disk": dict(), - "name": dict(), - "plan_type": dict(), - "price_per_month": dict(convert_to='float'), - "ram": dict(convert_to='int'), - "windows": dict(convert_to='bool'), - "cpu_count": dict(convert_to='int'), - "cpu_model": dict(), - "cpu_thread_count": dict(convert_to='int'), - } - - def get_plans_baremetal(self): - return self.api_query(path="/v1/plans/list_baremetal") - - -def parse_plans_baremetal_list(plans_baremetal_list): - return [plan_baremetal for id, plan_baremetal in plans_baremetal_list.items()] - - -def main(): - argument_spec = vultr_argument_spec() - - module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True, - ) - - plan_baremetal_info = AnsibleVultrPlanInfo(module) - result = plan_baremetal_info.get_result(parse_plans_baremetal_list(plan_baremetal_info.get_plans_baremetal())) - module.exit_json(**result) - - -if __name__ == '__main__': - main() diff --git a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_plan_info.py b/ansible_collections/ngine_io/vultr/plugins/modules/vultr_plan_info.py deleted file mode 100644 index 3783ab8b0..000000000 --- a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_plan_info.py +++ /dev/null @@ -1,139 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -# -# Copyright (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 - - -DOCUMENTATION = r''' ---- -module: vultr_plan_info -short_description: Gather information about the Vultr plans available. -description: - - Gather information about plans available to boot servers. -version_added: "0.1.0" -author: "Yanis Guenane (@Spredzy)" -extends_documentation_fragment: -- ngine_io.vultr.vultr -''' - -EXAMPLES = r''' -- name: Gather Vultr plans information - ngine_io.vultr.vultr_plan_info: - register: result - -- name: Print the gathered information - debug: - var: result.vultr_plan_info -''' - -RETURN = r''' ---- -vultr_api: - description: Response from Vultr API with a few additions/modification - returned: success - type: complex - contains: - api_account: - description: Account used in the ini file to select the key - returned: success - type: str - sample: default - api_timeout: - description: Timeout used for the API requests - returned: success - type: int - sample: 60 - api_retries: - description: Amount of max retries for the API requests - returned: success - type: int - sample: 5 - api_retry_max_delay: - description: Exponential backoff delay in seconds between retries up to this max delay value. - returned: success - type: int - sample: 12 - api_endpoint: - description: Endpoint used for the API requests - returned: success - type: str - sample: "https://api.vultr.com" -vultr_plan_info: - description: Response from Vultr API - returned: success - type: complex - contains: - plan: - description: List of the plans available. - returned: success - type: list - sample: [{ - "available_locations": [ - 1 - ], - "bandwidth": 40.0, - "bandwidth_gb": 40960, - "disk": 110, - "id": 118, - "name": "32768 MB RAM,110 GB SSD,40.00 TB BW", - "plan_type": "DEDICATED", - "price_per_month": 240.0, - "ram": 32768, - "vcpu_count": 8, - "windows": false - }] -''' - -from ansible.module_utils.basic import AnsibleModule -from ..module_utils.vultr import ( - Vultr, - vultr_argument_spec, -) - - -class AnsibleVultrPlanInfo(Vultr): - - def __init__(self, module): - super(AnsibleVultrPlanInfo, self).__init__(module, "vultr_plan_info") - - self.returns = { - "VPSPLANID": dict(key='id', convert_to='int'), - "available_locations": dict(), - "bandwidth": dict(convert_to='float'), - "bandwidth_gb": dict(convert_to='int'), - "disk": dict(convert_to='int'), - "name": dict(), - "plan_type": dict(), - "price_per_month": dict(convert_to='float'), - "ram": dict(convert_to='int'), - "vcpu_count": dict(convert_to='int'), - "windows": dict(convert_to='bool') - } - - def get_plans(self): - return self.api_query(path="/v1/plans/list") - - -def parse_plans_list(plans_list): - return [plan for id, plan in plans_list.items()] - - -def main(): - argument_spec = vultr_argument_spec() - - module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True, - ) - - plan_info = AnsibleVultrPlanInfo(module) - result = plan_info.get_result(parse_plans_list(plan_info.get_plans())) - module.exit_json(**result) - - -if __name__ == '__main__': - main() diff --git a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_region_info.py b/ansible_collections/ngine_io/vultr/plugins/modules/vultr_region_info.py deleted file mode 100644 index 2080d2d58..000000000 --- a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_region_info.py +++ /dev/null @@ -1,129 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -# -# Copyright (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 - - -DOCUMENTATION = r''' ---- -module: vultr_region_info -short_description: Gather information about the Vultr regions available. -description: - - Gather information about regions available to boot servers. -version_added: "0.1.0" -author: "Yanis Guenane (@Spredzy)" -extends_documentation_fragment: -- ngine_io.vultr.vultr - -''' - -EXAMPLES = r''' -- name: Gather Vultr regions information - ngine_io.vultr.vultr_region_info: - register: result - -- name: Print the gathered information - debug: - var: result.vultr_region_info -''' - -RETURN = r''' ---- -vultr_api: - description: Response from Vultr API with a few additions/modification - returned: success - type: complex - contains: - api_account: - description: Account used in the ini file to select the key - returned: success - type: str - sample: default - api_timeout: - description: Timeout used for the API requests - returned: success - type: int - sample: 60 - api_retries: - description: Amount of max retries for the API requests - returned: success - type: int - sample: 5 - api_retry_max_delay: - description: Exponential backoff delay in seconds between retries up to this max delay value. - returned: success - type: int - sample: 12 - api_endpoint: - description: Endpoint used for the API requests - returned: success - type: str - sample: "https://api.vultr.com" -vultr_region_info: - description: Response from Vultr API - returned: success - type: list - sample: [ - { - "block_storage": false, - "continent": "Europe", - "country": "GB", - "ddos_protection": true, - "id": 8, - "name": "London", - "regioncode": "LHR", - "state": "" - } - ] -''' - -from ansible.module_utils.basic import AnsibleModule -from ..module_utils.vultr import ( - Vultr, - vultr_argument_spec, -) - - -class AnsibleVultrRegionInfo(Vultr): - - def __init__(self, module): - super(AnsibleVultrRegionInfo, self).__init__(module, "vultr_region_info") - - self.returns = { - "DCID": dict(key='id', convert_to='int'), - "block_storage": dict(convert_to='bool'), - "continent": dict(), - "country": dict(), - "ddos_protection": dict(convert_to='bool'), - "name": dict(), - "regioncode": dict(), - "state": dict() - } - - def get_regions(self): - return self.api_query(path="/v1/regions/list") - - -def parse_regions_list(regions_list): - return [region for id, region in regions_list.items()] - - -def main(): - argument_spec = vultr_argument_spec() - - module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True, - ) - - region_info = AnsibleVultrRegionInfo(module) - result = region_info.get_result(parse_regions_list(region_info.get_regions())) - module.exit_json(**result) - - -if __name__ == '__main__': - main() diff --git a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_server.py b/ansible_collections/ngine_io/vultr/plugins/modules/vultr_server.py deleted file mode 100644 index b423766e2..000000000 --- a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_server.py +++ /dev/null @@ -1,933 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -# -# Copyright (c) 2017, René Moser <mail@renemoser.net> -# 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 - - -DOCUMENTATION = ''' ---- -module: vultr_server -short_description: Manages virtual servers on Vultr. -description: - - Deploy, start, stop, update, restart, reinstall servers. -version_added: "0.1.0" -author: "René Moser (@resmo)" -options: - name: - description: - - Name of the server. - required: true - aliases: [ label ] - type: str - hostname: - description: - - The hostname to assign to this server. - type: str - os: - description: - - The operating system name or ID. - - Required if the server does not yet exist and is not restoring from a snapshot. - type: str - snapshot: - description: - - Name or ID of the snapshot to restore the server from. - type: str - firewall_group: - description: - - The firewall group description or ID to assign this server to. - type: str - plan: - description: - - Plan name or ID to use for the server. - - Required if the server does not yet exist. - type: str - force: - description: - - Force stop/start the server if required to apply changes - - Otherwise a running server will not be changed. - type: bool - default: no - notify_activate: - description: - - Whether to send an activation email when the server is ready or not. - - Only considered on creation. - type: bool - default: false - private_network_enabled: - description: - - Whether to enable private networking or not. - type: bool - auto_backup_enabled: - description: - - Whether to enable automatic backups or not. - type: bool - ipv6_enabled: - description: - - Whether to enable IPv6 or not. - type: bool - tag: - description: - - Tag for the server. - type: str - user_data: - description: - - User data to be passed to the server. - type: str - startup_script: - description: - - Name or ID of the startup script to execute on boot. - - Only considered while creating the server. - type: str - ssh_keys: - description: - - List of SSH key names or IDs passed to the server on creation. - aliases: [ ssh_key ] - type: list - elements: str - reserved_ip_v4: - description: - - IP address of the floating IP to use as the main IP of this server. - - Only considered on creation. - type: str - region: - description: - - Region name or ID the server is deployed into. - - Required if the server does not yet exist. - type: str - state: - description: - - State of the server. - default: present - choices: [ present, absent, restarted, reinstalled, started, stopped ] - type: str -extends_documentation_fragment: -- ngine_io.vultr.vultr - -''' - -EXAMPLES = ''' -- name: create server - ngine_io.vultr.vultr_server: - name: "{{ vultr_server_name }}" - os: CentOS 7 x64 - plan: 1024 MB RAM,25 GB SSD,1.00 TB BW - ssh_keys: - - my_key - - your_key - region: Amsterdam - state: present - -- name: ensure a server is present and started - ngine_io.vultr.vultr_server: - name: "{{ vultr_server_name }}" - os: CentOS 7 x64 - plan: 1024 MB RAM,25 GB SSD,1.00 TB BW - firewall_group: my_group - ssh_key: my_key - region: Amsterdam - state: started - -- name: ensure a server is present and stopped provisioned using IDs - ngine_io.vultr.vultr_server: - name: "{{ vultr_server_name }}" - os: "167" - plan: "201" - region: "7" - state: stopped - -- name: ensure an existing server is stopped - ngine_io.vultr.vultr_server: - name: "{{ vultr_server_name }}" - state: stopped - -- name: ensure an existing server is started - ngine_io.vultr.vultr_server: - name: "{{ vultr_server_name }}" - state: started - -- name: ensure a server is absent - ngine_io.vultr.vultr_server: - name: "{{ vultr_server_name }}" - state: absent -''' - -RETURN = ''' ---- -vultr_api: - description: Response from Vultr API with a few additions/modification - returned: success - type: complex - contains: - api_account: - description: Account used in the ini file to select the key - returned: success - type: str - sample: default - api_timeout: - description: Timeout used for the API requests - returned: success - type: int - sample: 60 - api_retries: - description: Amount of max retries for the API requests - returned: success - type: int - sample: 5 - api_retry_max_delay: - description: Exponential backoff delay in seconds between retries up to this max delay value. - returned: success - type: int - sample: 12 - api_endpoint: - description: Endpoint used for the API requests - returned: success - type: str - sample: "https://api.vultr.com" -vultr_server: - description: Response from Vultr API with a few additions/modification - returned: success - type: complex - contains: - id: - description: ID of the server - returned: success - type: str - sample: 10194376 - name: - description: Name (label) of the server - returned: success - type: str - sample: "ansible-test-vm" - plan: - description: Plan used for the server - returned: success - type: str - sample: "1024 MB RAM,25 GB SSD,1.00 TB BW" - allowed_bandwidth_gb: - description: Allowed bandwidth to use in GB - returned: success - type: float - sample: 1000.5 - auto_backup_enabled: - description: Whether automatic backups are enabled - returned: success - type: bool - sample: false - cost_per_month: - description: Cost per month for the server - returned: success - type: float - sample: 5.00 - current_bandwidth_gb: - description: Current bandwidth used for the server - returned: success - type: int - sample: 0 - date_created: - description: Date when the server was created - returned: success - type: str - sample: "2017-08-26 12:47:48" - default_password: - description: Password to login as root into the server - returned: success - type: str - sample: "!p3EWYJm$qDWYaFr" - disk: - description: Information about the disk - returned: success - type: str - sample: "Virtual 25 GB" - v4_gateway: - description: IPv4 gateway - returned: success - type: str - sample: "45.32.232.1" - internal_ip: - description: Internal IP - returned: success - type: str - sample: "" - kvm_url: - description: URL to the VNC - returned: success - type: str - sample: "https://my.vultr.com/subs/vps/novnc/api.php?data=xyz" - region: - description: Region the server was deployed into - returned: success - type: str - sample: "Amsterdam" - v4_main_ip: - description: Main IPv4 - returned: success - type: str - sample: "45.32.233.154" - v4_netmask: - description: Netmask IPv4 - returned: success - type: str - sample: "255.255.254.0" - os: - description: Operating system used for the server - returned: success - type: str - sample: "CentOS 6 x64" - firewall_group: - description: Firewall group the server is assigned to - returned: success and available - type: str - sample: "CentOS 6 x64" - pending_charges: - description: Pending charges - returned: success - type: float - sample: 0.01 - power_status: - description: Power status of the server - returned: success - type: str - sample: "running" - ram: - description: Information about the RAM size - returned: success - type: str - sample: "1024 MB" - server_state: - description: State about the server - returned: success - type: str - sample: "ok" - status: - description: Status about the deployment of the server - returned: success - type: str - sample: "active" - tag: - description: TBD - returned: success - type: str - sample: "" - v6_main_ip: - description: Main IPv6 - returned: success - type: str - sample: "" - v6_network: - description: Network IPv6 - returned: success - type: str - sample: "" - v6_network_size: - description: Network size IPv6 - returned: success - type: str - sample: "" - v6_networks: - description: Networks IPv6 - returned: success - type: list - sample: [] - vcpu_count: - description: Virtual CPU count - returned: success - type: int - sample: 1 -''' - -import time -import base64 -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils._text import to_text, to_bytes -from ..module_utils.vultr import ( - Vultr, - vultr_argument_spec, -) - - -class AnsibleVultrServer(Vultr): - - def __init__(self, module): - super(AnsibleVultrServer, self).__init__(module, "vultr_server") - - self.server = None - self.returns = { - 'SUBID': dict(key='id'), - 'label': dict(key='name'), - 'date_created': dict(), - 'allowed_bandwidth_gb': dict(convert_to='float'), - 'auto_backups': dict(key='auto_backup_enabled', convert_to='bool'), - 'current_bandwidth_gb': dict(), - 'kvm_url': dict(), - 'default_password': dict(), - 'internal_ip': dict(), - 'disk': dict(), - 'cost_per_month': dict(convert_to='float'), - 'location': dict(key='region'), - 'main_ip': dict(key='v4_main_ip'), - 'network_v4': dict(key='v4_network'), - 'gateway_v4': dict(key='v4_gateway'), - 'os': dict(), - 'pending_charges': dict(convert_to='float'), - 'power_status': dict(), - 'ram': dict(), - 'plan': dict(), - 'server_state': dict(), - 'status': dict(), - 'firewall_group': dict(), - 'tag': dict(), - 'v6_main_ip': dict(), - 'v6_network': dict(), - 'v6_network_size': dict(), - 'v6_networks': dict(), - 'vcpu_count': dict(convert_to='int'), - } - self.server_power_state = None - - def get_startup_script(self): - return self.query_resource_by_key( - key='name', - value=self.module.params.get('startup_script'), - resource='startupscript', - ) - - def get_os(self): - if self.module.params.get('snapshot'): - os_name = 'Snapshot' - else: - os_name = self.module.params.get('os') - - return self.query_resource_by_key( - key='name', - value=os_name, - resource='os', - use_cache=True, - id_key='OSID', - ) - - def get_snapshot(self): - return self.query_resource_by_key( - key='description', - value=self.module.params.get('snapshot'), - resource='snapshot', - id_key='SNAPSHOTID', - ) - - def get_ssh_keys(self): - ssh_key_names = self.module.params.get('ssh_keys') - if not ssh_key_names: - return [] - - ssh_keys = [] - for ssh_key_name in ssh_key_names: - ssh_key = self.query_resource_by_key( - key='name', - value=ssh_key_name, - resource='sshkey', - use_cache=True, - id_key='SSHKEYID', - ) - if ssh_key: - ssh_keys.append(ssh_key) - return ssh_keys - - def get_region(self): - return self.query_resource_by_key( - key='name', - value=self.module.params.get('region'), - resource='regions', - use_cache=True, - id_key='DCID', - ) - - def get_firewall_group(self): - return self.query_resource_by_key( - key='description', - value=self.module.params.get('firewall_group'), - resource='firewall', - query_by='group_list', - id_key='FIREWALLGROUPID' - ) - - def get_user_data(self): - user_data = self.module.params.get('user_data') - if user_data is not None: - user_data = to_text(base64.b64encode(to_bytes(user_data))) - return user_data - - def get_server_user_data(self, server): - if not server or not server.get('SUBID'): - return None - - user_data = self.api_query(path="/v1/server/get_user_data?SUBID=%s" % server.get('SUBID')) - return user_data.get('userdata') - - def get_server(self, refresh=False): - if self.server is None or refresh: - self.server = None - server_list = self.api_query(path="/v1/server/list") - if server_list: - for server_id, server_data in server_list.items(): - if server_data.get('label') == self.module.params.get('name'): - self.server = server_data - - plan = self.query_resource_by_key( - key='VPSPLANID', - value=server_data['VPSPLANID'], - resource='plans', - use_cache=True - ) - self.server['plan'] = plan.get('name') - - os = self.query_resource_by_key( - key='OSID', - value=int(server_data['OSID']), - resource='os', - use_cache=True - ) - self.server['os'] = os.get('name') - - fwg_id = server_data.get('FIREWALLGROUPID') - fw = self.query_resource_by_key( - key='FIREWALLGROUPID', - value=server_data.get('FIREWALLGROUPID') if fwg_id and fwg_id != "0" else None, - resource='firewall', - query_by='group_list', - use_cache=True - ) - self.server['firewall_group'] = fw.get('description') - return self.server - - def present_server(self, start_server=True): - server = self.get_server() - if not server: - server = self._create_server(server=server) - else: - server = self._update_server(server=server, start_server=start_server) - return server - - def _create_server(self, server=None): - required_params = [ - 'os', - 'plan', - 'region', - ] - - snapshot_restore = self.module.params.get('snapshot') is not None - if snapshot_restore: - required_params.remove('os') - - self.module.fail_on_missing_params(required_params=required_params) - - self.result['changed'] = True - if not self.module.check_mode: - data = { - 'DCID': self.get_region().get('DCID'), - 'VPSPLANID': self.get_plan().get('VPSPLANID'), - 'FIREWALLGROUPID': self.get_firewall_group().get('FIREWALLGROUPID'), - 'OSID': self.get_os().get('OSID'), - 'SNAPSHOTID': self.get_snapshot().get('SNAPSHOTID'), - 'label': self.module.params.get('name'), - 'hostname': self.module.params.get('hostname'), - 'SSHKEYID': ','.join([ssh_key['SSHKEYID'] for ssh_key in self.get_ssh_keys()]), - 'enable_ipv6': self.get_yes_or_no('ipv6_enabled'), - 'enable_private_network': self.get_yes_or_no('private_network_enabled'), - 'auto_backups': self.get_yes_or_no('auto_backup_enabled'), - 'notify_activate': self.get_yes_or_no('notify_activate'), - 'tag': self.module.params.get('tag'), - 'reserved_ip_v4': self.module.params.get('reserved_ip_v4'), - 'userdata': self.get_user_data(), - 'SCRIPTID': self.get_startup_script().get('SCRIPTID'), - } - self.api_query( - path="/v1/server/create", - method="POST", - data=data - ) - server = self._wait_for_state(key='status', state='active') - server = self._wait_for_state(state='running', timeout=3600 if snapshot_restore else 60) - return server - - def _update_auto_backups_setting(self, server, start_server): - auto_backup_enabled_changed = self.switch_enable_disable(server, 'auto_backup_enabled', 'auto_backups') - - if auto_backup_enabled_changed: - if auto_backup_enabled_changed == "enable" and server['auto_backups'] == 'disable': - self.module.warn("Backups are disabled. Once disabled, backups can only be enabled again by customer support") - else: - server, warned = self._handle_power_status_for_update(server, start_server) - if not warned: - self.result['changed'] = True - self.result['diff']['before']['auto_backup_enabled'] = server.get('auto_backups') - self.result['diff']['after']['auto_backup_enabled'] = self.get_yes_or_no('auto_backup_enabled') - - if not self.module.check_mode: - data = { - 'SUBID': server['SUBID'] - } - self.api_query( - path="/v1/server/backup_%s" % auto_backup_enabled_changed, - method="POST", - data=data - ) - return server - - def _update_ipv6_setting(self, server, start_server): - ipv6_enabled_changed = self.switch_enable_disable(server, 'ipv6_enabled', 'v6_main_ip') - - if ipv6_enabled_changed: - if ipv6_enabled_changed == "disable": - self.module.warn("The Vultr API does not allow to disable IPv6") - else: - server, warned = self._handle_power_status_for_update(server, start_server) - if not warned: - self.result['changed'] = True - self.result['diff']['before']['ipv6_enabled'] = False - self.result['diff']['after']['ipv6_enabled'] = True - - if not self.module.check_mode: - data = { - 'SUBID': server['SUBID'] - } - self.api_query( - path="/v1/server/ipv6_%s" % ipv6_enabled_changed, - method="POST", - data=data - ) - server = self._wait_for_state(key='v6_main_ip') - return server - - def _update_private_network_setting(self, server, start_server): - private_network_enabled_changed = self.switch_enable_disable(server, 'private_network_enabled', 'internal_ip') - if private_network_enabled_changed: - if private_network_enabled_changed == "disable": - self.module.warn("The Vultr API does not allow to disable private network") - else: - server, warned = self._handle_power_status_for_update(server, start_server) - if not warned: - self.result['changed'] = True - self.result['diff']['before']['private_network_enabled'] = False - self.result['diff']['after']['private_network_enabled'] = True - - if not self.module.check_mode: - data = { - 'SUBID': server['SUBID'] - } - self.api_query( - path="/v1/server/private_network_%s" % private_network_enabled_changed, - method="POST", - data=data - ) - return server - - def _update_plan_setting(self, server, start_server): - # Verify the exising plan is not discontined by Vultr and therefore won't be found by the API - server_plan = self.get_plan(plan=server.get('VPSPLANID'), optional=True) - if not server_plan: - plan = self.get_plan(optional=True) - if not plan: - self.module.warn("The plan used to create the server is not longer available as well as the desired plan. Assuming same plan, keeping as is.") - return server - else: - plan = self.get_plan() - - plan_changed = True if plan and plan['VPSPLANID'] != server.get('VPSPLANID') else False - if plan_changed: - server, warned = self._handle_power_status_for_update(server, start_server) - if not warned: - self.result['changed'] = True - self.result['diff']['before']['plan'] = server.get('plan') - self.result['diff']['after']['plan'] = plan['name'] - - if not self.module.check_mode: - data = { - 'SUBID': server['SUBID'], - 'VPSPLANID': plan['VPSPLANID'], - } - self.api_query( - path="/v1/server/upgrade_plan", - method="POST", - data=data - ) - return server - - def _handle_power_status_for_update(self, server, start_server): - # Remember the power state before we handle any action - if self.server_power_state is None: - self.server_power_state = server['power_status'] - - # A stopped server can be updated - if self.server_power_state == "stopped": - return server, False - - # A running server must be forced to update unless the wanted state is stopped - elif self.module.params.get('force') or not start_server: - warned = False - if not self.module.check_mode: - # Some update APIs would restart the VM, we handle the restart manually - # by stopping the server and start it at the end of the changes - server = self.stop_server(skip_results=True) - - # Warn the user that a running server won't get changed - else: - warned = True - self.module.warn("Some changes won't be applied to running instances. " + - "Use force=true to allow the instance %s to be stopped/started." % server['label']) - - return server, warned - - def _update_server(self, server=None, start_server=True): - # Wait for server to unlock if restoring - if server.get('os').strip() == 'Snapshot': - server = self._wait_for_state(key='server_status', state='ok', timeout=3600) - - # Update auto backups settings, stops server - server = self._update_auto_backups_setting(server=server, start_server=start_server) - - # Update IPv6 settings, stops server - server = self._update_ipv6_setting(server=server, start_server=start_server) - - # Update private network settings, stops server - server = self._update_private_network_setting(server=server, start_server=start_server) - - # Update plan settings, stops server - server = self._update_plan_setting(server=server, start_server=start_server) - - # User data - user_data = self.get_user_data() - server_user_data = self.get_server_user_data(server=server) - if user_data is not None and user_data != server_user_data: - self.result['changed'] = True - self.result['diff']['before']['user_data'] = server_user_data - self.result['diff']['after']['user_data'] = user_data - - if not self.module.check_mode: - data = { - 'SUBID': server['SUBID'], - 'userdata': user_data, - } - self.api_query( - path="/v1/server/set_user_data", - method="POST", - data=data - ) - - # Tags - tag = self.module.params.get('tag') - if tag is not None and tag != server.get('tag'): - self.result['changed'] = True - self.result['diff']['before']['tag'] = server.get('tag') - self.result['diff']['after']['tag'] = tag - - if not self.module.check_mode: - data = { - 'SUBID': server['SUBID'], - 'tag': tag, - } - self.api_query( - path="/v1/server/tag_set", - method="POST", - data=data - ) - - # Firewall group - firewall_group = self.get_firewall_group() - if firewall_group and firewall_group.get('description') != server.get('firewall_group'): - self.result['changed'] = True - self.result['diff']['before']['firewall_group'] = server.get('firewall_group') - self.result['diff']['after']['firewall_group'] = firewall_group.get('description') - - if not self.module.check_mode: - data = { - 'SUBID': server['SUBID'], - 'FIREWALLGROUPID': firewall_group.get('FIREWALLGROUPID'), - } - self.api_query( - path="/v1/server/firewall_group_set", - method="POST", - data=data - ) - # Start server again if it was running before the changes - if not self.module.check_mode: - if self.server_power_state in ['starting', 'running'] and start_server: - server = self.start_server(skip_results=True) - - server = self._wait_for_state(key='status', state='active') - return server - - def absent_server(self): - server = self.get_server() - if server: - self.result['changed'] = True - self.result['diff']['before']['id'] = server['SUBID'] - self.result['diff']['after']['id'] = "" - if not self.module.check_mode: - data = { - 'SUBID': server['SUBID'] - } - self.api_query( - path="/v1/server/destroy", - method="POST", - data=data - ) - for s in range(0, 60): - if server is not None: - break - time.sleep(2) - server = self.get_server(refresh=True) - else: - self.fail_json(msg="Wait for server '%s' to get deleted timed out" % server['label']) - return server - - def restart_server(self): - self.result['changed'] = True - server = self.get_server() - if server: - if not self.module.check_mode: - data = { - 'SUBID': server['SUBID'] - } - self.api_query( - path="/v1/server/reboot", - method="POST", - data=data - ) - server = self._wait_for_state(state='running') - return server - - def reinstall_server(self): - self.result['changed'] = True - server = self.get_server() - if server: - if not self.module.check_mode: - data = { - 'SUBID': server['SUBID'] - } - self.api_query( - path="/v1/server/reinstall", - method="POST", - data=data - ) - server = self._wait_for_state(state='running') - return server - - def _wait_for_state(self, key='power_status', state=None, timeout=60): - time.sleep(1) - server = self.get_server(refresh=True) - for s in range(0, timeout): - # Check for Truely if wanted state is None - if state is None and server.get(key): - break - elif server.get(key) == state: - break - time.sleep(2) - server = self.get_server(refresh=True) - - # Timed out - else: - if state is None: - msg = "Wait for '%s' timed out" % key - else: - msg = "Wait for '%s' to get into state '%s' timed out" % (key, state) - self.fail_json(msg=msg) - return server - - def start_server(self, skip_results=False): - server = self.get_server() - if server: - if server['power_status'] == 'starting': - server = self._wait_for_state(state='running') - - elif server['power_status'] != 'running': - if not skip_results: - self.result['changed'] = True - self.result['diff']['before']['power_status'] = server['power_status'] - self.result['diff']['after']['power_status'] = "running" - if not self.module.check_mode: - data = { - 'SUBID': server['SUBID'] - } - self.api_query( - path="/v1/server/start", - method="POST", - data=data - ) - server = self._wait_for_state(state='running') - return server - - def stop_server(self, skip_results=False): - server = self.get_server() - if server and server['power_status'] != "stopped": - if not skip_results: - self.result['changed'] = True - self.result['diff']['before']['power_status'] = server['power_status'] - self.result['diff']['after']['power_status'] = "stopped" - if not self.module.check_mode: - data = { - 'SUBID': server['SUBID'], - } - self.api_query( - path="/v1/server/halt", - method="POST", - data=data - ) - server = self._wait_for_state(state='stopped') - return server - - -def main(): - argument_spec = vultr_argument_spec() - argument_spec.update(dict( - name=dict(required=True, aliases=['label']), - hostname=dict(type='str'), - os=dict(type='str'), - snapshot=dict(type='str'), - plan=dict(type='str'), - force=dict(type='bool', default=False), - notify_activate=dict(type='bool', default=False), - private_network_enabled=dict(type='bool'), - auto_backup_enabled=dict(type='bool'), - ipv6_enabled=dict(type='bool'), - tag=dict(type='str'), - reserved_ip_v4=dict(type='str'), - firewall_group=dict(type='str'), - startup_script=dict(type='str'), - user_data=dict(type='str'), - ssh_keys=dict(type='list', elements='str', aliases=['ssh_key'], no_log=False), - region=dict(type='str'), - state=dict(choices=['present', 'absent', 'restarted', 'reinstalled', 'started', 'stopped'], default='present'), - )) - - module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True, - ) - - vultr_server = AnsibleVultrServer(module) - if module.params.get('state') == "absent": - server = vultr_server.absent_server() - else: - if module.params.get('state') == "started": - server = vultr_server.present_server() - server = vultr_server.start_server() - elif module.params.get('state') == "stopped": - server = vultr_server.present_server(start_server=False) - server = vultr_server.stop_server() - elif module.params.get('state') == "restarted": - server = vultr_server.present_server() - server = vultr_server.restart_server() - elif module.params.get('state') == "reinstalled": - server = vultr_server.reinstall_server() - else: - server = vultr_server.present_server() - - result = vultr_server.get_result(server) - module.exit_json(**result) - - -if __name__ == '__main__': - main() diff --git a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_server_baremetal.py b/ansible_collections/ngine_io/vultr/plugins/modules/vultr_server_baremetal.py deleted file mode 100644 index 279f3d14b..000000000 --- a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_server_baremetal.py +++ /dev/null @@ -1,548 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -# -# (c) 2019, Nate River <vitikc@gmail.com> -# (c) 2020, Simon Baerlocher <s.baerlocher@sbaerlocher.ch> -# 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 - -DOCUMENTATION = r''' ---- -module: vultr_server_baremetal -short_description: Manages baremetal servers on Vultr. -description: - - Deploy and destroy servers. -version_added: "0.3.0" -author: - - "Nate River (@vitikc)" - - "Simon Baerlocher (@sbaerlocher)" -options: - name: - description: - - Name of the server. - required: true - aliases: [ label ] - type: str - hostname: - description: - - The hostname to assign to this server. - type: str - os: - description: - - The operating system name or ID. - - Required if the server does not yet exist and is not restoring from a snapshot. - type: str - plan: - description: - - Plan name or ID to use for the server. - - Required if the server does not yet exist. - type: str - notify_activate: - description: - - Whether to send an activation email when the server is ready or not. - - Only considered on creation. - type: bool - default: false - ipv6_enabled: - description: - - Whether to enable IPv6 or not. - type: bool - tag: - description: - - Tag for the server. - type: str - user_data: - description: - - User data to be passed to the server. - type: str - startup_script: - description: - - Name or ID of the startup script to execute on boot. - - Only considered while creating the server. - type: str - ssh_keys: - description: - - List of SSH key names or IDs passed to the server on creation. - aliases: [ ssh_key ] - type: list - elements: str - reserved_ip_v4: - description: - - IP address of the floating IP to use as the main IP of this server. - - Only considered on creation. - type: str - region: - description: - - Region name or ID the server is deployed into. - - Required if the server does not yet exist. - type: str - state: - description: - - State of the server. - default: present - choices: [ present, absent ] - type: str -extends_documentation_fragment: -- ngine_io.vultr.vultr -''' - -EXAMPLES = r''' -- name: create server - ngine_io.vultr.vultr_server_baremetal: - name: "{{ vultr_server_baremetal_name }}" - os: Debian 9 x64 (stretch) - plan: 32768 MB RAM,2x 240 GB SSD,5.00 TB BW - region: Amsterdam - -- name: ensure a server is absent - ngine_io.vultr.vultr_server_baremetal: - name: "{{ vultr_server_baremetal_name }}" - state: absent -''' - -RETURN = r''' ---- -vultr_api: - description: Response from Vultr API with a few additions/modification - returned: success - type: complex - contains: - api_account: - description: Account used in the ini file to select the key - returned: success - type: str - sample: default - api_timeout: - description: Timeout used for the API requests - returned: success - type: int - sample: 60 - api_retries: - description: Amount of max retries for the API requests - returned: success - type: int - sample: 5 - api_endpoint: - description: Endpoint used for the API requests - returned: success - type: str - sample: "https://api.vultr.com" -vultr_server_baremetal: - description: Response from Vultr API with a few additions/modification - returned: success - type: complex - contains: - id: - description: ID of the server - returned: success - type: str - sample: 900000 - name: - description: Name (label) of the server - returned: success - type: str - sample: "ansible-test-baremetal" - plan: - description: Plan used for the server - returned: success - type: str - sample: "32768 MB RAM,2x 240 GB SSD,5.00 TB BW" - allowed_bandwidth_gb: - description: Allowed bandwidth to use in GB - returned: success - type: float - sample: 1000.5 - cost_per_month: - description: Cost per month for the server - returned: success - type: float - sample: 120.00 - current_bandwidth_gb: - description: Current bandwidth used for the server - returned: success - type: int - sample: 0 - date_created: - description: Date when the server was created - returned: success - type: str - sample: "2017-04-12 18:45:41" - default_password: - description: Password to login as root into the server - returned: success - type: str - sample: "ab81u!ryranq" - disk: - description: Information about the disk - returned: success - type: str - sample: "SSD 250 GB" - v4_gateway: - description: IPv4 gateway - returned: success - type: str - sample: "203.0.113.1" - internal_ip: - description: Internal IP - returned: success - type: str - sample: "" - region: - description: Region the server was deployed into - returned: success - type: str - sample: "Amsterdam" - v4_main_ip: - description: Main IPv4 - returned: success - type: str - sample: "203.0.113.10" - v4_netmask: - description: Netmask IPv4 - returned: success - type: str - sample: "255.255.255.0" - os: - description: Operating system used for the server - returned: success - type: str - sample: "Debian 9 x64" - pending_charges: - description: Pending charges - returned: success - type: float - sample: 0.18 - ram: - description: Information about the RAM size - returned: success - type: str - sample: "32768 MB" - status: - description: Status about the deployment of the server - returned: success - type: str - sample: "active" - tag: - description: Server tag - returned: success - type: str - sample: "my tag" - v6_main_ip: - description: Main IPv6 - returned: success - type: str - sample: "2001:DB8:9000::100" - v6_network: - description: Network IPv6 - returned: success - type: str - sample: "2001:DB8:9000::" - v6_network_size: - description: Network size IPv6 - returned: success - type: int - sample: 64 - v6_networks: - description: Networks IPv6 - returned: success - type: list - sample: [] -''' - -import time -import base64 -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils._text import to_text, to_bytes -from ..module_utils.vultr import ( - Vultr, - vultr_argument_spec, -) - - -class AnsibleVultrServerBareMetal(Vultr): - - def __init__(self, module): - super(AnsibleVultrServerBareMetal, self).__init__(module, "vultr_server_baremetal") - - self.server = None - self.returns = { - 'SUBID': dict(key='id'), - 'label': dict(key='name'), - 'date_created': dict(), - 'allowed_bandwidth_gb': dict(convert_to='float'), - 'current_bandwidth_gb': dict(), - 'default_password': dict(), - 'internal_ip': dict(), - 'disk': dict(), - 'cost_per_month': dict(convert_to='float'), - 'location': dict(key='region'), - 'main_ip': dict(key='v4_main_ip'), - 'network_v4': dict(key='v4_network'), - 'gateway_v4': dict(key='v4_gateway'), - 'os': dict(), - 'pending_charges': dict(convert_to='float'), - 'ram': dict(), - 'plan': dict(), - 'status': dict(), - 'tag': dict(), - 'v6_main_ip': dict(), - 'v6_network': dict(), - 'v6_network_size': dict(), - 'v6_networks': dict(), - } - self.server_power_state = None - - def get_startup_script(self): - return self.query_resource_by_key( - key='name', - value=self.module.params.get('startup_script'), - resource='startupscript', - ) - - def get_os(self): - return self.query_resource_by_key( - key='name', - value=self.module.params.get('os'), - resource='os', - use_cache=True - ) - - def get_ssh_keys(self): - ssh_key_names = self.module.params.get('ssh_keys') - if not ssh_key_names: - return [] - - ssh_keys = [] - for ssh_key_name in ssh_key_names: - ssh_key = self.query_resource_by_key( - key='name', - value=ssh_key_name, - resource='sshkey', - use_cache=True - ) - if ssh_key: - ssh_keys.append(ssh_key) - return ssh_keys - - def get_region(self): - return self.query_resource_by_key( - key='name', - value=self.module.params.get('region'), - resource='regions', - use_cache=True - ) - - def get_plan(self): - return self.query_resource_by_key( - key='name', - value=self.module.params.get('plan'), - resource='plans', - query_by='list_baremetal', - use_cache=True - ) - - def get_user_data(self): - user_data = self.module.params.get('user_data') - if user_data is not None: - user_data = to_text(base64.b64encode(to_bytes(user_data))) - return user_data - - def get_server_user_data(self, server): - if not server or not server.get('SUBID'): - return None - - user_data = self.api_query(path="/v1/baremetal/get_user_data?SUBID=%s" % server.get('SUBID')) - return user_data.get('userdata') - - def get_server(self, refresh=False): - if self.server is None or refresh: - self.server = None - server_list = self.api_query(path="/v1/baremetal/list") - if server_list: - for server_id, server_data in server_list.items(): - if server_data.get('label') == self.module.params.get('name'): - self.server = server_data - - plan = self.query_resource_by_key( - key='METALPLANID', - value=server_data['METALPLANID'], - resource='plans', - query_by='list_baremetal', - use_cache=True - ) - self.server['plan'] = plan.get('name') - - os = self.query_resource_by_key( - key='OSID', - value=int(server_data['OSID']), - resource='os', - use_cache=True - ) - self.server['os'] = os.get('name') - return self.server - - def _wait_for_state(self, key='status', state=None): - time.sleep(1) - server = self.get_server(refresh=True) - for s in range(0, 500): - if state is None and server.get(key): - break - elif server.get(key) == state: - break - time.sleep(2) - server = self.get_server(refresh=True) - - # Timed out - else: - if state is None: - msg = "Wait for '%s' timed out" % key - else: - msg = "Wait for '%s' to get into state '%s' timed out" % (key, state) - self.fail_json(msg=msg) - return server - - def present_server(self, start_server=True): - server = self.get_server() - if not server: - server = self._create_server(server=server) - else: - server = self._update_server(server=server, start_server=start_server) - return server - - def _create_server(self, server=None): - required_params = [ - 'os', - 'plan', - 'region', - ] - self.module.fail_on_missing_params(required_params=required_params) - - self.result['changed'] = True - if not self.module.check_mode: - data = { - 'DCID': self.get_region().get('DCID'), - 'METALPLANID': self.get_plan().get('METALPLANID'), - 'OSID': self.get_os().get('OSID'), - 'label': self.module.params.get('name'), - 'hostname': self.module.params.get('hostname'), - 'SSHKEYID': ','.join([ssh_key['SSHKEYID'] for ssh_key in self.get_ssh_keys()]), - 'enable_ipv6': self.get_yes_or_no('ipv6_enabled'), - 'notify_activate': self.get_yes_or_no('notify_activate'), - 'tag': self.module.params.get('tag'), - 'reserved_ip_v4': self.module.params.get('reserved_ip_v4'), - 'user_data': self.get_user_data(), - 'SCRIPTID': self.get_startup_script().get('SCRIPTID'), - } - self.api_query( - path="/v1/baremetal/create", - method="POST", - data=data - ) - server = self._wait_for_state(key='status', state='active') - return server - - def _update_server(self, server=None, start_server=True): - - # Update plan settings - # server = self._update_plan_setting(server=server, start_server=start_server) - - # User data - user_data = self.get_user_data() - server_user_data = self.get_server_user_data(server=server) - if user_data is not None and user_data != server_user_data: - self.result['changed'] = True - self.result['diff']['before']['user_data'] = server_user_data - self.result['diff']['after']['user_data'] = user_data - - if not self.module.check_mode: - data = { - 'SUBID': server['SUBID'], - 'userdata': user_data, - } - self.api_query( - path="/v1/baremetal/set_user_data", - method="POST", - data=data - ) - - # Tags - tag = self.module.params.get('tag') - if tag is not None and tag != server.get('tag'): - self.result['changed'] = True - self.result['diff']['before']['tag'] = server.get('tag') - self.result['diff']['after']['tag'] = tag - - if not self.module.check_mode: - data = { - 'SUBID': server['SUBID'], - 'tag': tag, - } - self.api_query( - path="/v1/baremetal/tag_set", - method="POST", - data=data - ) - return server - - def absent_server(self): - server = self.get_server() - if server: - self.result['changed'] = True - self.result['diff']['before']['id'] = server['SUBID'] - self.result['diff']['after']['id'] = "" - if not self.module.check_mode: - data = { - 'SUBID': server['SUBID'] - } - self.api_query( - path="/v1/baremetal/destroy", - method="POST", - data=data - ) - for s in range(0, 60): - if server is not None: - break - time.sleep(2) - server = self.get_server(refresh=True) - else: - self.fail_json(msg="Wait for server '%s' to get deleted timed out" % server['label']) - return server - - -def main(): - argument_spec = vultr_argument_spec() - argument_spec.update(dict( - name=dict(required=True, aliases=['label']), - hostname=dict(type='str',), - os=dict(type='str',), - plan=dict(type='str',), - notify_activate=dict(type='bool', default=False), - ipv6_enabled=dict(type='bool'), - tag=dict(type='str',), - reserved_ip_v4=dict(type='str',), - startup_script=dict(type='str',), - user_data=dict(type='str',), - ssh_keys=dict(type='list', elements='str', aliases=['ssh_key'], no_log=False), - region=dict(type='str',), - state=dict(type='str', choices=['present', 'absent'], default='present'), - )) - - module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True, - ) - - vultr_server_baremetal = AnsibleVultrServerBareMetal(module) - if module.params.get('state') == "absent": - server = vultr_server_baremetal.absent_server() - else: - server = vultr_server_baremetal.present_server() - - result = vultr_server_baremetal.get_result(server) - module.exit_json(**result) - - -if __name__ == '__main__': - main() diff --git a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_server_info.py b/ansible_collections/ngine_io/vultr/plugins/modules/vultr_server_info.py deleted file mode 100644 index a2608ac14..000000000 --- a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_server_info.py +++ /dev/null @@ -1,300 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -# -# Copyright (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 - - -DOCUMENTATION = r''' ---- -module: vultr_server_info -short_description: Gather information about the Vultr servers available. -description: - - Gather information about servers available. -version_added: "0.1.0" -author: "Yanis Guenane (@Spredzy)" -extends_documentation_fragment: -- ngine_io.vultr.vultr - -''' - -EXAMPLES = r''' -- name: Gather Vultr servers information - ngine_io.vultr.vultr_server_info: - register: result - -- name: Print the gathered information - debug: - var: result.vultr_server_info -''' - -RETURN = r''' ---- -vultr_api: - description: Response from Vultr API with a few additions/modification - returned: success - type: complex - contains: - api_account: - description: Account used in the ini file to select the key - returned: success - type: str - sample: default - api_timeout: - description: Timeout used for the API requests - returned: success - type: int - sample: 60 - api_retries: - description: Amount of max retries for the API requests - returned: success - type: int - sample: 5 - api_retry_max_delay: - description: Exponential backoff delay in seconds between retries up to this max delay value. - returned: success - type: int - sample: 12 - api_endpoint: - description: Endpoint used for the API requests - returned: success - type: str - sample: "https://api.vultr.com" -vultr_server_info: - description: Response from Vultr API - returned: success - type: complex - contains: - id: - description: ID of the server - returned: success - type: str - sample: 10194376 - name: - description: Name (label) of the server - returned: success - type: str - sample: "ansible-test-vm" - plan: - description: Plan used for the server - returned: success - type: str - sample: "1024 MB RAM,25 GB SSD,1.00 TB BW" - allowed_bandwidth_gb: - description: Allowed bandwidth to use in GB - returned: success - type: float - sample: 1000.5 - auto_backup_enabled: - description: Whether automatic backups are enabled - returned: success - type: bool - sample: false - cost_per_month: - description: Cost per month for the server - returned: success - type: float - sample: 5.00 - current_bandwidth_gb: - description: Current bandwidth used for the server - returned: success - type: int - sample: 0 - date_created: - description: Date when the server was created - returned: success - type: str - sample: "2017-08-26 12:47:48" - default_password: - description: Password to login as root into the server - returned: success - type: str - sample: "!p3EWYJm$qDWYaFr" - disk: - description: Information about the disk - returned: success - type: str - sample: "Virtual 25 GB" - v4_gateway: - description: IPv4 gateway - returned: success - type: str - sample: "45.32.232.1" - internal_ip: - description: Internal IP - returned: success - type: str - sample: "" - kvm_url: - description: URL to the VNC - returned: success - type: str - sample: "https://my.vultr.com/subs/vps/novnc/api.php?data=xyz" - region: - description: Region the server was deployed into - returned: success - type: str - sample: "Amsterdam" - v4_main_ip: - description: Main IPv4 - returned: success - type: str - sample: "45.32.233.154" - v4_netmask: - description: Netmask IPv4 - returned: success - type: str - sample: "255.255.254.0" - os: - description: Operating system used for the server - returned: success - type: str - sample: "CentOS 6 x64" - firewall_group: - description: Firewall group the server is assigned to - returned: success and available - type: str - sample: "CentOS 6 x64" - pending_charges: - description: Pending charges - returned: success - type: float - sample: 0.01 - power_status: - description: Power status of the server - returned: success - type: str - sample: "running" - ram: - description: Information about the RAM size - returned: success - type: str - sample: "1024 MB" - server_state: - description: State about the server - returned: success - type: str - sample: "ok" - status: - description: Status about the deployment of the server - returned: success - type: str - sample: "active" - tag: - description: TBD - returned: success - type: str - sample: "" - v6_main_ip: - description: Main IPv6 - returned: success - type: str - sample: "" - v6_network: - description: Network IPv6 - returned: success - type: str - sample: "" - v6_network_size: - description: Network size IPv6 - returned: success - type: str - sample: "" - v6_networks: - description: Networks IPv6 - returned: success - type: list - sample: [] - vcpu_count: - description: Virtual CPU count - returned: success - type: int - sample: 1 -''' - -from ansible.module_utils.basic import AnsibleModule -from ..module_utils.vultr import ( - Vultr, - vultr_argument_spec, -) - - -class AnsibleVultrServerInfo(Vultr): - - def __init__(self, module): - super(AnsibleVultrServerInfo, self).__init__(module, "vultr_server_info") - - self.returns = { - "APPID": dict(key='application', convert_to='int', transform=self._get_application_name), - "FIREWALLGROUPID": dict(key='firewallgroup', transform=self._get_firewallgroup_name), - "SUBID": dict(key='id', convert_to='int'), - "VPSPLANID": dict(key='plan', convert_to='int', transform=self._get_plan_name), - "allowed_bandwidth_gb": dict(convert_to='float'), - 'auto_backups': dict(key='auto_backup_enabled', convert_to='bool'), - "cost_per_month": dict(convert_to='float'), - "current_bandwidth_gb": dict(convert_to='float'), - "date_created": dict(), - "default_password": dict(), - "disk": dict(), - "gateway_v4": dict(key='v4_gateway'), - "internal_ip": dict(), - "kvm_url": dict(), - "label": dict(key='name'), - "location": dict(key='region'), - "main_ip": dict(key='v4_main_ip'), - "netmask_v4": dict(key='v4_netmask'), - "os": dict(), - "pending_charges": dict(convert_to='float'), - "power_status": dict(), - "ram": dict(), - "server_state": dict(), - "status": dict(), - "tag": dict(), - "v6_main_ip": dict(), - "v6_network": dict(), - "v6_network_size": dict(), - "v6_networks": dict(), - "vcpu_count": dict(convert_to='int'), - } - - def _get_application_name(self, application): - if application == 0: - return None - - return self.get_application(application, 'APPID').get('name') - - def _get_firewallgroup_name(self, firewallgroup): - if firewallgroup == 0: - return None - - return self.get_firewallgroup(firewallgroup, 'FIREWALLGROUPID').get('description') - - def _get_plan_name(self, plan): - return self.get_plan(plan, 'VPSPLANID', optional=True).get('name') or 'N/A' - - def get_servers(self): - return self.api_query(path="/v1/server/list") - - -def parse_servers_list(servers_list): - return [server for id, server in servers_list.items()] - - -def main(): - argument_spec = vultr_argument_spec() - - module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True, - ) - - server_info = AnsibleVultrServerInfo(module) - result = server_info.get_result(parse_servers_list(server_info.get_servers())) - module.exit_json(**result) - - -if __name__ == '__main__': - main() diff --git a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_ssh_key.py b/ansible_collections/ngine_io/vultr/plugins/modules/vultr_ssh_key.py deleted file mode 100644 index 11e648ce6..000000000 --- a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_ssh_key.py +++ /dev/null @@ -1,236 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -# -# Copyright (c) 2017, René Moser <mail@renemoser.net> -# 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 - - -DOCUMENTATION = ''' ---- -module: vultr_ssh_key -short_description: Manages ssh keys on Vultr. -description: - - Create, update and remove ssh keys. -version_added: "0.1.0" -author: "René Moser (@resmo)" -options: - name: - description: - - Name of the ssh key. - required: true - type: str - ssh_key: - description: - - SSH public key. - - Required if C(state=present). - type: str - state: - description: - - State of the ssh key. - default: present - choices: [ present, absent ] - type: str -extends_documentation_fragment: -- ngine_io.vultr.vultr - -''' - -EXAMPLES = ''' -- name: ensure an SSH key is present - ngine_io.vultr.vultr_ssh_key: - name: my ssh key - ssh_key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}" - -- name: ensure an SSH key is absent - ngine_io.vultr.vultr_ssh_key: - name: my ssh key - state: absent -''' - -RETURN = ''' ---- -vultr_api: - description: Response from Vultr API with a few additions/modification - returned: success - type: complex - contains: - api_account: - description: Account used in the ini file to select the key - returned: success - type: str - sample: default - api_timeout: - description: Timeout used for the API requests - returned: success - type: int - sample: 60 - api_retries: - description: Amount of max retries for the API requests - returned: success - type: int - sample: 5 - api_retry_max_delay: - description: Exponential backoff delay in seconds between retries up to this max delay value. - returned: success - type: int - sample: 12 - api_endpoint: - description: Endpoint used for the API requests - returned: success - type: str - sample: "https://api.vultr.com" -vultr_ssh_key: - description: Response from Vultr API - returned: success - type: complex - contains: - id: - description: ID of the ssh key - returned: success - type: str - sample: 5904bc6ed9234 - name: - description: Name of the ssh key - returned: success - type: str - sample: my ssh key - date_created: - description: Date the ssh key was created - returned: success - type: str - sample: "2017-08-26 12:47:48" - ssh_key: - description: SSH public key - returned: success - type: str - sample: "ssh-rsa AA... someother@example.com" -''' - -from ansible.module_utils.basic import AnsibleModule -from ..module_utils.vultr import ( - Vultr, - vultr_argument_spec, -) - - -class AnsibleVultrSshKey(Vultr): - - def __init__(self, module): - super(AnsibleVultrSshKey, self).__init__(module, "vultr_ssh_key") - - self.returns = { - 'SSHKEYID': dict(key='id'), - 'name': dict(), - 'ssh_key': dict(), - 'date_created': dict(), - } - - def get_ssh_key(self): - ssh_keys = self.api_query(path="/v1/sshkey/list") - if ssh_keys: - for ssh_key_id, ssh_key_data in ssh_keys.items(): - if ssh_key_data.get('name') == self.module.params.get('name'): - return ssh_key_data - return {} - - def present_ssh_key(self): - ssh_key = self.get_ssh_key() - if not ssh_key: - ssh_key = self._create_ssh_key(ssh_key) - else: - ssh_key = self._update_ssh_key(ssh_key) - return ssh_key - - def _create_ssh_key(self, ssh_key): - self.result['changed'] = True - data = { - 'name': self.module.params.get('name'), - 'ssh_key': self.module.params.get('ssh_key'), - } - self.result['diff']['before'] = {} - self.result['diff']['after'] = data - - if not self.module.check_mode: - self.api_query( - path="/v1/sshkey/create", - method="POST", - data=data - ) - ssh_key = self.get_ssh_key() - return ssh_key - - def _update_ssh_key(self, ssh_key): - param_ssh_key = self.module.params.get('ssh_key') - if param_ssh_key != ssh_key['ssh_key']: - self.result['changed'] = True - - data = { - 'SSHKEYID': ssh_key['SSHKEYID'], - 'ssh_key': param_ssh_key, - } - - self.result['diff']['before'] = ssh_key - self.result['diff']['after'] = data - self.result['diff']['after'].update({'date_created': ssh_key['date_created']}) - - if not self.module.check_mode: - self.api_query( - path="/v1/sshkey/update", - method="POST", - data=data - ) - ssh_key = self.get_ssh_key() - return ssh_key - - def absent_ssh_key(self): - ssh_key = self.get_ssh_key() - if ssh_key: - self.result['changed'] = True - - data = { - 'SSHKEYID': ssh_key['SSHKEYID'], - } - - self.result['diff']['before'] = ssh_key - self.result['diff']['after'] = {} - - if not self.module.check_mode: - self.api_query( - path="/v1/sshkey/destroy", - method="POST", - data=data - ) - return ssh_key - - -def main(): - argument_spec = vultr_argument_spec() - argument_spec.update(dict( - name=dict(type='str', required=True), - ssh_key=dict(type='str', no_log=False), - state=dict(type='str', choices=['present', 'absent'], default='present'), - )) - - module = AnsibleModule( - argument_spec=argument_spec, - required_if=[ - ('state', 'present', ['ssh_key']), - ], - supports_check_mode=True, - ) - - vultr_ssh_key = AnsibleVultrSshKey(module) - if module.params.get('state') == "absent": - ssh_key = vultr_ssh_key.absent_ssh_key() - else: - ssh_key = vultr_ssh_key.present_ssh_key() - - result = vultr_ssh_key.get_result(ssh_key) - module.exit_json(**result) - - -if __name__ == '__main__': - main() diff --git a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_ssh_key_info.py b/ansible_collections/ngine_io/vultr/plugins/modules/vultr_ssh_key_info.py deleted file mode 100644 index 51b2960bb..000000000 --- a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_ssh_key_info.py +++ /dev/null @@ -1,141 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -# -# Copyright (c) 2018, Yanis Guenane <yanis+ansible@guenane.org> -# Copyright (c) 2019, René Moser <mail@renemoser.net> - -# 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 - - -DOCUMENTATION = r''' ---- -module: vultr_ssh_key_info -short_description: Get information about the Vultr SSH keys available. -description: - - Get infos about SSH keys available. -version_added: "0.1.0" -author: - - "Yanis Guenane (@Spredzy)" - - "René Moser (@resmo)" -extends_documentation_fragment: -- ngine_io.vultr.vultr - -''' - -EXAMPLES = r''' -- name: Get Vultr SSH keys infos - ngine_io.vultr.vultr_ssh_key_info: - register: result - -- name: Print the infos - debug: - var: result.vultr_ssh_key_info -''' - -RETURN = r''' ---- -vultr_api: - description: Response from Vultr API with a few additions/modification - returned: success - type: complex - contains: - api_account: - description: Account used in the ini file to select the key - returned: success - type: str - sample: default - api_timeout: - description: Timeout used for the API requests - returned: success - type: int - sample: 60 - api_retries: - description: Amount of max retries for the API requests - returned: success - type: int - sample: 5 - api_retry_max_delay: - description: Exponential backoff delay in seconds between retries up to this max delay value. - returned: success - type: int - sample: 12 - api_endpoint: - description: Endpoint used for the API requests - returned: success - type: str - sample: "https://api.vultr.com" -vultr_ssh_key_info: - description: Response from Vultr API as list - returned: success - type: complex - contains: - id: - description: ID of the ssh key - returned: success - type: str - sample: 5904bc6ed9234 - name: - description: Name of the ssh key - returned: success - type: str - sample: my ssh key - date_created: - description: Date the ssh key was created - returned: success - type: str - sample: "2017-08-26 12:47:48" - ssh_key: - description: SSH public key - returned: success - type: str - sample: "ssh-rsa AA... someother@example.com" -''' - -from ansible.module_utils.basic import AnsibleModule -from ..module_utils.vultr import ( - Vultr, - vultr_argument_spec, -) - - -class AnsibleVultrSSHKeyInfo(Vultr): - - def __init__(self, module): - super(AnsibleVultrSSHKeyInfo, self).__init__(module, "vultr_ssh_key_info") - - self.returns = { - 'SSHKEYID': dict(key='id'), - 'name': dict(), - 'ssh_key': dict(), - 'date_created': dict(), - } - - def get_sshkeys(self): - return self.api_query(path="/v1/sshkey/list") - - -def parse_keys_list(keys_list): - if not keys_list: - return [] - - return [key for id, key in keys_list.items()] - - -def main(): - argument_spec = vultr_argument_spec() - - module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True, - ) - - sshkey_info = AnsibleVultrSSHKeyInfo(module) - result = sshkey_info.get_result(parse_keys_list(sshkey_info.get_sshkeys())) - module.exit_json(**result) - - -if __name__ == '__main__': - main() diff --git a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_startup_script.py b/ansible_collections/ngine_io/vultr/plugins/modules/vultr_startup_script.py deleted file mode 100644 index dfa58af77..000000000 --- a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_startup_script.py +++ /dev/null @@ -1,265 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -# -# Copyright (c) 2018, René Moser <mail@renemoser.net> -# 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 - - -DOCUMENTATION = r''' ---- -module: vultr_startup_script -short_description: Manages startup scripts on Vultr. -description: - - Create, update and remove startup scripts. -version_added: "0.1.0" -author: "René Moser (@resmo)" -options: - name: - description: - - The script name. - required: true - type: str - script_type: - description: - - The script type, can not be changed once created. - default: boot - choices: [ boot, pxe ] - aliases: [ type ] - type: str - script: - description: - - The script source code. - - Required if I(state=present). - type: str - state: - description: - - State of the script. - default: present - choices: [ present, absent ] - type: str -extends_documentation_fragment: -- ngine_io.vultr.vultr - -''' - -EXAMPLES = r''' -- name: ensure a pxe script exists, source from a file - ngine_io.vultr.vultr_startup_script: - name: my_web_script - script_type: pxe - script: "{{ lookup('file', 'path/to/script') }}" - -- name: ensure a boot script exists - ngine_io.vultr.vultr_startup_script: - name: vultr_startup_script - script: "#!/bin/bash\necho Hello World > /root/hello" - -- name: ensure a script is absent - ngine_io.vultr.vultr_startup_script: - name: my_web_script - state: absent -''' - -RETURN = r''' ---- -vultr_api: - description: Response from Vultr API with a few additions/modification - returned: success - type: complex - contains: - api_account: - description: Account used in the ini file to select the key - returned: success - type: str - sample: default - api_timeout: - description: Timeout used for the API requests - returned: success - type: int - sample: 60 - api_retries: - description: Amount of max retries for the API requests - returned: success - type: int - sample: 5 - api_retry_max_delay: - description: Exponential backoff delay in seconds between retries up to this max delay value. - returned: success - type: int - sample: 12 - api_endpoint: - description: Endpoint used for the API requests - returned: success - type: str - sample: "https://api.vultr.com" -vultr_startup_script: - description: Response from Vultr API - returned: success - type: complex - contains: - id: - description: ID of the startup script. - returned: success - type: str - sample: 249395 - name: - description: Name of the startup script. - returned: success - type: str - sample: my startup script - script: - description: The source code of the startup script. - returned: success - type: str - sample: "#!/bin/bash\necho Hello World > /root/hello" - script_type: - description: The type of the startup script. - returned: success - type: str - sample: pxe - date_created: - description: Date the startup script was created. - returned: success - type: str - sample: "2017-08-26 12:47:48" - date_modified: - description: Date the startup script was modified. - returned: success - type: str - sample: "2017-08-26 12:47:48" -''' - -from ansible.module_utils.basic import AnsibleModule -from ..module_utils.vultr import ( - Vultr, - vultr_argument_spec, -) - - -class AnsibleVultrStartupScript(Vultr): - - def __init__(self, module): - super(AnsibleVultrStartupScript, self).__init__(module, "vultr_startup_script") - - self.returns = { - 'SCRIPTID': dict(key='id'), - 'type': dict(key='script_type'), - 'name': dict(), - 'script': dict(), - 'date_created': dict(), - 'date_modified': dict(), - } - - def get_script(self): - scripts = self.api_query(path="/v1/startupscript/list") - name = self.module.params.get('name') - if scripts: - for script_id, script_data in scripts.items(): - if script_data.get('name') == name: - return script_data - return {} - - def present_script(self): - script = self.get_script() - if not script: - script = self._create_script(script) - else: - script = self._update_script(script) - return script - - def _create_script(self, script): - self.result['changed'] = True - - data = { - 'name': self.module.params.get('name'), - 'script': self.module.params.get('script'), - 'type': self.module.params.get('script_type'), - } - - self.result['diff']['before'] = {} - self.result['diff']['after'] = data - - if not self.module.check_mode: - self.api_query( - path="/v1/startupscript/create", - method="POST", - data=data - ) - script = self.get_script() - return script - - def _update_script(self, script): - if script['script'] != self.module.params.get('script'): - self.result['changed'] = True - - data = { - 'SCRIPTID': script['SCRIPTID'], - 'script': self.module.params.get('script'), - } - - self.result['diff']['before'] = script - self.result['diff']['after'] = script.copy() - self.result['diff']['after'].update(data) - - if not self.module.check_mode: - self.api_query( - path="/v1/startupscript/update", - method="POST", - data=data - ) - script = self.get_script() - return script - - def absent_script(self): - script = self.get_script() - if script: - self.result['changed'] = True - - data = { - 'SCRIPTID': script['SCRIPTID'], - } - - self.result['diff']['before'] = script - self.result['diff']['after'] = {} - - if not self.module.check_mode: - self.api_query( - path="/v1/startupscript/destroy", - method="POST", - data=data - ) - return script - - -def main(): - argument_spec = vultr_argument_spec() - argument_spec.update(dict( - name=dict(type='str', required=True), - script=dict(type='str',), - script_type=dict(type='str', default='boot', choices=['boot', 'pxe'], aliases=['type']), - state=dict(type='str', choices=['present', 'absent'], default='present'), - )) - - module = AnsibleModule( - argument_spec=argument_spec, - required_if=[ - ('state', 'present', ['script']), - ], - supports_check_mode=True, - ) - - vultr_script = AnsibleVultrStartupScript(module) - if module.params.get('state') == "absent": - script = vultr_script.absent_script() - else: - script = vultr_script.present_script() - - result = vultr_script.get_result(script) - module.exit_json(**result) - - -if __name__ == '__main__': - main() diff --git a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_startup_script_info.py b/ansible_collections/ngine_io/vultr/plugins/modules/vultr_startup_script_info.py deleted file mode 100644 index 262954ad3..000000000 --- a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_startup_script_info.py +++ /dev/null @@ -1,149 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -# -# Copyright (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 - - -DOCUMENTATION = r''' ---- -module: vultr_startup_script_info -short_description: Gather information about the Vultr startup scripts available. -description: - - Gather information about vultr_startup_scripts available. -version_added: "0.1.0" -author: "Yanis Guenane (@Spredzy)" -extends_documentation_fragment: -- ngine_io.vultr.vultr - -''' - -EXAMPLES = r''' -- name: Gather Vultr startup scripts information - ngine_io.vultr.vultr_startup_script_info: - register: result - -- name: Print the gathered information - debug: - var: result.vultr_startup_script_info -''' - -RETURN = r''' ---- -vultr_api: - description: Response from Vultr API with a few additions/modification - returned: success - type: complex - contains: - api_account: - description: Account used in the ini file to select the key - returned: success - type: str - sample: default - api_timeout: - description: Timeout used for the API requests - returned: success - type: int - sample: 60 - api_retries: - description: Amount of max retries for the API requests - returned: success - type: int - sample: 5 - api_retry_max_delay: - description: Exponential backoff delay in seconds between retries up to this max delay value. - returned: success - type: int - sample: 12 - api_endpoint: - description: Endpoint used for the API requests - returned: success - type: str - sample: "https://api.vultr.com" -vultr_startup_script_info: - description: Response from Vultr API - returned: success - type: complex - contains: - id: - description: ID of the startup script. - returned: success - type: str - sample: 249395 - name: - description: Name of the startup script. - returned: success - type: str - sample: my startup script - script: - description: The source code of the startup script. - returned: success - type: str - sample: "#!/bin/bash\necho Hello World > /root/hello" - type: - description: The type of the startup script. - returned: success - type: str - sample: pxe - date_created: - description: Date the startup script was created. - returned: success - type: str - sample: "2017-08-26 12:47:48" - date_modified: - description: Date the startup script was modified. - returned: success - type: str - sample: "2017-08-26 12:47:48" -''' - -from ansible.module_utils.basic import AnsibleModule -from ..module_utils.vultr import ( - Vultr, - vultr_argument_spec, -) - - -class AnsibleVultrStartupScriptInfo(Vultr): - - def __init__(self, module): - super(AnsibleVultrStartupScriptInfo, self).__init__(module, "vultr_startup_script_info") - - self.returns = { - "SCRIPTID": dict(key='id', convert_to='int'), - "date_created": dict(), - "date_modified": dict(), - "name": dict(), - "script": dict(), - "type": dict(), - } - - def get_startupscripts(self): - return self.api_query(path="/v1/startupscript/list") - - -def parse_startupscript_list(startupscipts_list): - if not startupscipts_list: - return [] - - return [startupscript for id, startupscript in startupscipts_list.items()] - - -def main(): - argument_spec = vultr_argument_spec() - - module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True, - ) - - startupscript_info = AnsibleVultrStartupScriptInfo(module) - result = startupscript_info.get_result(parse_startupscript_list(startupscript_info.get_startupscripts())) - module.exit_json(**result) - - -if __name__ == '__main__': - main() diff --git a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_user.py b/ansible_collections/ngine_io/vultr/plugins/modules/vultr_user.py deleted file mode 100644 index 53ebfeacc..000000000 --- a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_user.py +++ /dev/null @@ -1,326 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -# -# Copyright (c) 2017, René Moser <mail@renemoser.net> -# 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 - - -DOCUMENTATION = r''' ---- -module: vultr_user -short_description: Manages users on Vultr. -description: - - Create, update and remove users. -version_added: "0.1.0" -author: "René Moser (@resmo)" -options: - name: - description: - - Name of the user - required: true - type: str - email: - description: - - Email of the user. - - Required if C(state=present). - type: str - password: - description: - - Password of the user. - - Only considered while creating a user or when C(force=yes). - type: str - force: - description: - - Password will only be changed with enforcement. - default: no - type: bool - api_enabled: - description: - - Whether the API is enabled or not. - default: yes - type: bool - acls: - description: - - List of ACLs this users should have, see U(https://www.vultr.com/api/#user_user_list). - - Required if C(state=present). - - One or more of the choices list, some depend on each other. - choices: - - manage_users - - subscriptions - - provisioning - - billing - - support - - abuse - - dns - - upgrade - aliases: [ acl ] - type: list - elements: str - state: - description: - - State of the user. - default: present - choices: [ present, absent ] - type: str -extends_documentation_fragment: -- ngine_io.vultr.vultr - -''' - -EXAMPLES = r''' -- name: Ensure a user exists - ngine_io.vultr.vultr_user: - name: john - email: john.doe@example.com - password: s3cr3t - acls: - - upgrade - - dns - - manage_users - - subscriptions - - upgrade - -- name: Remove a user - ngine_io.vultr.vultr_user: - name: john - state: absent -''' - -RETURN = r''' ---- -vultr_api: - description: Response from Vultr API with a few additions/modification - returned: success - type: complex - contains: - api_account: - description: Account used in the ini file to select the key - returned: success - type: str - sample: default - api_timeout: - description: Timeout used for the API requests - returned: success - type: int - sample: 60 - api_retries: - description: Amount of max retries for the API requests - returned: success - type: int - sample: 5 - api_retry_max_delay: - description: Exponential backoff delay in seconds between retries up to this max delay value. - returned: success - type: int - sample: 12 - api_endpoint: - description: Endpoint used for the API requests - returned: success - type: str - sample: "https://api.vultr.com" -vultr_user: - description: Response from Vultr API - returned: success - type: complex - contains: - id: - description: ID of the user. - returned: success - type: str - sample: 5904bc6ed9234 - api_key: - description: API key of the user. - returned: only after resource was created - type: str - sample: 567E6K567E6K567E6K567E6K567E6K - name: - description: Name of the user. - returned: success - type: str - sample: john - email: - description: Email of the user. - returned: success - type: str - sample: "john@example.com" - api_enabled: - description: Whether the API is enabled or not. - returned: success - type: bool - sample: true - acls: - description: List of ACLs of the user. - returned: success - type: list - sample: [manage_users, support, upgrade] -''' - -from ansible.module_utils.basic import AnsibleModule -from ..module_utils.vultr import ( - Vultr, - vultr_argument_spec, -) - - -ACLS = [ - 'manage_users', - 'subscriptions', - 'provisioning', - 'billing', - 'support', - 'abuse', - 'dns', - 'upgrade', -] - - -class AnsibleVultrUser(Vultr): - - def __init__(self, module): - super(AnsibleVultrUser, self).__init__(module, "vultr_user") - - self.returns = { - 'USERID': dict(key='id'), - 'name': dict(), - 'email': dict(), - 'api_enabled': dict(convert_to='bool'), - 'acls': dict(), - 'api_key': dict() - } - - def _common_args(self): - return { - 'name': self.module.params.get('name'), - 'email': self.module.params.get('email'), - 'acls': self.module.params.get('acls'), - 'password': self.module.params.get('password'), - 'api_enabled': self.get_yes_or_no('api_enabled'), - } - - def get_user(self): - users = self.api_query(path="/v1/user/list") - for user in users or []: - if user.get('name') == self.module.params.get('name'): - return user - return {} - - def present_user(self): - user = self.get_user() - if not user: - user = self._create_user(user) - else: - user = self._update_user(user) - return user - - def _has_changed(self, user, data): - for k, v in data.items(): - if k not in user: - continue - elif isinstance(v, list): - for i in v: - if i not in user[k]: - return True - elif data[k] != user[k]: - return True - return False - - def _create_user(self, user): - self.module.fail_on_missing_params(required_params=['password']) - - self.result['changed'] = True - - data = self._common_args() - self.result['diff']['before'] = {} - self.result['diff']['after'] = data - - if not self.module.check_mode: - user = self.api_query( - path="/v1/user/create", - method="POST", - data=data - ) - user.update(self.get_user()) - return user - - def _update_user(self, user): - data = self._common_args() - data.update({ - 'USERID': user['USERID'], - }) - - force = self.module.params.get('force') - if not force: - del data['password'] - - if force or self._has_changed(user=user, data=data): - self.result['changed'] = True - - self.result['diff']['before'] = user - self.result['diff']['after'] = user.copy() - self.result['diff']['after'].update(data) - - if not self.module.check_mode: - self.api_query( - path="/v1/user/update", - method="POST", - data=data - ) - user = self.get_user() - return user - - def absent_user(self): - user = self.get_user() - if user: - self.result['changed'] = True - - data = { - 'USERID': user['USERID'], - } - - self.result['diff']['before'] = user - self.result['diff']['after'] = {} - - if not self.module.check_mode: - self.api_query( - path="/v1/user/delete", - method="POST", - data=data - ) - return user - - -def main(): - argument_spec = vultr_argument_spec() - argument_spec.update(dict( - name=dict(type='str', required=True), - email=dict(type='str',), - password=dict(type='str', no_log=True), - force=dict(type='bool', default=False), - api_enabled=dict(type='bool', default=True), - acls=dict(type='list', elements='str', choices=ACLS, aliases=['acl']), - state=dict(type='str', choices=['present', 'absent'], default='present'), - )) - - module = AnsibleModule( - argument_spec=argument_spec, - required_if=[ - ('state', 'present', ['email', 'acls']), - ], - supports_check_mode=True, - ) - - vultr_user = AnsibleVultrUser(module) - if module.params.get('state') == "absent": - user = vultr_user.absent_user() - else: - user = vultr_user.present_user() - - result = vultr_user.get_result(user) - module.exit_json(**result) - - -if __name__ == '__main__': - main() diff --git a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_user_info.py b/ansible_collections/ngine_io/vultr/plugins/modules/vultr_user_info.py deleted file mode 100644 index f07d0efff..000000000 --- a/ansible_collections/ngine_io/vultr/plugins/modules/vultr_user_info.py +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -# -# Copyright (c) 2018, Yanis Guenane <yanis+ansible@guenane.org> -# Copyright (c) 2019, René Moser <mail@renemoser.net> -# 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 - - -DOCUMENTATION = r''' ---- -module: vultr_user_info -short_description: Get information about the Vultr user available. -version_added: "0.1.0" -description: - - Get infos about users available in Vultr. -author: - - "Yanis Guenane (@Spredzy)" - - "René Moser (@resmo)" -extends_documentation_fragment: -- ngine_io.vultr.vultr - -''' - -EXAMPLES = r''' -- name: Get Vultr user infos - ngine_io.vultr.vultr_user_info: - register: result - -- name: Print the infos - debug: - var: result.vultr_user_info -''' - -RETURN = r''' ---- -vultr_api: - description: Response from Vultr API with a few additions/modification - returned: success - type: complex - contains: - api_account: - description: Account used in the ini file to select the key - returned: success - type: str - sample: default - api_timeout: - description: Timeout used for the API requests - returned: success - type: int - sample: 60 - api_retries: - description: Amount of max retries for the API requests - returned: success - type: int - sample: 5 - api_retry_max_delay: - description: Exponential backoff delay in seconds between retries up to this max delay value. - returned: success - type: int - sample: 12 - api_endpoint: - description: Endpoint used for the API requests - returned: success - type: str - sample: "https://api.vultr.com" -vultr_user_info: - description: Response from Vultr API as list - returned: available - type: complex - contains: - id: - description: ID of the user. - returned: success - type: str - sample: 5904bc6ed9234 - api_key: - description: API key of the user. - returned: only after resource was created - type: str - sample: 567E6K567E6K567E6K567E6K567E6K - name: - description: Name of the user. - returned: success - type: str - sample: john - email: - description: Email of the user. - returned: success - type: str - sample: "john@example.com" - api_enabled: - description: Whether the API is enabled or not. - returned: success - type: bool - sample: true - acls: - description: List of ACLs of the user. - returned: success - type: list - sample: [ manage_users, support, upgrade ] -''' - -from ansible.module_utils.basic import AnsibleModule -from ..module_utils.vultr import ( - Vultr, - vultr_argument_spec, -) - - -class AnsibleVultrUserInfo(Vultr): - - def __init__(self, module): - super(AnsibleVultrUserInfo, self).__init__(module, "vultr_user_info") - - self.returns = { - "USERID": dict(key='id'), - "acls": dict(), - "api_enabled": dict(), - "email": dict(), - "name": dict() - } - - def get_regions(self): - return self.api_query(path="/v1/user/list") - - -def main(): - argument_spec = vultr_argument_spec() - - module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True, - ) - - user_info = AnsibleVultrUserInfo(module) - result = user_info.get_result(user_info.get_regions()) - module.exit_json(**result) - - -if __name__ == '__main__': - main() diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_account_info/aliases b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_account_info/aliases deleted file mode 100644 index 1e9555644..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_account_info/aliases +++ /dev/null @@ -1,2 +0,0 @@ -cloud/vultr -smoke/vultr diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_account_info/tasks/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_account_info/tasks/main.yml deleted file mode 100644 index 1dfa8c44f..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_account_info/tasks/main.yml +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright (c) 2018, René Moser <mail@renemoser.net> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -- name: test get vultr account infos in check mode - vultr_account_info: - check_mode: yes - register: result - -- name: verify test get vultr account infos in check mode - assert: - that: - - result.vultr_account_info.balance is defined - - result.vultr_account_info.last_payment_amount is defined - - result.vultr_account_info.last_payment_date is defined - - result.vultr_account_info.last_payment_amount is defined - -- name: test get vultr account fact - vultr_account_info: - register: result - -- name: verify test get vultr account infos - assert: - that: - - result.vultr_account_info.balance is defined - - result.vultr_account_info.last_payment_amount is defined - - result.vultr_account_info.last_payment_date is defined - - result.vultr_account_info.last_payment_amount is defined diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_block_storage/aliases b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_block_storage/aliases deleted file mode 100644 index bf469bb90..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_block_storage/aliases +++ /dev/null @@ -1 +0,0 @@ -cloud/vultr diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_block_storage/defaults/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_block_storage/defaults/main.yml deleted file mode 100644 index b2c0ebe39..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_block_storage/defaults/main.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -vultr_resource_prefix: "vultr-test-prefix" -vultr_block_storage_name: "{{ vultr_resource_prefix }}-volume" -vultr_block_storage_size: 10 -vultr_block_storage_size_2: 12 -vultr_block_storage_size_3: 14 -vultr_block_storage_region: New Jersey - -vultr_server_name: "{{ vultr_resource_prefix }}_vm_for_attachment" -vultr_server_ssh_keys: -- name: key1 - key: "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAgEAyWYItY+3w5b8PdGRoz0oY5mufqydW96naE+VM3JSvJFAUS08rAjQQpQ03ymoALeHQy6JVZbcgecxn6p0pAOINQdqufn4udPtOPCtMjNiPGpkSM9ah/6X5+kvyWMNrvlf+Ld4OOoszP5sAkgQzIbrFQAm41XknBUha0zkewZwfrVhain4pnDjV7wCcChId/Q/Gbi4xMtXkisznWcAJcueBs3EEZDKhJ5q0VeWSJEhYJDLFN1sOxF0AIUnMrOhfKQ/LjgREXPB6uCl899INUTXRNNjRpeMXyJ2wMMmOAbua2qEd1r13Bu1n+6A823Hzb33fyMXuqWnJwBJ4DCvMlGuEsfuOK+xk7DaBfLHbcM6fsPk0/4psTE6YLgC41remr6+u5ZWsY/faMtSnNPie8Z8Ov0DIYGdhbJjUXk1HomxRV9+ZfZ2Ob8iCwlaAQAyEUM6fs3Kxt8pBD8dx1HOkhsfBWPvuDr5y+kqE7H8/MuPDTc0QgH2pjUMpmw/XBwNDHshVEjrZvtICOjOLUJxcowLO1ivNYwPwowQxfisMy56LfYdjsOslBiqsrkAqvNGm1zu8wKHeqVN9w5l3yUELpvubfm9NKIvYcl6yWF36T0c5vE+g0DU/Jy4XpTj0hZG9QV2mRQcLJnd2pxQtJT7cPFtrn/+tgRxzjEtbDXummDV4sE= mail@renemoser.net" - -vultr_server_plan_1: 1024 MB RAM,25 GB SSD,1.00 TB BW diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_block_storage/tasks/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_block_storage/tasks/main.yml deleted file mode 100644 index 3b802acea..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_block_storage/tasks/main.yml +++ /dev/null @@ -1,315 +0,0 @@ -# Copyright (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) ---- -- name: setup - vultr_block_storage: - name: "{{ vultr_block_storage_name }}" - state: absent - register: result -- name: verify setup - assert: - that: - - result is success - -- name: setup create ssh keys - vultr_ssh_key: - name: "{{ item.name }}" - ssh_key: "{{ item.key }}" - loop: "{{ vultr_server_ssh_keys }}" - -- name: Setup create server for attachment - # We'll use this server to test block storage attachment, later - # in this test suite. - vultr_server: - name: "{{ vultr_server_name }}" - os: CentOS 8 x64 - plan: "{{ vultr_server_plan_1 }}" - ssh_keys: - - key1 - region: "{{ vultr_block_storage_region }}" - state: started - register: result_server_setup -- name: verify setup create server - assert: - that: - - result_server_setup is changed - -- name: test fail if missing name - vultr_block_storage: - register: result - ignore_errors: yes -- name: verify test fail if missing name - assert: - that: - - result is failed - - 'result.msg == "missing required arguments: name"' - -- name: test fail if missing params for state=present - vultr_block_storage: - name: "{{ vultr_block_storage_name }}" - register: result - ignore_errors: yes -- name: verify fail if missing params for state=present - assert: - that: - - result is failed - - 'result.msg == "state is present but all of the following are missing: size, region"' - -- name: test create block storage volume in check mode - vultr_block_storage: - name: "{{ vultr_block_storage_name }}" - size: "{{ vultr_block_storage_size }}" - region: "{{ vultr_block_storage_region }}" - register: result - check_mode: yes -- name: verify test create server in check mode - assert: - that: - - result is changed - -- name: test create block storage volume - vultr_block_storage: - name: "{{ vultr_block_storage_name }}" - size: "{{ vultr_block_storage_size }}" - region: "{{ vultr_block_storage_region }}" - register: result -- name: verify test create block storage volume - assert: - that: - - result is changed - - result.vultr_block_storage.name == "{{ vultr_block_storage_name }}" - - result.vultr_block_storage.region == "{{ vultr_block_storage_region }}" - - result.vultr_block_storage.size == 10 - -- name: test create block storage volume idempotence - vultr_block_storage: - name: "{{ vultr_block_storage_name }}" - size: "{{ vultr_block_storage_size }}" - region: "{{ vultr_block_storage_region }}" - register: result -- name: verify test block storage volume idempotence - assert: - that: - - result is not changed - - result.vultr_block_storage.name == "{{ vultr_block_storage_name }}" - - result.vultr_block_storage.region == "{{ vultr_block_storage_region }}" - - result.vultr_block_storage.size == 10 - -# volumes size can only be modified every 60s -- name: wait about 60s before resizing volume - wait_for: - timeout: 65 - -- name: test resize block storage volume - vultr_block_storage: - name: "{{ vultr_block_storage_name }}" - size: "{{ vultr_block_storage_size_2 }}" - region: "{{ vultr_block_storage_region }}" - register: result -- name: verify resize block storage volume - assert: - that: - - result is changed - - 'result.vultr_block_storage.size == {{ vultr_block_storage_size_2 | int }}' - -# volume size can only be modified every 60s -- name: wait about 60s before resizing volume - wait_for: - timeout: 65 - -- name: test resize block storage volume idempotency - vultr_block_storage: - name: "{{ vultr_block_storage_name }}" - size: "{{ vultr_block_storage_size_2 }}" - region: "{{ vultr_block_storage_region }}" - register: result -- name: verify resize block storage volume idempotency - assert: - that: - - not result.changed - - 'result.vultr_block_storage.size == {{ vultr_block_storage_size_2 | int }}' - -- name: test attaching fails if server id not provided - vultr_block_storage: - name: "{{ vultr_block_storage_name }}" - size: "{{ vultr_block_storage_size }}" - region: "{{ vultr_block_storage_region }}" - state: attached - register: result - ignore_errors: yes -- name: verify attaching fails if server id not provided - assert: - that: - - result is failed - - 'result.msg == "state is attached but all of the following are missing: attached_to_SUBID"' - -- name: test attach block volume in check mode - vultr_block_storage: - name: "{{ vultr_block_storage_name }}" - size: "{{ vultr_block_storage_size }}" - region: "{{ vultr_block_storage_region }}" - state: attached - attached_to_id: 1337 # dummy server id - register: result - check_mode: yes -- name: verify attach block volume in check mode - assert: - that: - - result is changed - - result.vultr_block_storage.attached_to_id == 1337 - -- name: test attach block volume - vultr_block_storage: - name: "{{ vultr_block_storage_name }}" - size: "{{ vultr_block_storage_size }}" - region: "{{ vultr_block_storage_region }}" - state: attached - attached_to_SUBID: "{{ result_server_setup.vultr_server.id | int}}" - register: result -- name: verify attach block volume - assert: - that: - - result.changed - - 'result.vultr_block_storage.attached_to_id == {{ result_server_setup.vultr_server.id | int }}' - -- name: test attach block volume idempotency - vultr_block_storage: - name: "{{ vultr_block_storage_name }}" - size: "{{ vultr_block_storage_size }}" - region: "{{ vultr_block_storage_region }}" - state: attached - attached_to_SUBID: "{{ result_server_setup.vultr_server.id | int }}" - register: result -- name: verify attach block volume idempotency - assert: - that: - - not result.changed - - 'result.vultr_block_storage.attached_to_id == {{ result_server_setup.vultr_server.id | int }}' - -# volume size can only be modified every 60s -- name: wait about 60s before resizing volume - wait_for: - timeout: 65 - -- name: test resize block storage volume while attaching - vultr_block_storage: - name: "{{ vultr_block_storage_name }}" - size: "{{ vultr_block_storage_size_3 }}" - region: "{{ vultr_block_storage_region }}" - state: attached - attached_to_SUBID: "{{ result_server_setup.vultr_server.id | int }}" - register: result -- name: verify resize block storage volume - assert: - that: - - result is changed - - 'result.vultr_block_storage.size == {{ vultr_block_storage_size_3 | int }}' - -- name: test attach block volume fails if attached somewhere else - vultr_block_storage: - name: "{{ vultr_block_storage_name }}" - size: "{{ vultr_block_storage_size }}" - region: "{{ vultr_block_storage_region }}" - state: attached - attached_to_SUBID: 1337 # some other server - register: result - ignore_errors: true -- name: verify attach block volume fails if attached somewhere else - assert: - that: - - result is failed - - 'result.msg == "Volume already attached to server {{ result_server_setup.vultr_server.id | int }}"' - -- name: test detach block volume in check mode - vultr_block_storage: - name: "{{ vultr_block_storage_name }}" - size: "{{ vultr_block_storage_size }}" - region: "{{ vultr_block_storage_region }}" - state: detached - register: result - check_mode: yes -- name: verify detach block volume - assert: - that: - - result is changed - - not result.vultr_block_storage.attached_to_id - -- name: test detach block volume - vultr_block_storage: - name: "{{ vultr_block_storage_name }}" - size: "{{ vultr_block_storage_size }}" - region: "{{ vultr_block_storage_region }}" - state: detached - register: result -- name: verify detach block volume - assert: - that: - - result is changed - - not result.vultr_block_storage.attached_to_id - -- name: test detach block volume idempotency - vultr_block_storage: - name: "{{ vultr_block_storage_name }}" - size: "{{ vultr_block_storage_size }}" - region: "{{ vultr_block_storage_region }}" - state: detached - register: result -- name: verify detach block volume idempotency - assert: - that: - - result is not changed - - not result.vultr_block_storage.attached_to_id - -- name: test destroy block storage volume in check mode - vultr_block_storage: - name: "{{ vultr_block_storage_name }}" - state: absent - register: result - check_mode: yes -- name: verify test destroy block storage volume in check mode - assert: - that: - - result is changed - - result.vultr_block_storage.name == "{{ vultr_block_storage_name }}" - -- name: test destroy block storage volume - vultr_block_storage: - name: "{{ vultr_block_storage_name }}" - state: absent - register: result -- name: verify test destroy an existing block storage volume - assert: - that: - - result is changed - - result.vultr_block_storage.name == "{{ vultr_block_storage_name }}" - -- name: test destroy an existing block storage volume idempotence - vultr_block_storage: - name: "{{ vultr_block_storage_name }}" - state: absent - register: result -- name: verify test destroy an existing block storage volume idempotence - assert: - that: - - result is not changed - -# Servers can only be destroyed 5 min after creation -- name: wait for 5 min before destroying server - wait_for: - -- name: cleanup server - vultr_server: - name: "{{ vultr_server_name }}" - state: absent - register: result -- name: verify test absent server - assert: - that: - - result is changed - -- name: cleanup ssh keys - vultr_ssh_key: - name: "{{ item.name }}" - ssh_key: "{{ item.key }}" - state: absent - loop: "{{ vultr_server_ssh_keys }}" diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_block_storage_info/aliases b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_block_storage_info/aliases deleted file mode 100644 index bf469bb90..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_block_storage_info/aliases +++ /dev/null @@ -1 +0,0 @@ -cloud/vultr diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_block_storage_info/defaults/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_block_storage_info/defaults/main.yml deleted file mode 100644 index 17be33cb0..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_block_storage_info/defaults/main.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -vultr_resource_prefix: "vultr-test-prefix" -vultr_block_storage_name: "{{ vultr_resource_prefix }}-volume" -vultr_block_storage_size: 10 -vultr_block_storage_region: New Jersey diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_block_storage_info/tasks/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_block_storage_info/tasks/main.yml deleted file mode 100644 index 1777c25e3..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_block_storage_info/tasks/main.yml +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright (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) ---- -- name: test gather vultr block storage volume info - empty resource - vultr_block_storage_info: - -- name: Create the block storage volume - vultr_block_storage: - name: '{{ vultr_block_storage_name }}' - size: '{{ vultr_block_storage_size }}' - region: '{{ vultr_block_storage_region }}' - -- name: test gather vultr block storage volume info in check mode - vultr_block_storage_info: - check_mode: yes - register: result - -- name: verify test gather vultr block storage volume info in check mode - assert: - that: - - result.vultr_block_storage_info|selectattr('name','equalto','{{ vultr_block_storage_name }}') | list | count == 1 - -- name: test gather vultr block storage volume info - vultr_block_storage_info: - register: result - -- name: verify test gather vultr block storage volume info - assert: - that: - - result.vultr_block_storage_info|selectattr('name','equalto','{{ vultr_block_storage_name }}') | list | count == 1 - -- name: Delete the block storage volume - vultr_block_storage: - name: '{{ vultr_block_storage_name }}' - state: absent diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_domain/aliases b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_domain/aliases deleted file mode 100644 index bf469bb90..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_domain/aliases +++ /dev/null @@ -1 +0,0 @@ -cloud/vultr diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_domain/defaults/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_domain/defaults/main.yml deleted file mode 100644 index 45cbf7287..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_domain/defaults/main.yml +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright (c) 2018, René Moser <mail@renemoser.net> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -vultr_resource_prefix: "vultr-test-prefix" -vultr_dns_domain_name: "{{ vultr_resource_prefix }}-example-ansible.com" diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_domain/tasks/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_domain/tasks/main.yml deleted file mode 100644 index 706783978..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_domain/tasks/main.yml +++ /dev/null @@ -1,99 +0,0 @@ -# Copyright (c) 2018, René Moser <mail@renemoser.net> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -- name: setup - vultr_dns_domain: - name: "{{ vultr_dns_domain_name }}" - state: absent - register: result -- name: verify setup - assert: - that: - - result is success - -- name: test fail if missing name - vultr_dns_domain: - register: result - ignore_errors: yes -- name: verify test fail if missing name - assert: - that: - - result is failed - - 'result.msg == "missing required arguments: name"' - -- name: test fail if missing params for state=present - vultr_dns_domain: - name: "{{ vultr_dns_domain_name }}" - register: result - ignore_errors: yes -- name: verify fail if missing params for state=present - assert: - that: - - result is failed - - 'result.msg == "state is present but all of the following are missing: server_ip"' - -- name: test create dns domain in check mode - vultr_dns_domain: - name: "{{ vultr_dns_domain_name }}" - server_ip: 10.10.10.10 - register: result - check_mode: yes -- name: verify test create dns domain in check mode - assert: - that: - - result is changed - -- name: test create dns domain - vultr_dns_domain: - name: "{{ vultr_dns_domain_name }}" - server_ip: 10.10.10.10 - register: result -- name: verify test create dns domain - assert: - that: - - result is changed - - result.vultr_dns_domain.name == '{{ vultr_dns_domain_name }}' - -- name: test create dns domain idempotence - vultr_dns_domain: - name: "{{ vultr_dns_domain_name }}" - server_ip: 10.10.10.10 - register: result -- name: verify test create dns domain idempotence - assert: - that: - - result is not changed - - result.vultr_dns_domain.name == '{{ vultr_dns_domain_name }}' - -- name: test absent dns domain in check mode - vultr_dns_domain: - name: "{{ vultr_dns_domain_name }}" - state: absent - register: result - check_mode: yes -- name: verify test absent dns domain in check mode - assert: - that: - - result is changed - - result.vultr_dns_domain.name == '{{ vultr_dns_domain_name }}' - -- name: test absent dns domain - vultr_dns_domain: - name: "{{ vultr_dns_domain_name }}" - state: absent - register: result -- name: verify test absent dns domain - assert: - that: - - result is changed - - result.vultr_dns_domain.name == '{{ vultr_dns_domain_name }}' - -- name: test absent dns domain idempotence - vultr_dns_domain: - name: "{{ vultr_dns_domain_name }}" - state: absent - register: result -- name: verify test absent dns domain idempotence - assert: - that: - - result is not changed diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_domain_info/aliases b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_domain_info/aliases deleted file mode 100644 index bf469bb90..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_domain_info/aliases +++ /dev/null @@ -1 +0,0 @@ -cloud/vultr diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_domain_info/defaults/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_domain_info/defaults/main.yml deleted file mode 100644 index a452ee128..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_domain_info/defaults/main.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -vultr_resource_prefix: "vultr-test-prefix" -dns_domain_name: "{{ vultr_resource_prefix }}-example-ansible.com" -dns_domain_server_ip: 104.24.16.59 diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_domain_info/tasks/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_domain_info/tasks/main.yml deleted file mode 100644 index d58aa1085..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_domain_info/tasks/main.yml +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright (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) ---- -- name: Create the record - vultr_dns_domain: - name: '{{ dns_domain_name }}' - server_ip: '{{ dns_domain_server_ip }}' - -- name: test gather vultr dns domain info in check mode - vultr_dns_domain_info: - check_mode: yes - register: result - -- name: verify test gather vultr dns domain info in check mode - assert: - that: - - result.vultr_dns_domain_info|selectattr('domain','equalto','{{ dns_domain_name }}') | list | count == 1 - -- name: test gather vultr dns domain info - vultr_dns_domain_info: - register: result - -- name: verify test gather vultr dns domain info - assert: - that: - - result.vultr_dns_domain_info|selectattr('domain','equalto','{{ dns_domain_name }}') | list | count == 1 - -- name: Delete the record - vultr_dns_domain: - name: '{{ dns_domain_name }}' - server_ip: '{{ dns_domain_server_ip }}' - state: absent diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_record/aliases b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_record/aliases deleted file mode 100644 index bf469bb90..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_record/aliases +++ /dev/null @@ -1 +0,0 @@ -cloud/vultr diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_record/defaults/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_record/defaults/main.yml deleted file mode 100644 index fb52cfd95..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_record/defaults/main.yml +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright (c) 2018, René Moser <mail@renemoser.net> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -vultr_resource_prefix: "vultr-test-prefix" -vultr_dns_domain_name: "{{ vultr_resource_prefix }}-example-ansible.com" -vultr_dns_record_items: -# Single A record -- name: test-www - data: 10.10.10.10 - ttl: 400 - update_data: 10.10.10.11 - update_ttl: 200 - -# Multiple A records -- name: test-www-multiple - data: 10.10.11.10 - update_data: 10.10.11.11 - multiple: true - update_ttl: 600 - -# CNAME -- name: test-cname - data: www.ansible.com - update_data: www.ansible.ch - record_type: CNAME - -# Single Multiple MX record -- data: mx1.example-ansible.com - priority: 10 - update_priority: 20 - record_type: MX - -# Multiple MX records -- data: mx2.example-ansible.com - priority: 10 - update_data: mx1.example-ansible.com - update_priority: 20 - record_type: MX - multiple: true diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_record/tasks/create_record.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_record/tasks/create_record.yml deleted file mode 100644 index 5f33eb140..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_record/tasks/create_record.yml +++ /dev/null @@ -1,67 +0,0 @@ -# Copyright (c) 2018, René Moser <mail@renemoser.net> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -- name: test setup dns record - vultr_dns_record: - name: "{{ item.name | default(omit) }}" - domain: "{{ vultr_dns_domain_name }}" - record_type: "{{ item.record_type | default(omit) }}" - state: absent - register: result -- name: verify test setup dns record - assert: - that: - - result is successful - -- name: test create a dns record in check mode - vultr_dns_record: - name: "{{ item.name | default(omit) }}" - domain: "{{ vultr_dns_domain_name }}" - data: "{{ item.data }}" - ttl: "{{ item.ttl | default(omit) }}" - record_type: "{{ item.record_type | default(omit) }}" - priority: "{{ item.priority | default(omit) }}" - check_mode: yes - register: result -- name: verify test create a dns record in check mode - assert: - that: - - result is changed - -- name: test create a dns record - vultr_dns_record: - name: "{{ item.name | default(omit) }}" - domain: "{{ vultr_dns_domain_name }}" - data: "{{ item.data }}" - ttl: "{{ item.ttl | default(omit) }}" - record_type: "{{ item.record_type | default(omit) }}" - priority: "{{ item.priority | default(omit) }}" - register: result -- name: verify test create a dns record - assert: - that: - - result is changed - - result.vultr_dns_record.data == "{{ item.data }}" - - result.vultr_dns_record.name == "{{ item.name | default("") }}" - - result.vultr_dns_record.record_type == "{{ item.record_type | default('A') }}" - - result.vultr_dns_record.ttl == {{ item.ttl | default(300) }} - - result.vultr_dns_record.priority == {{ item.priority | default(0) }} - -- name: test create a dns record idempotence - vultr_dns_record: - name: "{{ item.name | default(omit) }}" - domain: "{{ vultr_dns_domain_name }}" - data: "{{ item.data }}" - ttl: "{{ item.ttl | default(omit) }}" - record_type: "{{ item.record_type | default(omit) }}" - priority: "{{ item.priority | default(omit) }}" - register: result -- name: verify test create a dns record idempotence - assert: - that: - - result is not changed - - result.vultr_dns_record.data == "{{ item.data }}" - - result.vultr_dns_record.name == "{{ item.name | default("") }}" - - result.vultr_dns_record.record_type == "{{ item.record_type | default('A') }}" - - result.vultr_dns_record.ttl == {{ item.ttl | default(300) }} - - result.vultr_dns_record.priority == {{ item.priority | default(0) }} diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_record/tasks/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_record/tasks/main.yml deleted file mode 100644 index 19419efcb..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_record/tasks/main.yml +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (c) 2018, René Moser <mail@renemoser.net> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -- name: setup dns domain - vultr_dns_domain: - name: "{{ vultr_dns_domain_name }}" - server_ip: 10.10.10.10 - register: result -- name: verify setup dns domain - assert: - that: - - result is successful - -- include_tasks: test_fail_multiple.yml - -- include_tasks: record.yml - with_items: "{{ vultr_dns_record_items }}" diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_record/tasks/record.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_record/tasks/record.yml deleted file mode 100644 index c8c3926dc..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_record/tasks/record.yml +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (c) 2018, René Moser <mail@renemoser.net> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -- include_tasks: create_record.yml -- include_tasks: update_record.yml -- include_tasks: remove_record.yml diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_record/tasks/remove_record.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_record/tasks/remove_record.yml deleted file mode 100644 index e776a492e..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_record/tasks/remove_record.yml +++ /dev/null @@ -1,114 +0,0 @@ -# Copyright (c) 2018, René Moser <mail@renemoser.net> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -- name: test remove a dns record in check mode - vultr_dns_record: - name: "{{ item.name | default(omit) }}" - domain: "{{ vultr_dns_domain_name }}" - data: "{{ item.update_data | default(item.data) }}" - record_type: "{{ item.record_type | default(omit) }}" - multiple: "{{ item.multiple | default(omit) }}" - state: absent - check_mode: yes - register: result -- name: verify test remove a dns record in check mode - assert: - that: - - result is changed - - result.vultr_dns_record.data == "{{ item.update_data | default(item.data) }}" - - result.vultr_dns_record.name == "{{ item.name | default("") }}" - - result.vultr_dns_record.record_type == "{{ item.record_type | default('A') }}" - - result.vultr_dns_record.ttl == {{ item.update_ttl | default(300) }} - - result.vultr_dns_record.priority == {{ item.update_priority | default(item.priority | default(0)) }} - -- name: test remove second dns record in check mode - vultr_dns_record: - name: "{{ item.name | default(omit) }}" - domain: "{{ vultr_dns_domain_name }}" - data: "{{ item.data | default(item.data) }}" - record_type: "{{ item.record_type | default(omit) }}" - multiple: "{{ item.multiple | default(omit) }}" - state: absent - check_mode: yes - register: result - when: item.multiple is defined and item.multiple == true -- name: verify test remove a dns record in check mode - assert: - that: - - result is changed - - result.vultr_dns_record.data == "{{ item.data | default(item.data) }}" - - result.vultr_dns_record.name == "{{ item.name | default("") }}" - - result.vultr_dns_record.record_type == "{{ item.record_type | default('A') }}" - - result.vultr_dns_record.ttl == {{ item.ttl | default(300) }} - - result.vultr_dns_record.priority == {{ item.priority | default(0) }} - when: item.multiple is defined and item.multiple == true - -- name: test remove a dns record - vultr_dns_record: - name: "{{ item.name | default(omit) }}" - domain: "{{ vultr_dns_domain_name }}" - data: "{{ item.update_data | default(item.data) }}" - record_type: "{{ item.record_type | default(omit) }}" - multiple: "{{ item.multiple | default(omit) }}" - state: absent - register: result -- name: verify test remove a dns record - assert: - that: - - result is changed - - result.vultr_dns_record.data == "{{ item.update_data | default(item.data) }}" - - result.vultr_dns_record.name == "{{ item.name | default("") }}" - - result.vultr_dns_record.record_type == "{{ item.record_type | default('A') }}" - - result.vultr_dns_record.ttl == {{ item.update_ttl | default(300) }} - - result.vultr_dns_record.priority == {{ item.update_priority | default(item.priority | default(0)) }} - -- name: test remove second dns record - vultr_dns_record: - name: "{{ item.name | default(omit) }}" - domain: "{{ vultr_dns_domain_name }}" - data: "{{ item.data }}" - record_type: "{{ item.record_type | default(omit) }}" - multiple: "{{ item.multiple | default(omit) }}" - state: absent - register: result - when: item.multiple is defined and item.multiple == true -- name: verify test remove a dns record - assert: - that: - - result is changed - - result.vultr_dns_record.data == "{{ item.data }}" - - result.vultr_dns_record.name == "{{ item.name | default("") }}" - - result.vultr_dns_record.record_type == "{{ item.record_type | default('A') }}" - - result.vultr_dns_record.ttl == {{ item.ttl | default(300) }} - - result.vultr_dns_record.priority == {{ item.priority | default(0) }} - when: item.multiple is defined and item.multiple == true - -- name: test remove a dns record idempotence - vultr_dns_record: - name: "{{ item.name | default(omit) }}" - domain: "{{ vultr_dns_domain_name }}" - data: "{{ item.update_data | default(item.data) }}" - record_type: "{{ item.record_type | default(omit) }}" - multiple: "{{ item.multiple | default(omit) }}" - state: absent - register: result -- name: verify test remove a dns record idempotence - assert: - that: - - result is not changed - -- name: test remove second dns record idempotence - vultr_dns_record: - name: "{{ item.name | default(omit) }}" - domain: "{{ vultr_dns_domain_name }}" - data: "{{ item.data }}" - record_type: "{{ item.record_type | default(omit) }}" - multiple: "{{ item.multiple | default(omit) }}" - state: absent - register: result - when: item.multiple is defined and item.multiple == true -- name: verify test remove a dns record idempotence - assert: - that: - - result is not changed - when: item.multiple is defined and item.multiple == true diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_record/tasks/test_fail_multiple.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_record/tasks/test_fail_multiple.yml deleted file mode 100644 index a41d9db57..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_record/tasks/test_fail_multiple.yml +++ /dev/null @@ -1,78 +0,0 @@ -# Copyright (c) 2018, René Moser <mail@renemoser.net> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -- name: setup first dns record - vultr_dns_record: - name: test-multiple - domain: "{{ vultr_dns_domain_name }}" - data: 1.2.3.4 - multiple: yes - register: result -- name: verify setup a dns record - assert: - that: - - result is successful - -- name: setup second dns record - vultr_dns_record: - name: test-multiple - domain: "{{ vultr_dns_domain_name }}" - data: 1.2.3.5 - multiple: yes - register: result -- name: verify setup second dns record - assert: - that: - - result is successful - -- name: test-multiple fail multiple identical records found - vultr_dns_record: - name: test-multiple - domain: "{{ vultr_dns_domain_name }}" - state: absent - register: result - ignore_errors: yes -- name: verify test fail multiple identical records found - assert: - that: - - result is failed - -- name: test-multiple fail absent multiple identical records but not data - vultr_dns_record: - name: test-multiple - domain: "{{ vultr_dns_domain_name }}" - state: absent - multiple: yes - register: result - ignore_errors: yes -- name: verify test-multiple success absent multiple identical records found - assert: - that: - - result is failed - - "result.msg == 'multiple is True but all of the following are missing: data'" - -- name: test-multiple success absent multiple identical records second found - vultr_dns_record: - name: test-multiple - domain: "{{ vultr_dns_domain_name }}" - data: 1.2.3.5 - state: absent - multiple: yes - register: result -- name: verify test-multiple success absent multiple identical records second found - assert: - that: - - result is changed - -- name: test-multiple success absent multiple identical records first found - vultr_dns_record: - name: test-multiple - domain: "{{ vultr_dns_domain_name }}" - data: 1.2.3.4 - state: absent - multiple: yes - register: result -- name: verify test-multiple success absent multiple identical records firstfound - assert: - that: - - result is changed diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_record/tasks/update_record.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_record/tasks/update_record.yml deleted file mode 100644 index 204ebda49..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_dns_record/tasks/update_record.yml +++ /dev/null @@ -1,70 +0,0 @@ -# Copyright (c) 2018, René Moser <mail@renemoser.net> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -- name: test update or add another dns record in check mode - vultr_dns_record: - name: "{{ item.name | default(omit) }}" - domain: "{{ vultr_dns_domain_name }}" - data: "{{ item.update_data | default(item.data) }}" - ttl: "{{ item.update_ttl | default(omit) }}" - record_type: "{{ item.record_type | default(omit) }}" - priority: "{{ item.update_priority | default(omit) }}" - multiple: "{{ item.multiple | default(omit) }}" - check_mode: yes - register: result -- name: verify test updatein check mode - assert: - that: - - result is changed - - result.vultr_dns_record.data == "{{ item.data }}" - - result.vultr_dns_record.name == "{{ item.name | default("") }}" - - result.vultr_dns_record.record_type == "{{ item.record_type | default('A') }}" - - result.vultr_dns_record.ttl == {{ item.ttl | default(300) }} - - result.vultr_dns_record.priority == {{ item.priority | default(0) }} - when: item.multiple is undefined or item.multiple == false -- name: verify test add another dns record in check mode - assert: - that: - - result is changed - - not result.vultr_dns_record - when: item.multiple is defined and item.multiple == true - -- name: test update or add another dns record - vultr_dns_record: - name: "{{ item.name | default(omit) }}" - domain: "{{ vultr_dns_domain_name }}" - data: "{{ item.update_data | default(item.data) }}" - ttl: "{{ item.update_ttl | default(omit) }}" - record_type: "{{ item.record_type | default(omit) }}" - priority: "{{ item.update_priority | default(omit) }}" - multiple: "{{ item.multiple | default(omit) }}" - register: result -- name: verify test update a dns record - assert: - that: - - result is changed - - result.vultr_dns_record.data == "{{ item.update_data | default(item.data) }}" - - result.vultr_dns_record.name == "{{ item.name | default("") }}" - - result.vultr_dns_record.ttl == {{ item.update_ttl | default(300) }} - - result.vultr_dns_record.record_type == "{{ item.record_type | default('A') }}" - - result.vultr_dns_record.priority == {{ item.update_priority | default(0) }} - -- name: test update or add another dns record idempotence - vultr_dns_record: - name: "{{ item.name | default(omit) }}" - domain: "{{ vultr_dns_domain_name }}" - data: "{{ item.update_data | default(item.data) }}" - ttl: "{{ item.update_ttl | default(omit) }}" - record_type: "{{ item.record_type | default(omit) }}" - priority: "{{ item.update_priority | default(omit) }}" - multiple: "{{ item.multiple | default(omit) }}" - register: result -- name: verify test update a dns record idempotence - assert: - that: - - result is not changed - - result.vultr_dns_record.data == "{{ item.update_data | default(item.data) }}" - - result.vultr_dns_record.name == "{{ item.name | default("") }}" - - result.vultr_dns_record.ttl == {{ item.update_ttl | default(300) }} - - result.vultr_dns_record.record_type == "{{ item.record_type | default('A') }}" - - result.vultr_dns_record.priority == {{ item.update_priority | default(0) }} diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_firewall_group/aliases b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_firewall_group/aliases deleted file mode 100644 index bf469bb90..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_firewall_group/aliases +++ /dev/null @@ -1 +0,0 @@ -cloud/vultr diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_firewall_group/defaults/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_firewall_group/defaults/main.yml deleted file mode 100644 index 7057b4667..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_firewall_group/defaults/main.yml +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright (c) 2018, René Moser <mail@renemoser.net> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -vultr_resource_prefix: "vultr-test-prefix" -vultr_firewall_group_name: "{{ vultr_resource_prefix }}_firewall-group" diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_firewall_group/tasks/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_firewall_group/tasks/main.yml deleted file mode 100644 index 577457c2d..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_firewall_group/tasks/main.yml +++ /dev/null @@ -1,86 +0,0 @@ -# Copyright (c) 2018, René Moser <mail@renemoser.net> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -- name: setup - vultr_firewall_group: - name: "{{ vultr_firewall_group_name }}" - state: absent - register: result -- name: verify setup - assert: - that: - - result is success - -- name: test fail if missing name - vultr_firewall_group: - register: result - ignore_errors: yes -- name: verify test fail if missing name - assert: - that: - - result is failed - - 'result.msg == "missing required arguments: name"' - -- name: test create firewall group in check mode - vultr_firewall_group: - name: "{{ vultr_firewall_group_name }}" - register: result - check_mode: yes -- name: verify test create firewall group in check mode - assert: - that: - - result is changed - -- name: test create firewall group - vultr_firewall_group: - name: "{{ vultr_firewall_group_name }}" - register: result -- name: verify test create firewall group - assert: - that: - - result is changed - - result.vultr_firewall_group.name == '{{ vultr_firewall_group_name }}' - -- name: test create firewall group idempotence - vultr_firewall_group: - name: "{{ vultr_firewall_group_name }}" - - register: result -- name: verify test create firewall group idempotence - assert: - that: - - result is not changed - - result.vultr_firewall_group.name == '{{ vultr_firewall_group_name }}' - -- name: test absent firewall group in check mode - vultr_firewall_group: - name: "{{ vultr_firewall_group_name }}" - state: absent - register: result - check_mode: yes -- name: verify test absent firewall group in check mode - assert: - that: - - result is changed - - result.vultr_firewall_group.name == '{{ vultr_firewall_group_name }}' - -- name: test absent firewall group - vultr_firewall_group: - name: "{{ vultr_firewall_group_name }}" - state: absent - register: result -- name: verify test absent firewall group - assert: - that: - - result is changed - - result.vultr_firewall_group.name == '{{ vultr_firewall_group_name }}' - -- name: test absent firewall group idempotence - vultr_firewall_group: - name: "{{ vultr_firewall_group_name }}" - state: absent - register: result -- name: verify test absent firewall group idempotence - assert: - that: - - result is not changed diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_firewall_group_info/aliases b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_firewall_group_info/aliases deleted file mode 100644 index bf469bb90..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_firewall_group_info/aliases +++ /dev/null @@ -1 +0,0 @@ -cloud/vultr diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_firewall_group_info/defaults/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_firewall_group_info/defaults/main.yml deleted file mode 100644 index e545fe42e..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_firewall_group_info/defaults/main.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -vultr_resource_prefix: "vultr-test-prefix" -firewall_group_name: "{{ vultr_resource_prefix }}_firewall-group" diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_firewall_group_info/tasks/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_firewall_group_info/tasks/main.yml deleted file mode 100644 index e813afd9a..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_firewall_group_info/tasks/main.yml +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright (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) ---- -- name: test gather vultr firewall group info - empty resources - vultr_firewall_group_info: - -- name: Create the firewall group - vultr_firewall_group: - name: '{{ firewall_group_name }}' - -- name: test gather vultr firewall group info in check mode - vultr_firewall_group_info: - check_mode: yes - register: result - -- name: verify test gather vultr firewall group info in check mode - assert: - that: - - result.vultr_firewall_group_info|selectattr('description','equalto','{{ firewall_group_name }}') | list | count == 1 - -- name: test gather vultr firewall group info - vultr_firewall_group_info: - register: result - -- name: verify test gather vultr firewall group info - assert: - that: - - result.vultr_firewall_group_info|selectattr('description','equalto','{{ firewall_group_name }}') | list | count == 1 - -- name: Delete the firewall group - vultr_firewall_group: - name: '{{ firewall_group_name }}' - state: absent diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_firewall_rule/aliases b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_firewall_rule/aliases deleted file mode 100644 index bf469bb90..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_firewall_rule/aliases +++ /dev/null @@ -1 +0,0 @@ -cloud/vultr diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_firewall_rule/defaults/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_firewall_rule/defaults/main.yml deleted file mode 100644 index 7057b4667..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_firewall_rule/defaults/main.yml +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright (c) 2018, René Moser <mail@renemoser.net> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -vultr_resource_prefix: "vultr-test-prefix" -vultr_firewall_group_name: "{{ vultr_resource_prefix }}_firewall-group" diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_firewall_rule/tasks/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_firewall_rule/tasks/main.yml deleted file mode 100644 index 44097434b..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_firewall_rule/tasks/main.yml +++ /dev/null @@ -1,475 +0,0 @@ -# Copyright (c) 2018, René Moser <mail@renemoser.net> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -- name: setup firewall group - vultr_firewall_group: - name: "{{ vultr_firewall_group_name }}" - register: result -- name: verify setup firewall group - assert: - that: - - result is success - -- name: setup firewall rule tcp - vultr_firewall_rule: - group: "{{ vultr_firewall_group_name }}" - port: 53 - state: absent - register: result -- name: verify setup firewal rule - assert: - that: - - result is success - -- name: setup firewall rule udp - vultr_firewall_rule: - group: "{{ vultr_firewall_group_name }}" - port: 53 - protocol: udp - state: absent - register: result -- name: verify setup firewal rule udp - assert: - that: - - result is success - -- name: setup firewall rule udp v6 - vultr_firewall_rule: - group: "{{ vultr_firewall_group_name }}" - port: 53 - protocol: udp - ip_version: v6 - state: absent - register: result -- name: verify setup firewal rule udp v6 - assert: - that: - - result is success - -- name: setup firewall rule port range - vultr_firewall_rule: - group: "{{ vultr_firewall_group_name }}" - start_port: 8000 - end_port: 8080 - protocol: tcp - cidr: 10.100.12.0/24 - state: absent - register: result - tags: tmp -- name: verify setup firewal rule port range - assert: - that: - - result is success - -- name: setup firewall rule icmp - vultr_firewall_rule: - group: "{{ vultr_firewall_group_name }}" - protocol: icmp - state: absent - register: result -- name: verify setup firewal rule - assert: - that: - - result is success - -- name: test fail if missing group - vultr_firewall_rule: - register: result - ignore_errors: yes -- name: verify test fail if missing group - assert: - that: - - result is failed - - 'result.msg == "missing required arguments: group"' - -- name: test create firewall rule tcp in check mode - vultr_firewall_rule: - group: "{{ vultr_firewall_group_name }}" - port: 53 - register: result - check_mode: true -- name: verify test create firewall rule tcp in check mode - assert: - that: - - result is changed - -- name: test create firewall rule tcp - vultr_firewall_rule: - group: "{{ vultr_firewall_group_name }}" - port: 53 - register: result -- name: verify test create firewall rule tcp - assert: - that: - - result is changed - - result.vultr_firewall_rule.action == "accept" - - result.vultr_firewall_rule.protocol == "tcp" - - result.vultr_firewall_rule.start_port == 53 - - result.vultr_firewall_rule.cidr == "0.0.0.0/0" - -- name: test create firewall rule tcp idempotence - vultr_firewall_rule: - group: "{{ vultr_firewall_group_name }}" - port: 53 - register: result -- name: verify test create firewall rule tcp idempotence - assert: - that: - - result is not changed - - result.vultr_firewall_rule.action == "accept" - - result.vultr_firewall_rule.protocol == "tcp" - - result.vultr_firewall_rule.start_port == 53 - - result.vultr_firewall_rule.cidr == "0.0.0.0/0" - -- name: test create firewall rule udp in check mode - vultr_firewall_rule: - group: "{{ vultr_firewall_group_name }}" - port: 53 - protocol: udp - register: result - check_mode: true -- name: verify test create firewall rule udp in check mode - assert: - that: - - result is changed - -- name: test create firewall rule udp - vultr_firewall_rule: - group: "{{ vultr_firewall_group_name }}" - port: 53 - protocol: udp - register: result -- name: verify test create firewall rule udp - assert: - that: - - result is changed - - result.vultr_firewall_rule.action == "accept" - - result.vultr_firewall_rule.protocol == "udp" - - result.vultr_firewall_rule.start_port == 53 - - result.vultr_firewall_rule.cidr == "0.0.0.0/0" - -- name: test create firewall rule udp idempotence - vultr_firewall_rule: - group: "{{ vultr_firewall_group_name }}" - port: 53 - protocol: udp - register: result -- name: verify test create firewall rule udp idempotence - assert: - that: - - result is not changed - - result.vultr_firewall_rule.action == "accept" - - result.vultr_firewall_rule.protocol == "udp" - - result.vultr_firewall_rule.start_port == 53 - - result.vultr_firewall_rule.cidr == "0.0.0.0/0" - -- name: test create firewall rule udp v6 in check mode - vultr_firewall_rule: - group: "{{ vultr_firewall_group_name }}" - port: 53 - protocol: udp - ip_version: v6 - register: result - check_mode: true -- name: verify test create firewall rule udp v6 in check mode - assert: - that: - - result is changed - -- name: test create firewall rule udp v6 - vultr_firewall_rule: - group: "{{ vultr_firewall_group_name }}" - port: 53 - protocol: udp - ip_version: v6 - register: result -- name: verify test create firewall rule udp v6 - assert: - that: - - result is changed - - result.vultr_firewall_rule.action == "accept" - - result.vultr_firewall_rule.protocol == "udp" - - result.vultr_firewall_rule.start_port == 53 - - result.vultr_firewall_rule.cidr == "::/0" - -- name: test create firewall rule udp v6 idempotence - vultr_firewall_rule: - group: "{{ vultr_firewall_group_name }}" - port: 53 - protocol: udp - ip_version: v6 - register: result -- name: verify test create firewall rule udp v6 idempotence - assert: - that: - - result is not changed - - result.vultr_firewall_rule.action == "accept" - - result.vultr_firewall_rule.protocol == "udp" - - result.vultr_firewall_rule.start_port == 53 - - result.vultr_firewall_rule.cidr == "::/0" - -- name: test create firewall rule port range in check mode - vultr_firewall_rule: - group: "{{ vultr_firewall_group_name }}" - start_port: 8000 - end_port: 8080 - protocol: tcp - cidr: 10.100.12.0/24 - register: result - check_mode: true -- name: verify test create firewall rule port range in check mode - assert: - that: - - result is changed - -- name: test create firewall rule port range - vultr_firewall_rule: - group: "{{ vultr_firewall_group_name }}" - start_port: 8000 - end_port: 8080 - protocol: tcp - cidr: 10.100.12.0/24 - register: result -- name: verify test create firewall rule port range - assert: - that: - - result is changed - - result.vultr_firewall_rule.action == "accept" - - result.vultr_firewall_rule.protocol == "tcp" - - result.vultr_firewall_rule.start_port == 8000 - - result.vultr_firewall_rule.end_port == 8080 - - result.vultr_firewall_rule.cidr == "10.100.12.0/24" - -- name: test create firewall rule port range idempotence - vultr_firewall_rule: - group: "{{ vultr_firewall_group_name }}" - start_port: 8000 - end_port: 8080 - protocol: tcp - cidr: 10.100.12.0/24 - register: result -- name: test create firewall rule port range idempotence - assert: - that: - - result is not changed - - result.vultr_firewall_rule.action == "accept" - - result.vultr_firewall_rule.protocol == "tcp" - - result.vultr_firewall_rule.start_port == 8000 - - result.vultr_firewall_rule.end_port == 8080 - - result.vultr_firewall_rule.cidr == "10.100.12.0/24" - -- name: test create firewall rule icmp in check mode - vultr_firewall_rule: - group: "{{ vultr_firewall_group_name }}" - protocol: icmp - register: result - check_mode: true -- name: test create firewall rule icmp in check mode - assert: - that: - - result is changed - -- name: test create firewall rule icmp - vultr_firewall_rule: - group: "{{ vultr_firewall_group_name }}" - protocol: icmp - register: result -- name: test create firewall rule icmp - assert: - that: - - result is changed - - result.vultr_firewall_rule.action == "accept" - - result.vultr_firewall_rule.protocol == "icmp" - -- name: test create firewall rule icmp idempotence - vultr_firewall_rule: - group: "{{ vultr_firewall_group_name }}" - protocol: icmp - register: result -- name: test create firewall rule icmp idempotence - assert: - that: - - result is not changed - - result.vultr_firewall_rule.action == "accept" - - result.vultr_firewall_rule.protocol == "icmp" - -- name: test remove firewall rule icmp in check mode - vultr_firewall_rule: - group: "{{ vultr_firewall_group_name }}" - protocol: icmp - state: absent - register: result - check_mode: true -- name: test remove firewall rule icmp in check mode - assert: - that: - - result is changed - - result.vultr_firewall_rule.action == "accept" - - result.vultr_firewall_rule.protocol == "icmp" - -- name: test remove firewall rule icmp - vultr_firewall_rule: - group: "{{ vultr_firewall_group_name }}" - protocol: icmp - state: absent - register: result -- name: test remove firewall rule icmp - assert: - that: - - result is changed - - result.vultr_firewall_rule.action == "accept" - - result.vultr_firewall_rule.protocol == "icmp" - -- name: test remove firewall rule icmp idempotence - vultr_firewall_rule: - group: "{{ vultr_firewall_group_name }}" - protocol: icmp - state: absent - register: result -- name: test remove firewall rule icmp idempotence - assert: - that: - - result is not changed - -- name: test remove firewall rule tcp in check mode - vultr_firewall_rule: - group: "{{ vultr_firewall_group_name }}" - port: 53 - state: absent - register: result - check_mode: true -- name: verify test remove firewall rule tcp in check mode - assert: - that: - - result is changed - - result.vultr_firewall_rule.action == "accept" - - result.vultr_firewall_rule.protocol == "tcp" - - result.vultr_firewall_rule.start_port == 53 - - result.vultr_firewall_rule.cidr == "0.0.0.0/0" - -- name: test remove firewall rule tcp - vultr_firewall_rule: - group: "{{ vultr_firewall_group_name }}" - port: 53 - state: absent - register: result -- name: verify test remove firewall rule tcp - assert: - that: - - result is changed - - result.vultr_firewall_rule.action == "accept" - - result.vultr_firewall_rule.protocol == "tcp" - - result.vultr_firewall_rule.start_port == 53 - - result.vultr_firewall_rule.cidr == "0.0.0.0/0" - -- name: test remove firewall rule tcp idempotence - vultr_firewall_rule: - group: "{{ vultr_firewall_group_name }}" - port: 53 - state: absent - register: result -- name: verify test remove firewall rule tcp idempotence - assert: - that: - - result is not changed - -- name: test remove firewall rule udp v6 in check mode - vultr_firewall_rule: - group: "{{ vultr_firewall_group_name }}" - port: 53 - protocol: udp - ip_version: v6 - state: absent - register: result - check_mode: true -- name: verify test remove firewall rule udp v6 in check mode - assert: - that: - - result is changed - - result.vultr_firewall_rule.action == "accept" - - result.vultr_firewall_rule.protocol == "udp" - - result.vultr_firewall_rule.start_port == 53 - - result.vultr_firewall_rule.cidr == "::/0" - -- name: test remove firewall rule udp v6 - vultr_firewall_rule: - group: "{{ vultr_firewall_group_name }}" - port: 53 - protocol: udp - ip_version: v6 - state: absent - register: result -- name: verify test remove firewall rule udp v6 - assert: - that: - - result is changed - - result.vultr_firewall_rule.action == "accept" - - result.vultr_firewall_rule.protocol == "udp" - - result.vultr_firewall_rule.start_port == 53 - - result.vultr_firewall_rule.cidr == "::/0" - -- name: test remove firewall rule udp v6 idempotence - vultr_firewall_rule: - group: "{{ vultr_firewall_group_name }}" - port: 53 - protocol: udp - ip_version: v6 - state: absent - register: result -- name: verify test remove firewall rule udp v6 idempotence - assert: - that: - - result is not changed - -- name: test remove firewall rule port range in check mode - vultr_firewall_rule: - group: "{{ vultr_firewall_group_name }}" - start_port: 8000 - end_port: 8080 - protocol: tcp - cidr: 10.100.12.0/24 - state: absent - register: result - check_mode: true -- name: verify test remove firewall rule port range in check mode - assert: - that: - - result is changed - - result.vultr_firewall_rule.action == "accept" - - result.vultr_firewall_rule.protocol == "tcp" - - result.vultr_firewall_rule.start_port == 8000 - - result.vultr_firewall_rule.end_port == 8080 - - result.vultr_firewall_rule.cidr == "10.100.12.0/24" - -- name: test remove firewall rule port range - vultr_firewall_rule: - group: "{{ vultr_firewall_group_name }}" - start_port: 8000 - end_port: 8080 - protocol: tcp - cidr: 10.100.12.0/24 - state: absent - register: result -- name: verify test remove firewall rule port range - assert: - that: - - result is changed - - result.vultr_firewall_rule.action == "accept" - - result.vultr_firewall_rule.protocol == "tcp" - - result.vultr_firewall_rule.start_port == 8000 - - result.vultr_firewall_rule.end_port == 8080 - - result.vultr_firewall_rule.cidr == "10.100.12.0/24" - -- name: test remove firewall rule port range idempotence - vultr_firewall_rule: - group: "{{ vultr_firewall_group_name }}" - start_port: 8000 - end_port: 8080 - protocol: tcp - cidr: 10.100.12.0/24 - state: absent - register: result -- name: verify test remove firewall rule port range idempotence - assert: - that: - - result is not changed diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_network/aliases b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_network/aliases deleted file mode 100644 index bf469bb90..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_network/aliases +++ /dev/null @@ -1 +0,0 @@ -cloud/vultr diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_network/defaults/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_network/defaults/main.yml deleted file mode 100644 index a3d9e5926..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_network/defaults/main.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -vultr_resource_prefix: "vultr-test-prefix" -vultr_network_name: "{{ vultr_resource_prefix }}_network" -vultr_network_cidr: 192.168.42.0/24 -vultr_network_region: New Jersey diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_network/tasks/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_network/tasks/main.yml deleted file mode 100644 index 7a7b0b1b2..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_network/tasks/main.yml +++ /dev/null @@ -1,113 +0,0 @@ -# Copyright (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) ---- -- name: setup - vultr_network: - name: "{{ vultr_network_name }}" - state: absent - register: result -- name: verify setup - assert: - that: - - result is success - -- name: test fail if missing name - vultr_network: - register: result - ignore_errors: yes -- name: verify test fail if missing name - assert: - that: - - result is failed - - 'result.msg == "missing required arguments: name"' - -- name: test fail if missing params for state=present - vultr_network: - name: "{{ vultr_network_name }}" - register: result - ignore_errors: yes -- name: verify fail if missing params for state=present - assert: - that: - - result is failed - - 'result.msg == "state is present but all of the following are missing: cidr, region"' - -- name: test create network in check mode - vultr_network: - name: "{{ vultr_network_name }}" - cidr: "{{ vultr_network_cidr }}" - region: "{{ vultr_network_region }}" - register: result - check_mode: yes -- name: verify test create server in check mode - assert: - that: - - result is changed - -- name: test create network - vultr_network: - name: "{{ vultr_network_name }}" - cidr: "{{ vultr_network_cidr }}" - region: "{{ vultr_network_region }}" - register: result - -- name: verify test create network - assert: - that: - - result is changed - - result.vultr_network.name == "{{ vultr_network_name }}" - - result.vultr_network.region == "{{ vultr_network_region }}" - - result.vultr_network.v4_subnet == "{{ vultr_network_cidr.split('/')[0] }}" - - result.vultr_network.v4_subnet_mask == 24 - -- name: test create network idempotence - vultr_network: - name: "{{ vultr_network_name }}" - cidr: "{{ vultr_network_cidr }}" - region: "{{ vultr_network_region }}" - register: result - -- name: verify test network idempotence - assert: - that: - - result is not changed - - result.vultr_network.name == "{{ vultr_network_name }}" - - result.vultr_network.region == "{{ vultr_network_region }}" - - result.vultr_network.v4_subnet == "{{ vultr_network_cidr.split('/')[0] }}" - - result.vultr_network.v4_subnet_mask == 24 - -- name: test destroy network in check mode - vultr_network: - name: "{{ vultr_network_name }}" - state: absent - register: result - check_mode: yes - -- name: verify test destroy network in check mode - assert: - that: - - result is changed - - result.vultr_network.name == "{{ vultr_network_name }}" - -- name: test destroy network volume - vultr_network: - name: "{{ vultr_network_name }}" - state: absent - register: result - -- name: verify test destroy an existing network - assert: - that: - - result is changed - - result.vultr_network.name == "{{ vultr_network_name }}" - -- name: test destroy an existing network idempotence - vultr_network: - name: "{{ vultr_network_name }}" - state: absent - register: result - -- name: verify test destroy an existing network idempotence - assert: - that: - - result is not changed diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_network_info/aliases b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_network_info/aliases deleted file mode 100644 index bf469bb90..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_network_info/aliases +++ /dev/null @@ -1 +0,0 @@ -cloud/vultr diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_network_info/defaults/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_network_info/defaults/main.yml deleted file mode 100644 index 28e3e705b..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_network_info/defaults/main.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -vultr_resource_prefix: "vultr_test_prefix" -vultr_network_name: "{{ vultr_resource_prefix }}_network" -vultr_network_cidr: 192.168.42.0/24 -vultr_network_region: New Jersey diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_network_info/tasks/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_network_info/tasks/main.yml deleted file mode 100644 index 90d45a08b..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_network_info/tasks/main.yml +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright (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) ---- -- name: test gather vultr network info - empty resources - vultr_network_info: - -- name: Create the network - vultr_network: - name: '{{ vultr_network_name }}' - cidr: '{{ vultr_network_cidr }}' - region: '{{ vultr_network_region }}' - -- name: test gather vultr network info in check mode - vultr_network_info: - check_mode: yes - register: result - -- name: verify test gather vultr network info in check mode - assert: - that: - - result.vultr_network_info|selectattr('name','equalto','{{ vultr_network_name }}') | list | count == 1 - -- name: test gather vultr network info - vultr_network_info: - register: result - -- name: verify test gather vultr network info - assert: - that: - - result.vultr_network_info|selectattr('name','equalto','{{ vultr_network_name }}') | list | count == 1 - -- name: Delete the script - vultr_network: - name: '{{ vultr_network_name }}' - state: absent diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_os_info/aliases b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_os_info/aliases deleted file mode 100644 index bf469bb90..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_os_info/aliases +++ /dev/null @@ -1 +0,0 @@ -cloud/vultr diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_os_info/tasks/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_os_info/tasks/main.yml deleted file mode 100644 index a48133e4c..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_os_info/tasks/main.yml +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (c) 2018, Yanis Guenane <yanis+ansible@guenane.org> -# Copyright (c) 2019, René Moser <mail@renemoser.net> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -- name: test get vultr os infos in check mode - vultr_os_info: - check_mode: yes - register: result - -- name: verify test get vultr os infos in check mode - assert: - that: - - result.vultr_os_info|selectattr('name','equalto', 'CentOS 7 x64') | list | count == 1 - -- name: test get vultr os fact - vultr_os_info: - register: result - -- name: verify test get vultr os infos - assert: - that: - - result.vultr_os_info|selectattr('name','equalto', 'CentOS 7 x64') | list | count == 1 diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_plan_baremetal_info/aliases b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_plan_baremetal_info/aliases deleted file mode 100644 index bf469bb90..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_plan_baremetal_info/aliases +++ /dev/null @@ -1 +0,0 @@ -cloud/vultr diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_plan_baremetal_info/tasks/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_plan_baremetal_info/tasks/main.yml deleted file mode 100644 index 372123bbf..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_plan_baremetal_info/tasks/main.yml +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (c) 2018, Yanis Guenane <yanis+ansible@guenane.org> -# Copyright (c) 2020, Simon Bärlocher <s.baerlocher@sbaerlocher.ch> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -- name: test gather vultr plan baremetal info in check mode - vultr_plan_baremetal_info: - check_mode: yes - register: result - -- name: verify test gather vultr plan baremetal info in check mode - assert: - that: - - result.vultr_plan_baremetal_info|selectattr('name','equalto','65536 MB RAM,2x 240 GB SSD,5.00 TB BW') | list | count == 1 - -- name: test gather vultr plan baremetal info - vultr_plan_baremetal_info: - register: result - -- name: verify test gather vultr plan baremetal info - assert: - that: - - result.vultr_plan_baremetal_info|selectattr('name','equalto','65536 MB RAM,2x 240 GB SSD,5.00 TB BW') | list | count == 1 diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_plan_info/aliases b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_plan_info/aliases deleted file mode 100644 index bf469bb90..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_plan_info/aliases +++ /dev/null @@ -1 +0,0 @@ -cloud/vultr diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_plan_info/tasks/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_plan_info/tasks/main.yml deleted file mode 100644 index 6b3790325..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_plan_info/tasks/main.yml +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright (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) ---- -- name: test gather vultr plan info in check mode - vultr_plan_info: - check_mode: yes - register: result - -- name: verify test gather vultr plan info in check mode - assert: - that: - - result.vultr_plan_info|selectattr('name','equalto','16384 MB RAM,2x110 GB SSD,20.00 TB BW') | list | count == 1 - -- name: test gather vultr plan info - vultr_plan_info: - register: result - -- name: verify test gather vultr plan info - assert: - that: - - result.vultr_plan_info|selectattr('name','equalto','16384 MB RAM,2x110 GB SSD,20.00 TB BW') | list | count == 1 diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_region_info/aliases b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_region_info/aliases deleted file mode 100644 index bf469bb90..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_region_info/aliases +++ /dev/null @@ -1 +0,0 @@ -cloud/vultr diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_region_info/tasks/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_region_info/tasks/main.yml deleted file mode 100644 index adf8a8a46..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_region_info/tasks/main.yml +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright (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) ---- -- name: test gather vultr region info in check mode - vultr_region_info: - check_mode: yes - register: result - -- name: verify test gather vultr region info in check mode - assert: - that: - - result.vultr_region_info|selectattr('name','equalto','Atlanta') | list | count == 1 - -- name: test gather vultr region info - vultr_region_info: - register: result - -- name: verify test gather vultr region info - assert: - that: - - result.vultr_region_info|selectattr('name','equalto','Atlanta') | list | count == 1 diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_server/aliases b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_server/aliases deleted file mode 100644 index bf469bb90..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_server/aliases +++ /dev/null @@ -1 +0,0 @@ -cloud/vultr diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_server/defaults/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_server/defaults/main.yml deleted file mode 100644 index 2b6852956..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_server/defaults/main.yml +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright (c) 2018, René Moser <mail@renemoser.net> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -vultr_resource_prefix: "vultr-test-prefix" -vultr_server_name: "{{ vultr_resource_prefix }}_vm" -vultr_server_ssh_keys: -- name: key1 - key: "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAgEAyWYItY+3w5b8PdGRoz0oY5mufqydW96naE+VM3JSvJFAUS08rAjQQpQ03ymoALeHQy6JVZbcgecxn6p0pAOINQdqufn4udPtOPCtMjNiPGpkSM9ah/6X5+kvyWMNrvlf+Ld4OOoszP5sAkgQzIbrFQAm41XknBUha0zkewZwfrVhain4pnDjV7wCcChId/Q/Gbi4xMtXkisznWcAJcueBs3EEZDKhJ5q0VeWSJEhYJDLFN1sOxF0AIUnMrOhfKQ/LjgREXPB6uCl899INUTXRNNjRpeMXyJ2wMMmOAbua2qEd1r13Bu1n+6A823Hzb33fyMXuqWnJwBJ4DCvMlGuEsfuOK+xk7DaBfLHbcM6fsPk0/4psTE6YLgC41remr6+u5ZWsY/faMtSnNPie8Z8Ov0DIYGdhbJjUXk1HomxRV9+ZfZ2Ob8iCwlaAQAyEUM6fs3Kxt8pBD8dx1HOkhsfBWPvuDr5y+kqE7H8/MuPDTc0QgH2pjUMpmw/XBwNDHshVEjrZvtICOjOLUJxcowLO1ivNYwPwowQxfisMy56LfYdjsOslBiqsrkAqvNGm1zu8wKHeqVN9w5l3yUELpvubfm9NKIvYcl6yWF36T0c5vE+g0DU/Jy4XpTj0hZG9QV2mRQcLJnd2pxQtJT7cPFtrn/+tgRxzjEtbDXummDV4sE= mail@renemoser.net" -- name: key2 - key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCoQ9S7V+CufAgwoehnf2TqsJ9LTsu8pUA3FgpS2mdVwcMcTs++8P5sQcXHLtDmNLpWN4k7NQgxaY1oXy5e25x/4VhXaJXWEt3luSw+Phv/PB2+aGLvqCUirsLTAD2r7ieMhd/pcVf/HlhNUQgnO1mupdbDyqZoGD/uCcJiYav8i/V7nJWJouHA8yq31XS2yqXp9m3VC7UZZHzUsVJA9Us5YqF0hKYeaGruIHR2bwoDF9ZFMss5t6/pzxMljU/ccYwvvRDdI7WX4o4+zLuZ6RWvsU6LGbbb0pQdB72tlV41fSefwFsk4JRdKbyV3Xjf25pV4IXOTcqhy+4JTB/jXxrF torwalds@github.com" - -vultr_server_plan_1: 1024 MB RAM,25 GB SSD,1.00 TB BW -vultr_server_plan_2: 2048 MB RAM,55 GB SSD,2.00 TB BW diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_server/tasks/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_server/tasks/main.yml deleted file mode 100644 index ac6a6f3f4..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_server/tasks/main.yml +++ /dev/null @@ -1,551 +0,0 @@ -# Copyright (c) 2018, René Moser <mail@renemoser.net> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -- name: setup - vultr_server: - name: "{{ vultr_server_name }}" - state: absent - register: result -- name: verify setup - assert: - that: - - result is success - -# Servers can only be destroyed 5 min after creation -- name: wait for 5 min - wait_for: - when: result is changed - -- name: test fail if missing name - vultr_server: - register: result - ignore_errors: yes -- name: verify test fail if missing name - assert: - that: - - result is failed - - 'result.msg == "missing required arguments: name"' - -- name: test fail if missing params for state=present - vultr_server: - name: "{{ vultr_server_name }}" - register: result - ignore_errors: yes -- name: verify fail if missing params for state=present - assert: - that: - - result is failed - - 'result.msg == "missing required arguments: os, plan, region"' - -- name: test fail if plan does not exist - vultr_server: - name: "{{ vultr_server_name }}" - os: CentOS 6 x64 - plan: does_not_exist - region: Amsterdam - register: result - ignore_errors: yes -- name: verify test fail if plan does not exist - assert: - that: - - result is failed - - 'result.msg == "Could not find plans with ID or name: does_not_exist"' - -- name: setup create ssh keys - vultr_ssh_key: - name: "{{ item.name }}" - ssh_key: "{{ item.key }}" - loop: "{{ vultr_server_ssh_keys }}" - -- name: test create server in check mode - vultr_server: - name: "{{ vultr_server_name }}" - os: CentOS 6 x64 - plan: "{{ vultr_server_plan_1 }}" - ssh_keys: - - key1 - - key2 - region: Amsterdam - state: started - register: result - check_mode: yes -- name: verify test create server in check mode - assert: - that: - - result is changed - -- name: test create server - vultr_server: - name: "{{ vultr_server_name }}" - os: CentOS 6 x64 - plan: "{{ vultr_server_plan_1 }}" - ssh_keys: - - key1 - - key2 - region: Amsterdam - state: started - register: result -- name: verify test create server - assert: - that: - - result is changed - - result.vultr_server.name == vultr_server_name - - result.vultr_server.os == 'CentOS 6 x64' - - result.vultr_server.plan == vultr_server_plan_1 - - result.vultr_server.region == 'Amsterdam' - - result.vultr_server.power_status == 'running' - -- name: test create server idempotence - vultr_server: - name: "{{ vultr_server_name }}" - os: CentOS 6 x64 - plan: "{{ vultr_server_plan_1 }}" - ssh_keys: - - key1 - - key2 - region: Amsterdam - state: started - register: result -- name: verify test create server idempotence - assert: - that: - - result is not changed - - result.vultr_server.power_status == 'running' - - result.vultr_server.name == vultr_server_name - - result.vultr_server.os == 'CentOS 6 x64' - - result.vultr_server.plan == vultr_server_plan_1 - - result.vultr_server.region == 'Amsterdam' - -- name: test stop an existing server in check mode - vultr_server: - name: "{{ vultr_server_name }}" - state: stopped - register: result - check_mode: yes -- name: verify test stop server in check mode - assert: - that: - - result is changed - - result.vultr_server.power_status == 'running' - - result.vultr_server.name == vultr_server_name - - result.vultr_server.os == 'CentOS 6 x64' - - result.vultr_server.region == 'Amsterdam' - -- name: test stop an existing server - vultr_server: - name: "{{ vultr_server_name }}" - state: stopped - register: result -- name: verify test stop an existing server - assert: - that: - - result is changed - - result.vultr_server.power_status == 'stopped' - - result.vultr_server.name == vultr_server_name - - result.vultr_server.os == 'CentOS 6 x64' - - result.vultr_server.region == 'Amsterdam' - -- name: test stop an existing server idempotence - vultr_server: - name: "{{ vultr_server_name }}" - state: stopped - register: result -- name: verify test stop an existing server idempotence - assert: - that: - - result is not changed - - result.vultr_server.power_status == 'stopped' - - result.vultr_server.name == vultr_server_name - - result.vultr_server.os == 'CentOS 6 x64' - - result.vultr_server.region == 'Amsterdam' - -- name: test start an existing server in check mode - vultr_server: - name: "{{ vultr_server_name }}" - state: started - register: result - check_mode: yes -- name: verify test start an existing server in check mode - assert: - that: - - result is changed - - result.vultr_server.power_status == 'stopped' - - result.vultr_server.name == vultr_server_name - - result.vultr_server.os == 'CentOS 6 x64' - - result.vultr_server.region == 'Amsterdam' - -- name: test start an existing server - vultr_server: - name: "{{ vultr_server_name }}" - state: started - register: result -- name: verify test start an existing server - assert: - that: - - result is changed - - result.vultr_server.power_status == 'running' - - result.vultr_server.name == vultr_server_name - - result.vultr_server.os == 'CentOS 6 x64' - - result.vultr_server.region == 'Amsterdam' - -- name: test start an existing server idempotence - vultr_server: - name: "{{ vultr_server_name }}" - state: started - register: result -- name: verify test start an existing server idempotence - assert: - that: - - result is not changed - - result.vultr_server.power_status == 'running' - - result.vultr_server.name == vultr_server_name - - result.vultr_server.os == 'CentOS 6 x64' - - result.vultr_server.region == 'Amsterdam' - -- name: test update plan for server in check mode without force - vultr_server: - name: "{{ vultr_server_name }}" - os: CentOS 6 x64 - plan: "{{ vultr_server_plan_2 }}" - region: Amsterdam - register: result - check_mode: yes -- name: verify test update plan for server in check mode without force - assert: - that: - - result is not changed - - result.vultr_server.power_status == 'running' - - result.vultr_server.name == vultr_server_name - - result.vultr_server.os == 'CentOS 6 x64' - - result.vultr_server.plan == vultr_server_plan_1 - - result.vultr_server.region == 'Amsterdam' - -- name: test update plan for server without force - vultr_server: - name: "{{ vultr_server_name }}" - os: CentOS 6 x64 - plan: "{{ vultr_server_plan_2 }}" - region: Amsterdam - register: result -- name: verify test update plan for server without force - assert: - that: - - result is not changed - - result.vultr_server.power_status == 'running' - - result.vultr_server.name == vultr_server_name - - result.vultr_server.os == 'CentOS 6 x64' - - result.vultr_server.plan == vultr_server_plan_1 - - result.vultr_server.region == 'Amsterdam' - -- name: setup firewall group - vultr_firewall_group: - name: test_firewall_group - register: result -- name: verify test create firewall group - assert: - that: - - result is success - -- name: test fail with unknown firewall group - vultr_server: - name: "{{ vultr_server_name }}" - os: CentOS 6 x64 - region: Amsterdam - firewall_group: does not exist - tag: test_tag - register: result - ignore_errors: yes - check_mode: yes -- name: verify test fail with unknown firewall group - assert: - that: - - result is failed - - result.msg.startswith('Could not find') - -- name: test update tag, firewall group for server in check mode without force - vultr_server: - name: "{{ vultr_server_name }}" - os: CentOS 6 x64 - region: Amsterdam - firewall_group: test_firewall_group - tag: test_tag - register: result - check_mode: yes -- name: verify test update tag, firewall group for server in check mode without force - assert: - that: - - result is changed - - result.vultr_server.power_status == 'running' - - result.vultr_server.name == vultr_server_name - - result.vultr_server.os == 'CentOS 6 x64' - - result.vultr_server.plan == vultr_server_plan_1 - - result.vultr_server.region == 'Amsterdam' - - result.vultr_server.tag == '' - - result.vultr_server.firewall_group != 'test_firewall_group' - -- name: test update tag, firewall group for server without force - vultr_server: - name: "{{ vultr_server_name }}" - os: CentOS 6 x64 - region: Amsterdam - firewall_group: test_firewall_group - tag: test_tag - register: result -- name: verify test update tag, firewall group for server without force - assert: - that: - - result is changed - - result.vultr_server.power_status == 'running' - - result.vultr_server.name == vultr_server_name - - result.vultr_server.os == 'CentOS 6 x64' - - result.vultr_server.region == 'Amsterdam' - - result.vultr_server.tag == 'test_tag' - - result.vultr_server.firewall_group == 'test_firewall_group' - -- name: test update tag, firewall group for server without force idempotence - vultr_server: - name: "{{ vultr_server_name }}" - os: CentOS 6 x64 - region: Amsterdam - firewall_group: test_firewall_group - tag: test_tag - register: result -- name: verify test update tag, firewall group for server without force idempotence - assert: - that: - - result is not changed - - result.vultr_server.power_status == 'running' - - result.vultr_server.name == vultr_server_name - - result.vultr_server.os == 'CentOS 6 x64' - - result.vultr_server.region == 'Amsterdam' - - result.vultr_server.tag == 'test_tag' - - result.vultr_server.firewall_group == 'test_firewall_group' - -- name: test update server in check mode with force - vultr_server: - name: "{{ vultr_server_name }}" - os: CentOS 6 x64 - plan: "{{ vultr_server_plan_2 }}" - auto_backup_enabled: yes - private_network_enabled: yes - region: Amsterdam - force: yes - register: result - check_mode: yes -- name: verify test update server in check mode with force - assert: - that: - - result is changed - - result.vultr_server.power_status == 'running' - - result.vultr_server.name == vultr_server_name - - result.vultr_server.os == 'CentOS 6 x64' - - result.vultr_server.plan == vultr_server_plan_1 - - result.vultr_server.region == 'Amsterdam' - - result.vultr_server.auto_backup_enabled == false - - result.vultr_server.internal_ip == '' - -- name: test update server with force - vultr_server: - name: "{{ vultr_server_name }}" - os: CentOS 6 x64 - plan: "{{ vultr_server_plan_2 }}" - auto_backup_enabled: yes - private_network_enabled: yes - region: Amsterdam - force: yes - register: result -- name: verify test update server with force - assert: - that: - - result is changed - - result.vultr_server.power_status == 'running' - - result.vultr_server.name == vultr_server_name - - result.vultr_server.os == 'CentOS 6 x64' - - result.vultr_server.plan == vultr_server_plan_2 - - result.vultr_server.region == 'Amsterdam' - - result.vultr_server.auto_backup_enabled == true - - result.vultr_server.internal_ip != '' - -- name: test update server idempotence with force - vultr_server: - name: "{{ vultr_server_name }}" - os: CentOS 6 x64 - plan: "{{ vultr_server_plan_2 }}" - auto_backup_enabled: yes - private_network_enabled: yes - region: Amsterdam - force: yes - register: result -- name: verify test update server idempotence with force - assert: - that: - - result is not changed - - result.vultr_server.power_status == 'running' - - result.vultr_server.name == vultr_server_name - - result.vultr_server.os == 'CentOS 6 x64' - - result.vultr_server.plan == vultr_server_plan_2 - - result.vultr_server.region == 'Amsterdam' - - result.vultr_server.auto_backup_enabled == true - - result.vultr_server.internal_ip != '' - -- name: test update server with IDs idempotence with force - vultr_server: - name: "{{ vultr_server_name }}" - os: "127" - plan: "202" - auto_backup_enabled: yes - private_network_enabled: yes - region: "7" - force: yes - register: result -- name: verify test update server idempotence with force - assert: - that: - - result is not changed - - result.vultr_server.power_status == 'running' - - result.vultr_server.name == vultr_server_name - - result.vultr_server.os == 'CentOS 6 x64' - - result.vultr_server.plan == vultr_server_plan_2 - - result.vultr_server.region == 'Amsterdam' - - result.vultr_server.auto_backup_enabled == true - - result.vultr_server.internal_ip != '' - -- name: test update server to stopped in check mode - vultr_server: - name: "{{ vultr_server_name }}" - os: CentOS 6 x64 - plan: "{{ vultr_server_plan_2 }}" - ipv6_enabled: yes - region: Amsterdam - state: stopped - register: result - check_mode: yes -- name: verify test update server to stopped in check mode - assert: - that: - - result is changed - - result.vultr_server.power_status == 'running' - - result.vultr_server.name == vultr_server_name - - result.vultr_server.os == 'CentOS 6 x64' - - result.vultr_server.plan == vultr_server_plan_2 - - result.vultr_server.region == 'Amsterdam' - - result.vultr_server.v6_main_ip == '' - -- name: test update server to stopped - vultr_server: - name: "{{ vultr_server_name }}" - os: CentOS 6 x64 - plan: "{{ vultr_server_plan_2 }}" - ipv6_enabled: yes - region: Amsterdam - state: stopped - register: result -- name: verify test update server to stopped - assert: - that: - - result is changed - - result.vultr_server.power_status == 'stopped' - - result.vultr_server.name == vultr_server_name - - result.vultr_server.os == 'CentOS 6 x64' - - result.vultr_server.plan == vultr_server_plan_2 - - result.vultr_server.region == 'Amsterdam' - - result.vultr_server.v6_main_ip != '' - -- name: test update server to stopped idempotence - vultr_server: - name: "{{ vultr_server_name }}" - os: CentOS 6 x64 - plan: "{{ vultr_server_plan_2 }}" - ipv6_enabled: yes - region: Amsterdam - state: stopped - register: result -- name: verify test update server to stopped idempotence - assert: - that: - - result is not changed - - result.vultr_server.power_status == 'stopped' - - result.vultr_server.name == vultr_server_name - - result.vultr_server.os == 'CentOS 6 x64' - - result.vultr_server.plan == vultr_server_plan_2 - - result.vultr_server.region == 'Amsterdam' - - result.vultr_server.v6_main_ip != '' - -- name: test restart an existing server in check mode - vultr_server: - name: "{{ vultr_server_name }}" - state: restarted - register: result - check_mode: yes -- name: verify test restart an existing server in check mode - assert: - that: - - result is changed - - result.vultr_server.power_status == 'stopped' - - result.vultr_server.name == vultr_server_name - - result.vultr_server.os == 'CentOS 6 x64' - - result.vultr_server.region == 'Amsterdam' - -- name: test restart an existing server - vultr_server: - name: "{{ vultr_server_name }}" - state: restarted - register: result -- name: verify test restart an existing server - assert: - that: - - result is changed - - result.vultr_server.power_status == 'running' - - result.vultr_server.name == vultr_server_name - - result.vultr_server.os == 'CentOS 6 x64' - - result.vultr_server.region == 'Amsterdam' - -- name: test absent server in check mode - vultr_server: - name: "{{ vultr_server_name }}" - state: absent - register: result - check_mode: yes -- name: verify test absent server in check mode - assert: - that: - - result is changed - - result.vultr_server.power_status == 'running' - - result.vultr_server.name == vultr_server_name - - result.vultr_server.os == 'CentOS 6 x64' - - result.vultr_server.region == 'Amsterdam' - -# Servers can only be destroyed 5 min after creation -- name: wait for 5 min - wait_for: - -- name: test absent server - vultr_server: - name: "{{ vultr_server_name }}" - state: absent - register: result -- name: verify test absent server - assert: - that: - - result is changed - - result.vultr_server.power_status == 'running' - - result.vultr_server.name == vultr_server_name - - result.vultr_server.os == 'CentOS 6 x64' - - result.vultr_server.region == 'Amsterdam' - -- name: test absent server idempotence - vultr_server: - name: "{{ vultr_server_name }}" - state: absent - register: result -- name: verify test absent server idempotence - assert: - that: - - result is not changed - -- name: cleanup ssh keys - vultr_ssh_key: - name: "{{ item.name }}" - ssh_key: "{{ item.key }}" - state: absent - loop: "{{ vultr_server_ssh_keys }}" diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_server_baremetal/aliases b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_server_baremetal/aliases deleted file mode 100644 index bf469bb90..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_server_baremetal/aliases +++ /dev/null @@ -1 +0,0 @@ -cloud/vultr diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_server_baremetal/defaults/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_server_baremetal/defaults/main.yml deleted file mode 100644 index 0be096a51..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_server_baremetal/defaults/main.yml +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright (c) 2018, René Moser <mail@renemoser.net> -# Copyright (c) 2020, Simon Bärlocher <s.baerlocher@sbaerlocher.ch> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -vultr_resource_prefix: 'vultr-test-prefix' -vultr_server_baremetal_name: '{{ vultr_resource_prefix }}_baremetal' -vultr_server_baremetal_ssh_keys: - - name: key1 - key: 'ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAgEAyWYItY+3w5b8PdGRoz0oY5mufqydW96naE+VM3JSvJFAUS08rAjQQpQ03ymoALeHQy6JVZbcgecxn6p0pAOINQdqufn4udPtOPCtMjNiPGpkSM9ah/6X5+kvyWMNrvlf+Ld4OOoszP5sAkgQzIbrFQAm41XknBUha0zkewZwfrVhain4pnDjV7wCcChId/Q/Gbi4xMtXkisznWcAJcueBs3EEZDKhJ5q0VeWSJEhYJDLFN1sOxF0AIUnMrOhfKQ/LjgREXPB6uCl899INUTXRNNjRpeMXyJ2wMMmOAbua2qEd1r13Bu1n+6A823Hzb33fyMXuqWnJwBJ4DCvMlGuEsfuOK+xk7DaBfLHbcM6fsPk0/4psTE6YLgC41remr6+u5ZWsY/faMtSnNPie8Z8Ov0DIYGdhbJjUXk1HomxRV9+ZfZ2Ob8iCwlaAQAyEUM6fs3Kxt8pBD8dx1HOkhsfBWPvuDr5y+kqE7H8/MuPDTc0QgH2pjUMpmw/XBwNDHshVEjrZvtICOjOLUJxcowLO1ivNYwPwowQxfisMy56LfYdjsOslBiqsrkAqvNGm1zu8wKHeqVN9w5l3yUELpvubfm9NKIvYcl6yWF36T0c5vE+g0DU/Jy4XpTj0hZG9QV2mRQcLJnd2pxQtJT7cPFtrn/+tgRxzjEtbDXummDV4sE= mail@renemoser.net' - - name: key2 - key: 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCoQ9S7V+CufAgwoehnf2TqsJ9LTsu8pUA3FgpS2mdVwcMcTs++8P5sQcXHLtDmNLpWN4k7NQgxaY1oXy5e25x/4VhXaJXWEt3luSw+Phv/PB2+aGLvqCUirsLTAD2r7ieMhd/pcVf/HlhNUQgnO1mupdbDyqZoGD/uCcJiYav8i/V7nJWJouHA8yq31XS2yqXp9m3VC7UZZHzUsVJA9Us5YqF0hKYeaGruIHR2bwoDF9ZFMss5t6/pzxMljU/ccYwvvRDdI7WX4o4+zLuZ6RWvsU6LGbbb0pQdB72tlV41fSefwFsk4JRdKbyV3Xjf25pV4IXOTcqhy+4JTB/jXxrF torwalds@github.com' - -vultr_server_baremetal_plan_1: 65536 MB RAM,2x 240 GB SSD,5.00 TB BW diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_server_baremetal/tasks/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_server_baremetal/tasks/main.yml deleted file mode 100644 index f4dd752fe..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_server_baremetal/tasks/main.yml +++ /dev/null @@ -1,366 +0,0 @@ -# Copyright (c) 2018, René Moser <mail@renemoser.net> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -- name: setup - vultr_server_baremetal: - name: '{{ vultr_server_baremetal_name }}' - state: absent - register: result -- name: verify setup - assert: - that: - - result is success - -# Servers can only be destroyed 5 min after creation -- name: wait for 5 min - wait_for: - when: result is changed - -- name: test fail if missing name - vultr_server_baremetal: - register: result - ignore_errors: yes -- name: verify test fail if missing name - assert: - that: - - result is failed - - 'result.msg == "missing required arguments: name"' - -- name: test fail if missing params for state=present - vultr_server_baremetal: - name: '{{ vultr_server_baremetal_name }}' - register: result - ignore_errors: yes -- name: verify fail if missing params for state=present - assert: - that: - - result is failed - - 'result.msg == "missing required arguments: os, plan, region"' - -- name: test fail if plan does not exist - vultr_server_baremetal: - name: '{{ vultr_server_baremetal_name }}' - os: CentOS 6 x64 - plan: does_not_exist - region: Amsterdam - register: result - ignore_errors: yes -- name: verify test fail if plan does not exist - assert: - that: - - result is failed - - 'result.msg == "Could not find plans with ID or name: does_not_exist"' - -- name: setup create ssh keys - vultr_ssh_key: - name: '{{ item.name }}' - ssh_key: '{{ item.key }}' - loop: '{{ vultr_server_baremetal_ssh_keys }}' - -- name: test create server in check mode - vultr_server_baremetal: - name: '{{ vultr_server_baremetal_name }}' - os: CentOS 6 x64 - plan: '{{ vultr_server_baremetal_plan_1 }}' - ssh_keys: - - key1 - - key2 - region: Amsterdam - state: started - register: result - check_mode: yes -- name: verify test create server in check mode - assert: - that: - - result is changed - -- name: test create server - vultr_server_baremetal: - name: '{{ vultr_server_baremetal_name }}' - os: CentOS 6 x64 - plan: '{{ vultr_server_baremetal_plan_1 }}' - ssh_keys: - - key1 - - key2 - region: Amsterdam - state: started - register: result -- name: verify test create server - assert: - that: - - result is changed - - result.vultr_server_baremetal.name == vultr_server_baremetal_name - - result.vultr_server_baremetal.os == 'CentOS 6 x64' - - result.vultr_server_baremetal.plan == vultr_server_baremetal_plan_1 - - result.vultr_server_baremetal.region == 'Amsterdam' - - result.vultr_server_baremetal.power_status == 'running' - -- name: test create server idempotence - vultr_server_baremetal: - name: '{{ vultr_server_baremetal_name }}' - os: CentOS 6 x64 - plan: '{{ vultr_server_baremetal_plan_1 }}' - ssh_keys: - - key1 - - key2 - region: Amsterdam - state: started - register: result -- name: verify test create server idempotence - assert: - that: - - result is not changed - - result.vultr_server_baremetal.power_status == 'running' - - result.vultr_server_baremetal.name == vultr_server_baremetal_name - - result.vultr_server_baremetal.os == 'CentOS 6 x64' - - result.vultr_server_baremetal.plan == vultr_server_baremetal_plan_1 - - result.vultr_server_baremetal.region == 'Amsterdam' - -- name: test stop an existing server in check mode - vultr_server_baremetal: - name: '{{ vultr_server_baremetal_name }}' - state: stopped - register: result - check_mode: yes -- name: verify test stop server in check mode - assert: - that: - - result is changed - - result.vultr_server_baremetal.power_status == 'running' - - result.vultr_server_baremetal.name == vultr_server_baremetal_name - - result.vultr_server_baremetal.os == 'CentOS 6 x64' - - result.vultr_server_baremetal.region == 'Amsterdam' - -- name: test stop an existing server - vultr_server_baremetal: - name: '{{ vultr_server_baremetal_name }}' - state: stopped - register: result -- name: verify test stop an existing server - assert: - that: - - result is changed - - result.vultr_server_baremetal.power_status == 'stopped' - - result.vultr_server_baremetal.name == vultr_server_baremetal_name - - result.vultr_server_baremetal.os == 'CentOS 6 x64' - - result.vultr_server_baremetal.region == 'Amsterdam' - -- name: test stop an existing server idempotence - vultr_server_baremetal: - name: '{{ vultr_server_baremetal_name }}' - state: stopped - register: result -- name: verify test stop an existing server idempotence - assert: - that: - - result is not changed - - result.vultr_server_baremetal.power_status == 'stopped' - - result.vultr_server_baremetal.name == vultr_server_baremetal_name - - result.vultr_server_baremetal.os == 'CentOS 6 x64' - - result.vultr_server_baremetal.region == 'Amsterdam' - -- name: test start an existing server in check mode - vultr_server_baremetal: - name: '{{ vultr_server_baremetal_name }}' - state: started - register: result - check_mode: yes -- name: verify test start an existing server in check mode - assert: - that: - - result is changed - - result.vultr_server_baremetal.power_status == 'stopped' - - result.vultr_server_baremetal.name == vultr_server_baremetal_name - - result.vultr_server_baremetal.os == 'CentOS 6 x64' - - result.vultr_server_baremetal.region == 'Amsterdam' - -- name: test start an existing server - vultr_server_baremetal: - name: '{{ vultr_server_baremetal_name }}' - state: started - register: result -- name: verify test start an existing server - assert: - that: - - result is changed - - result.vultr_server_baremetal.power_status == 'running' - - result.vultr_server_baremetal.name == vultr_server_baremetal_name - - result.vultr_server_baremetal.os == 'CentOS 6 x64' - - result.vultr_server_baremetal.region == 'Amsterdam' - -- name: test start an existing server idempotence - vultr_server_baremetal: - name: '{{ vultr_server_baremetal_name }}' - state: started - register: result -- name: verify test start an existing server idempotence - assert: - that: - - result is not changed - - result.vultr_server_baremetal.power_status == 'running' - - result.vultr_server_baremetal.name == vultr_server_baremetal_name - - result.vultr_server_baremetal.os == 'CentOS 6 x64' - - result.vultr_server_baremetal.region == 'Amsterdam' - -- name: setup firewall group - vultr_firewall_group: - name: test_firewall_group - register: result -- name: verify test create firewall group - assert: - that: - - result is success - -- name: test fail with unknown firewall group - vultr_server_baremetal: - name: '{{ vultr_server_baremetal_name }}' - os: CentOS 6 x64 - region: Amsterdam - firewall_group: does not exist - tag: test_tag - register: result - ignore_errors: yes - check_mode: yes -- name: verify test fail with unknown firewall group - assert: - that: - - result is failed - - result.msg.startswith('Could not find') - -- name: test update tag, firewall group for server in check mode without force - vultr_server_baremetal: - name: '{{ vultr_server_baremetal_name }}' - os: CentOS 6 x64 - region: Amsterdam - firewall_group: test_firewall_group - tag: test_tag - register: result - check_mode: yes -- name: verify test update tag, firewall group for server in check mode without force - assert: - that: - - result is changed - - result.vultr_server_baremetal.power_status == 'running' - - result.vultr_server_baremetal.name == vultr_server_baremetal_name - - result.vultr_server_baremetal.os == 'CentOS 6 x64' - - result.vultr_server_baremetal.plan == vultr_server_baremetal_plan_1 - - result.vultr_server_baremetal.region == 'Amsterdam' - - result.vultr_server_baremetal.tag == '' - - result.vultr_server_baremetal.firewall_group != 'test_firewall_group' - -- name: test update tag, firewall group for server without force - vultr_server_baremetal: - name: '{{ vultr_server_baremetal_name }}' - os: CentOS 6 x64 - region: Amsterdam - firewall_group: test_firewall_group - tag: test_tag - register: result -- name: verify test update tag, firewall group for server without force - assert: - that: - - result is changed - - result.vultr_server_baremetal.power_status == 'running' - - result.vultr_server_baremetal.name == vultr_server_baremetal_name - - result.vultr_server_baremetal.os == 'CentOS 6 x64' - - result.vultr_server_baremetal.region == 'Amsterdam' - - result.vultr_server_baremetal.tag == 'test_tag' - - result.vultr_server_baremetal.firewall_group == 'test_firewall_group' - -- name: test update tag, firewall group for server without force idempotence - vultr_server_baremetal: - name: '{{ vultr_server_baremetal_name }}' - os: CentOS 6 x64 - region: Amsterdam - firewall_group: test_firewall_group - tag: test_tag - register: result -- name: verify test update tag, firewall group for server without force idempotence - assert: - that: - - result is not changed - - result.vultr_server_baremetal.power_status == 'running' - - result.vultr_server_baremetal.name == vultr_server_baremetal_name - - result.vultr_server_baremetal.os == 'CentOS 6 x64' - - result.vultr_server_baremetal.region == 'Amsterdam' - - result.vultr_server_baremetal.tag == 'test_tag' - - result.vultr_server_baremetal.firewall_group == 'test_firewall_group' - -- name: test restart an existing server in check mode - vultr_server_baremetal: - name: '{{ vultr_server_baremetal_name }}' - state: restarted - register: result - check_mode: yes -- name: verify test restart an existing server in check mode - assert: - that: - - result is changed - - result.vultr_server_baremetal.power_status == 'stopped' - - result.vultr_server_baremetal.name == vultr_server_baremetal_name - - result.vultr_server_baremetal.os == 'CentOS 6 x64' - - result.vultr_server_baremetal.region == 'Amsterdam' - -- name: test restart an existing server - vultr_server_baremetal: - name: '{{ vultr_server_baremetal_name }}' - state: restarted - register: result -- name: verify test restart an existing server - assert: - that: - - result is changed - - result.vultr_server_baremetal.power_status == 'running' - - result.vultr_server_baremetal.name == vultr_server_baremetal_name - - result.vultr_server_baremetal.os == 'CentOS 6 x64' - - result.vultr_server_baremetal.region == 'Amsterdam' - -- name: test absent server in check mode - vultr_server_baremetal: - name: '{{ vultr_server_baremetal_name }}' - state: absent - register: result - check_mode: yes -- name: verify test absent server in check mode - assert: - that: - - result is changed - - result.vultr_server_baremetal.power_status == 'running' - - result.vultr_server_baremetal.name == vultr_server_baremetal_name - - result.vultr_server_baremetal.os == 'CentOS 6 x64' - - result.vultr_server_baremetal.region == 'Amsterdam' - -# Servers can only be destroyed 5 min after creation -- name: wait for 5 min - wait_for: - -- name: test absent server - vultr_server_baremetal: - name: '{{ vultr_server_baremetal_name }}' - state: absent - register: result -- name: verify test absent server - assert: - that: - - result is changed - - result.vultr_server_baremetal.power_status == 'running' - - result.vultr_server_baremetal.name == vultr_server_baremetal_name - - result.vultr_server_baremetal.os == 'CentOS 6 x64' - - result.vultr_server_baremetal.region == 'Amsterdam' - -- name: test absent server idempotence - vultr_server_baremetal: - name: '{{ vultr_server_baremetal_name }}' - state: absent - register: result -- name: verify test absent server idempotence - assert: - that: - - result is not changed - -- name: cleanup ssh keys - vultr_ssh_key: - name: '{{ item.name }}' - ssh_key: '{{ item.key }}' - state: absent - loop: '{{ vultr_server_baremetal_ssh_keys }}' diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_server_info/aliases b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_server_info/aliases deleted file mode 100644 index bf469bb90..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_server_info/aliases +++ /dev/null @@ -1 +0,0 @@ -cloud/vultr diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_server_info/defaults/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_server_info/defaults/main.yml deleted file mode 100644 index 37134a1f3..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_server_info/defaults/main.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -vultr_resource_prefix: "vultr-test-prefix" -vultr_server_name: "{{ vultr_resource_prefix }}_vm" -vultr_server_os: CentOS 7 x64 -vultr_server_plan: 1024 MB RAM,25 GB SSD,1.00 TB BW -vultr_server_region: Amsterdam diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_server_info/tasks/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_server_info/tasks/main.yml deleted file mode 100644 index 83deb7691..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_server_info/tasks/main.yml +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright (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) ---- -- name: setup ensure VM is absent - vultr_server: - name: "{{ vultr_server_name }}" - state: absent - register: result - -# Servers can only be destroyed 5 min after creation -- name: wait for 5 min until VM is absent - wait_for: - when: result is changed - -- name: test gather vultr server info - empty resources - vultr_server_info: - register: result -- name: verify test gather vultr server info - empty resources - assert: - that: - - result.vultr_server_info | selectattr('name','equalto',vultr_server_name) | list | count == 0 - -- name: setup firewall group - vultr_firewall_group: - name: test_vultr_server_info - -- name: setup create the server - vultr_server: - name: '{{ vultr_server_name }}' - os: '{{ vultr_server_os }}' - plan: '{{ vultr_server_plan }}' - region: '{{ vultr_server_region }}' - firewall_group: test_vultr_server_info - -- name: test gather vultr server info in check mode - vultr_server_info: - check_mode: yes - register: result - -- name: verify test gather vultr server info in check mode - assert: - that: - - result.vultr_server_info|selectattr('name','equalto',vultr_server_name) | list | count == 1 - -- name: test gather vultr server info - vultr_server_info: - register: result - -- name: verify test gather vultr server info - assert: - that: - - result.vultr_server_info|selectattr('name','equalto',vultr_server_name) | list | count == 1 - -- name: Pause for 5 min before deleting the VM - pause: - minutes: 5 - -- name: cleanup the server - vultr_server: - name: '{{ vultr_server_name }}' - state: absent - -- name: cleanup firewall group - vultr_firewall_group: - name: test_vultr_server_info - state: absent diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_ssh_key/aliases b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_ssh_key/aliases deleted file mode 100644 index bf469bb90..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_ssh_key/aliases +++ /dev/null @@ -1 +0,0 @@ -cloud/vultr diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_ssh_key/defaults/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_ssh_key/defaults/main.yml deleted file mode 100644 index 53cce5676..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_ssh_key/defaults/main.yml +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright (c) 2018, René Moser <mail@renemoser.net> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -vultr_resource_prefix: "vultr-test-prefix" -vultr_ssh_key_name: "{{ vultr_resource_prefix }}_ansible-ssh-key" -vultr_ssh_key: "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAgEAyWYItY+3w5b8PdGRoz0oY5mufqydW96naE+VM3JSvJFAUS08rAjQQpQ03ymoALeHQy6JVZbcgecxn6p0pAOINQdqufn4udPtOPCtMjNiPGpkSM9ah/6X5+kvyWMNrvlf+Ld4OOoszP5sAkgQzIbrFQAm41XknBUha0zkewZwfrVhain4pnDjV7wCcChId/Q/Gbi4xMtXkisznWcAJcueBs3EEZDKhJ5q0VeWSJEhYJDLFN1sOxF0AIUnMrOhfKQ/LjgREXPB6uCl899INUTXRNNjRpeMXyJ2wMMmOAbua2qEd1r13Bu1n+6A823Hzb33fyMXuqWnJwBJ4DCvMlGuEsfuOK+xk7DaBfLHbcM6fsPk0/4psTE6YLgC41remr6+u5ZWsY/faMtSnNPie8Z8Ov0DIYGdhbJjUXk1HomxRV9+ZfZ2Ob8iCwlaAQAyEUM6fs3Kxt8pBD8dx1HOkhsfBWPvuDr5y+kqE7H8/MuPDTc0QgH2pjUMpmw/XBwNDHshVEjrZvtICOjOLUJxcowLO1ivNYwPwowQxfisMy56LfYdjsOslBiqsrkAqvNGm1zu8wKHeqVN9w5l3yUELpvubfm9NKIvYcl6yWF36T0c5vE+g0DU/Jy4XpTj0hZG9QV2mRQcLJnd2pxQtJT7cPFtrn/+tgRxzjEtbDXummDV4sE= ansible@example.com" -vultr_ssh_key2: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCoQ9S7V+CufAgwoehnf2TqsJ9LTsu8pUA3FgpS2mdVwcMcTs++8P5sQcXHLtDmNLpWN4k7NQgxaY1oXy5e25x/4VhXaJXWEt3luSw+Phv/PB2+aGLvqCUirsLTAD2r7ieMhd/pcVf/HlhNUQgnO1mupdbDyqZoGD/uCcJiYav8i/V7nJWJouHA8yq31XS2yqXp9m3VC7UZZHzUsVJA9Us5YqF0hKYeaGruIHR2bwoDF9ZFMss5t6/pzxMljU/ccYwvvRDdI7WX4o4+zLuZ6RWvsU6LGbbb0pQdB72tlV41fSefwFsk4JRdKbyV3Xjf25pV4IXOTcqhy+4JTB/jXxrF torwalds@github.com" diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_ssh_key/tasks/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_ssh_key/tasks/main.yml deleted file mode 100644 index ce46970e0..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_ssh_key/tasks/main.yml +++ /dev/null @@ -1,140 +0,0 @@ -# Copyright (c) 2018, René Moser <mail@renemoser.net> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -- name: setup - vultr_ssh_key: - name: "{{ vultr_ssh_key_name }}" - state: absent - register: result -- name: verify setup - assert: - that: - - result is success - -- name: test fail if missing name - vultr_ssh_key: - register: result - ignore_errors: yes -- name: verify test fail if missing name - assert: - that: - - result is failed - - 'result.msg == "missing required arguments: name"' - -- name: test fail if missing params for state=present - vultr_ssh_key: - name: "{{ vultr_ssh_key_name }}" - register: result - ignore_errors: yes -- name: verify fail if missing params for state=present - assert: - that: - - result is failed - - 'result.msg == "state is present but all of the following are missing: ssh_key"' - -- name: test create ssh key in check mode - vultr_ssh_key: - name: "{{ vultr_ssh_key_name }}" - ssh_key: "{{ vultr_ssh_key }}" - register: result - check_mode: yes -- name: verify test create ssh key in check mode - assert: - that: - - result is changed - -- name: test create ssh key - vultr_ssh_key: - name: "{{ vultr_ssh_key_name }}" - ssh_key: "{{ vultr_ssh_key }}" - register: result -- name: verify test create ssh key - assert: - that: - - result is changed - - result.vultr_ssh_key.name == '{{ vultr_ssh_key_name }}' - - result.vultr_ssh_key.ssh_key == '{{ vultr_ssh_key }}' - -- name: test create ssh key idempotence - vultr_ssh_key: - name: "{{ vultr_ssh_key_name }}" - ssh_key: "{{ vultr_ssh_key }}" - register: result -- name: verify test create ssh key idempotence - assert: - that: - - result is not changed - - result.vultr_ssh_key.name == '{{ vultr_ssh_key_name }}' - - result.vultr_ssh_key.ssh_key == '{{ vultr_ssh_key }}' - -- name: test update ssh key in check mode - vultr_ssh_key: - name: "{{ vultr_ssh_key_name }}" - ssh_key: "{{ vultr_ssh_key2 }}" - register: result - check_mode: yes -- name: verify test update ssh key in check mode - assert: - that: - - result is changed - - result.vultr_ssh_key.name == '{{ vultr_ssh_key_name }}' - - result.vultr_ssh_key.ssh_key == '{{ vultr_ssh_key }}' - -- name: test update ssh key - vultr_ssh_key: - name: "{{ vultr_ssh_key_name }}" - ssh_key: "{{ vultr_ssh_key2 }}" - register: result -- name: verify test update ssh key - assert: - that: - - result is changed - - result.vultr_ssh_key.name == '{{ vultr_ssh_key_name }}' - - result.vultr_ssh_key.ssh_key == '{{ vultr_ssh_key2 }}' - -- name: test update ssh key idempotence - vultr_ssh_key: - name: "{{ vultr_ssh_key_name }}" - ssh_key: "{{ vultr_ssh_key2 }}" - register: result -- name: verify test update ssh key idempotence - assert: - that: - - result is not changed - - result.vultr_ssh_key.name == '{{ vultr_ssh_key_name }}' - - result.vultr_ssh_key.ssh_key == '{{ vultr_ssh_key2 }}' - -- name: test absent ssh key in check mode - vultr_ssh_key: - name: "{{ vultr_ssh_key_name }}" - state: absent - register: result - check_mode: yes -- name: verify test absent ssh key in check mode - assert: - that: - - result is changed - - result.vultr_ssh_key.name == '{{ vultr_ssh_key_name }}' - - result.vultr_ssh_key.ssh_key == '{{ vultr_ssh_key2 }}' - -- name: test absent ssh key - vultr_ssh_key: - name: "{{ vultr_ssh_key_name }}" - state: absent - register: result -- name: verify test absent ssh key - assert: - that: - - result is changed - - result.vultr_ssh_key.name == '{{ vultr_ssh_key_name }}' - - result.vultr_ssh_key.ssh_key == '{{ vultr_ssh_key2 }}' - -- name: test absent ssh key idempotence - vultr_ssh_key: - name: "{{ vultr_ssh_key_name }}" - state: absent - register: result -- name: verify test absent ssh key idempotence - assert: - that: - - result is not changed diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_ssh_key_info/aliases b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_ssh_key_info/aliases deleted file mode 100644 index bf469bb90..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_ssh_key_info/aliases +++ /dev/null @@ -1 +0,0 @@ -cloud/vultr diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_ssh_key_info/defaults/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_ssh_key_info/defaults/main.yml deleted file mode 100644 index 63bda99f2..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_ssh_key_info/defaults/main.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -vultr_resource_prefix: "vultr_test_prefix" -ssh_key_name: "{{ vultr_resource_prefix }}-sshkey" -ssh_key_content: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+ZFQv3MyjtL1BMpSA0o0gIkzLVVC711rthT29hBNeORdNowQ7FSvVWUdAbTq00U7Xzak1ANIYLJyn+0r7olsdG4XEiUR0dqgC99kbT/QhY5mLe5lpl7JUjW9ctn00hNmt+TswpatCKWPNwdeAJT2ERynZaqPobENgvIq7jfOFWQIVew7qrewtqwerqwrewUr2Cdq7Nb7U0XFXh3x1p0v0+MbL4tiJwPlMAGvFTKIMt+EaA+AsRIxiOo9CMk5ZuOl9pT8h5vNuEOcvS0qx4v44EAD2VOsCVCcrPNMcpuSzZP8dRTGU9wRREAWXngD0Zq9YJMH38VTxHiskoBw1NnPz ansibletest-{{ vultr_resource_prefix }}@sshkey diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_ssh_key_info/tasks/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_ssh_key_info/tasks/main.yml deleted file mode 100644 index 6a44144b1..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_ssh_key_info/tasks/main.yml +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright (c) 2018, Yanis Guenane <yanis+ansible@guenane.org> -# Copyright (c) 2019, René Moser <mail@renemoser.net> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -- name: test get vultr ssh key info - empty resources - vultr_ssh_key_info: - register: result - -- name: verify test get vultr ssh key infos in check mode - assert: - that: - - result.vultr_ssh_key_info|selectattr('name','equalto','{{ ssh_key_name }}') | list | count == 0 - - result.vultr_ssh_key_info|selectattr('ssh_key','equalto','{{ ssh_key_content }}') | list | count == 0 - -- name: Upload an ssh key - vultr_ssh_key: - name: '{{ ssh_key_name }}' - ssh_key: '{{ ssh_key_content }}' - -- name: test get vultr ssh key infos in check mode - vultr_ssh_key_info: - check_mode: yes - register: result - -- name: verify test get vultr ssh key infos in check mode - assert: - that: - - result.vultr_ssh_key_info|selectattr('name','equalto','{{ ssh_key_name }}') | list | count == 1 - - result.vultr_ssh_key_info|selectattr('ssh_key','equalto','{{ ssh_key_content }}') | list | count == 1 - -- name: test get vultr ssh key info - vultr_ssh_key_info: - register: result - -- name: verify test get vultr ssh key infos - assert: - that: - - result.vultr_ssh_key_info|selectattr('name','equalto','{{ ssh_key_name }}') | list | count == 1 - - result.vultr_ssh_key_info|selectattr('ssh_key','equalto','{{ ssh_key_content }}') | list | count == 1 - -- name: Destroy the ssh key - vultr_ssh_key: - name: '{{ ssh_key_name }}' - state: absent diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_startup_script/aliases b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_startup_script/aliases deleted file mode 100644 index bf469bb90..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_startup_script/aliases +++ /dev/null @@ -1 +0,0 @@ -cloud/vultr diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_startup_script/defaults/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_startup_script/defaults/main.yml deleted file mode 100644 index 38b68a695..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_startup_script/defaults/main.yml +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright (c) 2018, René Moser <mail@renemoser.net> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -vultr_resource_prefix: "vultr-test-prefix" -vultr_startup_script_name: "{{ vultr_resource_prefix }}_script" -vultr_startup_script: "#!/bin/bash\necho Hello World > /root/hello" -vultr_startup_script2: "#!/bin/bash\necho Hello to my World > /root/hello" diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_startup_script/tasks/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_startup_script/tasks/main.yml deleted file mode 100644 index 09929beb2..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_startup_script/tasks/main.yml +++ /dev/null @@ -1,140 +0,0 @@ -# Copyright (c) 2018, René Moser <mail@renemoser.net> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -- name: setup - vultr_startup_script: - name: "{{ vultr_startup_script_name }}" - state: absent - register: result -- name: verify setup - assert: - that: - - result is success - -- name: test fail if missing name - vultr_startup_script: - register: result - ignore_errors: yes -- name: verify test fail if missing name - assert: - that: - - result is failed - - 'result.msg == "missing required arguments: name"' - -- name: test fail if missing params for state=present - vultr_startup_script: - name: "{{ vultr_startup_script_name }}" - register: result - ignore_errors: yes -- name: verify fail if missing params for state=present - assert: - that: - - result is failed - - 'result.msg == "state is present but all of the following are missing: script"' - -- name: test create startup script in check mode - vultr_startup_script: - name: "{{ vultr_startup_script_name }}" - script: "{{ vultr_startup_script }}" - register: result - check_mode: yes -- name: verify test create startup script in check mode - assert: - that: - - result is changed - -- name: test create startup script - vultr_startup_script: - name: "{{ vultr_startup_script_name }}" - script: "{{ vultr_startup_script }}" - register: result -- name: verify test create startup script - assert: - that: - - result is changed - - result.vultr_startup_script.name == '{{ vultr_startup_script_name }}' - - result.vultr_startup_script.script == '{{ vultr_startup_script }}' - -- name: test create startup script idempotence - vultr_startup_script: - name: "{{ vultr_startup_script_name }}" - script: "{{ vultr_startup_script }}" - register: result -- name: verify test create startup script idempotence - assert: - that: - - result is not changed - - result.vultr_startup_script.name == '{{ vultr_startup_script_name }}' - - result.vultr_startup_script.script == '{{ vultr_startup_script }}' - -- name: test update startup script in check mode - vultr_startup_script: - name: "{{ vultr_startup_script_name }}" - script: "{{ vultr_startup_script2 }}" - register: result - check_mode: yes -- name: verify test update startup script in check mode - assert: - that: - - result is changed - - result.vultr_startup_script.name == '{{ vultr_startup_script_name }}' - - result.vultr_startup_script.script == '{{ vultr_startup_script }}' - -- name: test update startup script - vultr_startup_script: - name: "{{ vultr_startup_script_name }}" - script: "{{ vultr_startup_script2 }}" - register: result -- name: verify test update startup script - assert: - that: - - result is changed - - result.vultr_startup_script.name == '{{ vultr_startup_script_name }}' - - result.vultr_startup_script.script == '{{ vultr_startup_script2 }}' - -- name: test update startup script idempotence - vultr_startup_script: - name: "{{ vultr_startup_script_name }}" - script: "{{ vultr_startup_script2 }}" - register: result -- name: verify test update startup script idempotence - assert: - that: - - result is not changed - - result.vultr_startup_script.name == '{{ vultr_startup_script_name }}' - - result.vultr_startup_script.script == '{{ vultr_startup_script2 }}' - -- name: test absent startup script in check mode - vultr_startup_script: - name: "{{ vultr_startup_script_name }}" - state: absent - register: result - check_mode: yes -- name: verify test absent startup script in check mode - assert: - that: - - result is changed - - result.vultr_startup_script.name == '{{ vultr_startup_script_name }}' - - result.vultr_startup_script.script == '{{ vultr_startup_script2 }}' - -- name: test absent startup script - vultr_startup_script: - name: "{{ vultr_startup_script_name }}" - state: absent - register: result -- name: verify test absent startup script - assert: - that: - - result is changed - - result.vultr_startup_script.name == '{{ vultr_startup_script_name }}' - - result.vultr_startup_script.script == '{{ vultr_startup_script2 }}' - -- name: test absent startup script idempotence - vultr_startup_script: - name: "{{ vultr_startup_script_name }}" - state: absent - register: result -- name: verify test absent startup script idempotence - assert: - that: - - result is not changed diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_startup_script_info/aliases b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_startup_script_info/aliases deleted file mode 100644 index bf469bb90..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_startup_script_info/aliases +++ /dev/null @@ -1 +0,0 @@ -cloud/vultr diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_startup_script_info/defaults/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_startup_script_info/defaults/main.yml deleted file mode 100644 index 017cff1a3..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_startup_script_info/defaults/main.yml +++ /dev/null @@ -1,4 +0,0 @@ -vultr_resource_prefix: "vultr_test_prefix" -startup_script_name: "{{ vultr_resource_prefix }}_script" -startup_script_type: boot -startup_script_content: "#!/bin/bash\necho Hello World > /root/hello" diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_startup_script_info/tasks/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_startup_script_info/tasks/main.yml deleted file mode 100644 index 158824383..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_startup_script_info/tasks/main.yml +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright (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) ---- -- name: test gather vultr startup script info - empty resources - vultr_startup_script_info: - -- name: Create the script - vultr_startup_script: - name: '{{ startup_script_name }}' - script_type: '{{ startup_script_type }}' - script: '{{ startup_script_content }}' - -- name: test gather vultr startup script info in check mode - vultr_startup_script_info: - check_mode: yes - register: result - -- name: verify test gather vultr startup script info in check mode - assert: - that: - - result.vultr_startup_script_info|selectattr('name','equalto','{{ startup_script_name }}') | list | count == 1 - -- name: test gather vultr startup script info - vultr_startup_script_info: - register: result - -- name: verify test gather vultr startup script info - assert: - that: - - result.vultr_startup_script_info|selectattr('name','equalto','{{ startup_script_name }}') | list | count == 1 - -- name: Delete the script - vultr_startup_script: - name: '{{ startup_script_name }}' - state: absent diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_user/aliases b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_user/aliases deleted file mode 100644 index bf469bb90..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_user/aliases +++ /dev/null @@ -1 +0,0 @@ -cloud/vultr diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_user/defaults/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_user/defaults/main.yml deleted file mode 100644 index 9050a68f7..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_user/defaults/main.yml +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright (c) 2018, René Moser <mail@renemoser.net> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -vultr_resource_prefix: "vultr-test-prefix" -vultr_user_name: "{{ vultr_resource_prefix }}_user" diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_user/tasks/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_user/tasks/main.yml deleted file mode 100644 index 8c3684c11..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_user/tasks/main.yml +++ /dev/null @@ -1,225 +0,0 @@ ---- -# Copyright (c) 2018, René Moser <mail@renemoser.net> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -- name: setup - vultr_user: - name: "{{ vultr_user_name }}" - state: absent - register: result -- name: verify setup - assert: - that: - - result is success - -- name: test fail if missing name - vultr_user: - register: result - ignore_errors: yes -- name: verify test fail if missing name - assert: - that: - - result is failed - - 'result.msg == "missing required arguments: name"' - -- name: test fail if missing params for state=present - vultr_user: - name: "{{ vultr_user_name }}" - register: result - ignore_errors: yes -- name: verify fail if missing params for state=present - assert: - that: - - result is failed - - 'result.msg.startswith("state is present but all of the following are missing")' - -- name: test fail param not in choices - vultr_user: - name: "{{ vultr_user_name }}" - email: john.doe@example.com - password: s3cr3t - acls: - - bad - - dns - - manage_users - register: result - ignore_errors: yes -- name: verify test fail if missing name - assert: - that: - - result is failed - - 'result.msg.startswith("value of acls must be one or more of")' - -- name: test create user in check mode - vultr_user: - name: "{{ vultr_user_name }}" - email: john.doe@example.com - password: s3cr3t - acls: - - upgrade - - dns - - manage_users - register: result - check_mode: yes -- name: verify test create user in check mode - assert: - that: - - result is changed - -- name: test create user - vultr_user: - name: "{{ vultr_user_name }}" - email: john.doe@example.com - password: s3cr3t - acls: - - upgrade - - dns - - manage_users - register: result -- name: verify test create user - assert: - that: - - result is changed - - result.vultr_user.name == '{{ vultr_user_name }}' - - result.vultr_user.email == 'john.doe@example.com' - - result.vultr_user.api_enabled == true - - "'upgrade' in result.vultr_user.acls" - - "'manage_users' in result.vultr_user.acls" - - "'dns' in result.vultr_user.acls" - - result.vultr_user.api_key is defined - -- name: test create user idempotence - vultr_user: - name: "{{ vultr_user_name }}" - email: john.doe@example.com - password: s3cr3t - acls: - - upgrade - - dns - - manage_users - register: result -- name: verify test create user idempotence - assert: - that: - - result is not changed - - result.vultr_user.name == '{{ vultr_user_name }}' - - result.vultr_user.email == 'john.doe@example.com' - - result.vultr_user.api_enabled == true - - "'upgrade' in result.vultr_user.acls" - - "'manage_users' in result.vultr_user.acls" - - "'dns' in result.vultr_user.acls" - - result.vultr_user.api_key is not defined - -- name: test update user in check mode - vultr_user: - name: "{{ vultr_user_name }}" - email: jimmy@example.com - password: s3cr3t - api_enabled: false - acls: - - manage_users - - upgrade - - support - register: result - check_mode: yes -- name: verify test update user in check mode - assert: - that: - - result is changed - - result.vultr_user.name == '{{ vultr_user_name }}' - - result.vultr_user.email == 'john.doe@example.com' - - "'upgrade' in result.vultr_user.acls" - - "'manage_users' in result.vultr_user.acls" - - "'dns' in result.vultr_user.acls" - - result.vultr_user.api_enabled == true - - result.vultr_user.api_key is not defined - -- name: test update user - vultr_user: - name: "{{ vultr_user_name }}" - email: jimmy@example.com - password: s3cr3t - api_enabled: false - acls: - - manage_users - - upgrade - - support - register: result -- name: verify test update user - assert: - that: - - result is changed - - result.vultr_user.name == '{{ vultr_user_name }}' - - result.vultr_user.email == 'jimmy@example.com' - - "'upgrade' in result.vultr_user.acls" - - "'manage_users' in result.vultr_user.acls" - - "'support' in result.vultr_user.acls" - - result.vultr_user.api_enabled == false - - result.vultr_user.api_key is not defined - -- name: test update user idempotence - vultr_user: - name: "{{ vultr_user_name }}" - email: jimmy@example.com - password: s3cr3t - api_enabled: false - acls: - - manage_users - - upgrade - - support - register: result -- name: verify test update user idempotence - assert: - that: - - result is not changed - - result.vultr_user.name == '{{ vultr_user_name }}' - - result.vultr_user.email == 'jimmy@example.com' - - "'upgrade' in result.vultr_user.acls" - - "'manage_users' in result.vultr_user.acls" - - "'support' in result.vultr_user.acls" - - result.vultr_user.api_enabled == false - - result.vultr_user.api_key is not defined - -- name: test absent user in check mode - vultr_user: - name: "{{ vultr_user_name }}" - state: absent - register: result - check_mode: yes -- name: verify test absent user in check mode - assert: - that: - - result is changed - - result.vultr_user.name == '{{ vultr_user_name }}' - - result.vultr_user.email == 'jimmy@example.com' - - "'upgrade' in result.vultr_user.acls" - - "'manage_users' in result.vultr_user.acls" - - "'support' in result.vultr_user.acls" - - result.vultr_user.api_enabled == false - - result.vultr_user.api_key is not defined - -- name: test absent user - vultr_user: - name: "{{ vultr_user_name }}" - state: absent - register: result -- name: verify test absent user - assert: - that: - - result is changed - - result.vultr_user.name == '{{ vultr_user_name }}' - - result.vultr_user.email == 'jimmy@example.com' - - "'upgrade' in result.vultr_user.acls" - - "'manage_users' in result.vultr_user.acls" - - "'support' in result.vultr_user.acls" - - result.vultr_user.api_enabled == false - - result.vultr_user.api_key is not defined - -- name: test absent user idempotence - vultr_user: - name: "{{ vultr_user_name }}" - state: absent - register: result -- name: verify test absent user idempotence - assert: - that: - - result is not changed diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_user_info/aliases b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_user_info/aliases deleted file mode 100644 index bf469bb90..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_user_info/aliases +++ /dev/null @@ -1 +0,0 @@ -cloud/vultr diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_user_info/defaults/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_user_info/defaults/main.yml deleted file mode 100644 index 5922f6fe2..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_user_info/defaults/main.yml +++ /dev/null @@ -1,10 +0,0 @@ ---- -vultr_resource_prefix: "vultr-test-prefix" -user_name: "{{ vultr_resource_prefix }}_user" -user_email: mytestuser-{{ vultr_resource_prefix }}@example.com -user_password: "{{ vultr_resource_prefix }}aP4ssw0rd!" -user_acls: - - upgrade - - dns - - manage_users - - subscriptions diff --git a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_user_info/tasks/main.yml b/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_user_info/tasks/main.yml deleted file mode 100644 index 164c22fc5..000000000 --- a/ansible_collections/ngine_io/vultr/tests/integration/targets/vultr_user_info/tasks/main.yml +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (c) 2018, Yanis Guenane <yanis+ansible@guenane.org> -# Copyright (c) 2019, René Moser <mail@renemoser.net> -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ---- -- name: Create the user - vultr_user: - name: '{{ user_name }}' - email: '{{ user_email }}' - password: '{{ user_password }}' - acls: '{{ user_acls }}' - -- name: test get vultr user info in check mode - vultr_user_info: - register: result - check_mode: yes - -- name: verify test get vultr user info in check mode - assert: - that: - - result.vultr_user_info|selectattr('name','equalto','{{ user_name }}') | list | count == 1 - -- name: test get vultr user info - vultr_user_info: - register: result - -- name: verify test get vultr user info - assert: - that: - - result.vultr_user_info|selectattr('name','equalto','{{ user_name }}') | list | count == 1 - -- name: Delete the user - vultr_user: - name: '{{ user_name }}' - state: absent diff --git a/ansible_collections/ngine_io/vultr/tests/sanity/ignore-2.10.txt b/ansible_collections/ngine_io/vultr/tests/sanity/ignore-2.10.txt deleted file mode 100644 index e69de29bb..000000000 --- a/ansible_collections/ngine_io/vultr/tests/sanity/ignore-2.10.txt +++ /dev/null |