ansible/test/legacy/roles/vultr_network_facts/tasks/main.yml
Yanis Guenane 0c65bcb23b Vultr: Introducing vultr_network_facts module (#43600)
This commit introduces a new module called vultr_network_facts.

This module aims to return the list of networks avaiable in Vultr.

Sample available here:

```
"vultr_network_facts": [
  {
    "date_created": "2018-08-02 11:18:49",
    "id": "net5b62e8991adfg",
    "name": "mynet",
    "region": "Amsterdam",
    "v4_subnet": "192.168.42.0",
    "v4_subnet_mask": 24
  }
]
```
2018-08-20 00:29:05 +02:00

33 lines
1 KiB
YAML

# 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 facts - empty resources
vultr_network_facts:
- name: Create the network
vultr_network:
name: '{{ vultr_network_name }}'
cidr: '{{ vultr_network_cidr }}'
region: '{{ vultr_network_region }}'
- name: test gather vultr network facts in check mode
vultr_network_facts:
check_mode: yes
- name: verify test gather vultr network facts in check mode
assert:
that:
- ansible_facts.vultr_network_facts|selectattr('name','equalto','{{ vultr_network_name }}') | list | count == 1
- name: test gather vultr network facts
vultr_network_facts:
- name: verify test gather vultr network facts
assert:
that:
- ansible_facts.vultr_network_facts|selectattr('name','equalto','{{ vultr_network_name }}') | list | count == 1
- name: Delete the script
vultr_network:
name: '{{ vultr_network_name }}'
state: absent