ansible/test/integration/targets/vultr_ssh_key_info/tasks/main.yml
René Moser 5143f52def
vultr: vultr_ssh_key_facts -> info (#57571)
* vultr: deprecate vultr_ssh_key_facts

* vultr: rename tests

* vultr: adjust tests

* vultr: new vultr_ssh_key_info module

* vultr: test: vultr_ssh_key_info: improve tests

* update docs
2019-06-13 07:05:00 +02:00

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