mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
9b898ebc20
This commit introduces a new module called vr_sshkey_facts. This module aims to return the list of SSH keys avaiable in Vultr. Sample available here: ``` "vultr_sshkey_facts": [ { "date_created": "2018-07-10 14:49:13", "id": "5b43c760d7d84", "name": "me@home", "ssh_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+ZFQv3MyjtL1BMpSA0o0gIkzLVVC711rthT29hBNeORdNowQ7FSvVWUdAbTq00U7Xzak1ANIYLJyn+0r7olsdG4XEiUR0dqgC99kbT/QhY5mLe5lpl7JUjW9ctn00hNmt+TswpatCKWPNwdeAJT2ERynZaqPobENgewrwerqewqIVew7qFeZygxsPVn36EUr2Cdq7Nb7U0XFXh3x1p0v0+MbL4tiJwPlMAGvFTKIMt+EaA+AsRIxiOo9CMk5ZuOl9pT8h5vNuEOcvS0qx4v44EAD2VOsCVCcrPNMcpuSzZP8dRTGU9wRREAWXngD0Zq9YJMH38VTxHiskoBw1NnPz me@home" } ] ```
31 lines
1.1 KiB
YAML
31 lines
1.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: Upload an ssh key
|
|
vr_ssh_key:
|
|
name: '{{ ssh_key_name }}'
|
|
ssh_key: '{{ ssh_key_content }}'
|
|
|
|
- name: test gather vultr ssh key facts in check mode
|
|
vr_ssh_key_facts:
|
|
check_mode: yes
|
|
|
|
- name: verify test gather vultr ssh key facts in check mode
|
|
assert:
|
|
that:
|
|
- ansible_facts.vultr_ssh_key_facts|selectattr('name','equalto','{{ ssh_key_name }}') | list | count == 1
|
|
- ansible_facts.vultr_ssh_key_facts|selectattr('ssh_key','equalto','{{ ssh_key_content }}') | list | count == 1
|
|
|
|
- name: test gather vultr ssh key fact
|
|
vr_ssh_key_facts:
|
|
|
|
- name: verify test gather vultr ssh key facts
|
|
assert:
|
|
that:
|
|
- ansible_facts.vultr_ssh_key_facts|selectattr('name','equalto','{{ ssh_key_name }}') | list | count == 1
|
|
- ansible_facts.vultr_ssh_key_facts|selectattr('ssh_key','equalto','{{ ssh_key_content }}') | list | count == 1
|
|
|
|
- name: Destroy the ssh key
|
|
vr_ssh_key:
|
|
name: ansibletest-sshkey
|
|
state: absent
|