1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

migrate azure_rm_vm tests to active (#30452)

This commit is contained in:
Matt Davis 2017-09-15 22:48:30 -07:00 committed by GitHub
parent c12c7a72ed
commit 035a17e8aa
7 changed files with 6 additions and 108 deletions

View file

@ -0,0 +1,3 @@
cloud/azure
posix/ci/cloud/group2/azure
destructive

View file

@ -0,0 +1,2 @@
dependencies:
- setup_azure

View file

@ -0,0 +1 @@
- include: virtualmachine.yml

View file

@ -1,2 +0,0 @@
- include: virtualmachine.yml
#- include: virtualmachine_with_defaults.yml

View file

@ -1,106 +0,0 @@
- name: Remove VM
azure_rm_virtualmachine:
resource_group: "{{ resource_group }}"
name: testvm10
state: absent
vm_size: Standard_A0
register: output
- name: Remove VM
azure_rm_virtualmachine:
resource_group: "{{ resource_group }}"
name: testvm20
state: absent
vm_size: Standard_A0
register: output
- name: Create VM with defaults
azure_rm_virtualmachine:
resource_group: "{{ resource_group }}"
name: testvm10
vm_size: Standard_A0
admin_username: chouseknecht
admin_password: Password123
short_hostname: test10
os_type: Linux
open_ports:
- "22-23"
image:
offer: UbuntuServer
publisher: Canonical
sku: 16.04-LTS
version: latest
register: output
- name: Add host
add_host:
groups: just_created
hostname: testvm10
ansible_host: "{{ azure_vm.properties.networkProfile.networkInterfaces[0].properties.ipConfigurations[0].properties.publicIPAddress.properties.ipAddress }}"
ansible_user: chouseknecht
ansible_ssh_pass: Password123
- name: Create VM accessible via ssh keys only
azure_rm_virtualmachine:
resource_group: "{{ resource_group }}"
name: testvm20
short_hostname: testvm20
ssh_password_enabled: false
ssh_public_keys:
- path: /home/chouseknecht/.ssh/authorized_keys
key_data: "{{ lookup('env', 'HOME') }}/.ssh/id_rsa"
vm_size: Standard_A0
admin_username: chouseknecht
image:
offer: UbuntuServer
publisher: Canonical
sku: 16.04-LTS
version: latest
register: output
- name: Should be idempotent
azure_rm_virtualmachine:
resource_group: "{{ resource_group }}"
name: testvm20
short_hostname: testvm20
ssh_password_enabled: false
ssh_public_keys:
- path: /home/chouseknecht/.ssh/authorized_keys
key_data: "{{ lookup('env', 'HOME') }}/.ssh/id_rsa"
vm_size: Standard_A0
admin_username: chouseknecht
image:
offer: UbuntuServer
publisher: Canonical
sku: 16.04-LTS
version: latest
register: output
- assert:
that: not output.changed
- name: Add host
add_host:
groups: just_created
hostname: testvm20
ansible_ssh_host: "{{ azure_vm.properties.networkProfile.networkInterfaces[0].properties.ipConfigurations[0].properties.publicIPAddress.properties.ipAddress }}"
ansible_ssh_user: chouseknecht
- name: Power Off
azure_rm_virtualmachine:
resource_group: "{{ resource_group }}"
name: testvm10
started: no
register: output
- assert:
that: "azure_vm.powerstate not in ['starting', 'running']"
- name: Power On
azure_rm_virtualmachine:
resource_group: "{{ resource_group }}"
name: testvm10
register: output
- assert:
that: "azure_vm.powerstate in ['starting', 'running']"