Vultr: Introducing vr_startup_script_facts module (#43004)

This commit introduces a new module called vr_startup_script_facts.

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

Sample available here:

```
"vultr_startup_script_facts": [
  {
    "date_created": "2018-07-19 08:52:55",
    "date_modified": "2018-07-19 08:52:55",
    "id": 327140,
    "name": "myteststartupscript",
    "script": "#!/bin/bash\necho Hello World > /root/hello",
    "type": "boot"
  }
]
```
This commit is contained in:
Yanis Guenane 2018-07-20 20:32:32 +02:00 committed by René Moser
commit b1c60eaa83
4 changed files with 159 additions and 0 deletions

View file

@ -0,0 +1,3 @@
startup_script_name: myteststartupscript
startup_script_type: boot
startup_script_content: "#!/bin/bash\necho Hello World > /root/hello"

View file

@ -0,0 +1,30 @@
# 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 script
vr_startup_script:
name: '{{ startup_script_name }}'
script_type: '{{ startup_script_type }}'
script: '{{ startup_script_content }}'
- name: test gather vultr startup script facts in check mode
vr_startup_script_facts:
check_mode: yes
- name: verify test gather vultr startup script facts in check mode
assert:
that:
- ansible_facts.vultr_startup_script_facts|selectattr('name','equalto','{{ startup_script_name }}') | list | count == 1
- name: test gather vultr startup script facts
vr_startup_script_facts:
- name: verify test gather vultr startup script facts
assert:
that:
- ansible_facts.vultr_startup_script_facts|selectattr('name','equalto','{{ startup_script_name }}') | list | count == 1
- name: Delete the script
vr_startup_script:
name: '{{ startup_script_name }}'
state: absent

View file

@ -19,5 +19,6 @@
- { role: vr_ssh_key, tags: test_vr_ssh_key }
- { role: vr_ssh_key_facts, tags: test_vr_ssh_key_facts }
- { role: vr_startup_script, tags: test_vr_startup_script }
- { role: vr_startup_script_facts, tags: test_vr_startup_script_facts }
- { role: vr_user, tags: test_vr_user }
- { role: vr_user_facts, tags: test_vr_user_facts }