mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
44 lines
1.5 KiB
YAML
44 lines
1.5 KiB
YAML
# 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
|