mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
Migrate more Azure integration tests. (#29034)
This commit is contained in:
@@ -1,23 +0,0 @@
|
||||
- name: Create Azure Deploy
|
||||
azure_rm_deployment:
|
||||
resource_group: Test_Deployment
|
||||
template_link: 'https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-vm-simple-linux/azuredeploy.json'
|
||||
parameters:
|
||||
adminUsername:
|
||||
value: chouseknecht
|
||||
adminPassword:
|
||||
value: password123!
|
||||
dnsLabelPrefix:
|
||||
value: testvm9910001
|
||||
ubuntuOSVersion:
|
||||
value: "14.04.2-LTS"
|
||||
register: output
|
||||
|
||||
- name: Add new instance to host group
|
||||
add_host:
|
||||
hostname: "{{ item.vm_name }}"
|
||||
ansible_host: "{{ item['ips'][0].public_ip }}"
|
||||
ansible_user: chouseknecht
|
||||
ansible_ssh_pass: password123!
|
||||
groupname: azure_vms
|
||||
with_items: "{{ output.deployment.instances }}"
|
||||
@@ -1,140 +0,0 @@
|
||||
- name: Create security group
|
||||
azure_rm_securitygroup:
|
||||
resource_group: "{{ resource_group }}"
|
||||
name: mysecgroup
|
||||
tags:
|
||||
testing: testing
|
||||
delete: on-exit
|
||||
foo: bar
|
||||
purge_rules: yes
|
||||
rules:
|
||||
- name: DenySSH
|
||||
protocol: Tcp
|
||||
destination_port_range: 22
|
||||
access: Deny
|
||||
priority: 100
|
||||
direction: Inbound
|
||||
- name: 'AllowSSH'
|
||||
protocol: Tcp
|
||||
source_address_prefix: '174.109.158.0/24'
|
||||
destination_port_range: 22
|
||||
access: Allow
|
||||
priority: 101
|
||||
direction: Inbound
|
||||
register: output
|
||||
|
||||
- assert: { that: "{{ output.state.rules | length }} == 2" }
|
||||
|
||||
- name: Gather facts by tags
|
||||
azure_rm_securitygroup_facts:
|
||||
resource_group: "{{ resource_group }}"
|
||||
tags:
|
||||
- testing
|
||||
- foo:bar
|
||||
register: output
|
||||
|
||||
- assert:
|
||||
that: azure_securitygroups | length == 1
|
||||
|
||||
- name: Add/Update rules on existing security group
|
||||
azure_rm_securitygroup:
|
||||
resource_group: "{{ resource_group }}"
|
||||
name: mysecgroup
|
||||
rules:
|
||||
- name: DenySSH
|
||||
protocol: Tcp
|
||||
destination_port_range: 22-23
|
||||
access: Deny
|
||||
priority: 100
|
||||
- name: AllowSSHFromHome
|
||||
protocol: Tcp
|
||||
source_address_prefix: '174.109.158.0/24'
|
||||
destination_port_range: 22-23
|
||||
priority: 102
|
||||
register: output
|
||||
|
||||
- assert: { that: "{{ output.state.rules | length }} == 3" }
|
||||
|
||||
- name: Test idempotence
|
||||
azure_rm_securitygroup:
|
||||
resource_group: "{{ resource_group }}"
|
||||
name: mysecgroup
|
||||
rules:
|
||||
- name: DenySSH
|
||||
protocol: Tcp
|
||||
destination_port_range: 22-23
|
||||
access: Deny
|
||||
priority: 100
|
||||
- name: AllowSSHFromHome
|
||||
protocol: Tcp
|
||||
source_address_prefix: '174.109.158.0/24'
|
||||
destination_port_range: 22-23
|
||||
priority: 102
|
||||
register: output
|
||||
|
||||
- assert:
|
||||
that: not output.changed
|
||||
|
||||
- name: Update tags
|
||||
azure_rm_securitygroup:
|
||||
resource_group: "{{ resource_group }}"
|
||||
name: mysecgroup
|
||||
tags:
|
||||
testing: testing
|
||||
delete: never
|
||||
baz: bar
|
||||
register: output
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- output.state.tags | length == 3
|
||||
- output.state.tags.delete == 'never'
|
||||
|
||||
- name: Purge tags
|
||||
azure_rm_securitygroup:
|
||||
resource_group: "{{ resource_group }}"
|
||||
name: mysecgroup
|
||||
tags:
|
||||
testing: testing
|
||||
delete: on-exit
|
||||
register: output
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- output.state.tags | length == 2
|
||||
- output.state.tags.delete == 'on-exit'
|
||||
|
||||
- name: Gather facts for one accounts
|
||||
azure_rm_securitygroup_facts:
|
||||
resource_group: "{{ resource_group }}"
|
||||
name: mysecgroup
|
||||
register: output
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- azure_securitygroups | length == 1
|
||||
|
||||
- name: Gather facts for all accounts
|
||||
azure_rm_securitygroup_facts:
|
||||
resource_group: "{{ resource_group }}"
|
||||
register: output
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- azure_securitygroups | length > 0
|
||||
|
||||
- name: Delete all security groups
|
||||
azure_rm_securitygroup:
|
||||
resource_group: "{{ resource_group }}"
|
||||
name: "{{ item.name }}"
|
||||
state: absent
|
||||
with_items: "{{ azure_securitygroups }}"
|
||||
|
||||
- name: Should have no security groups remaining
|
||||
azure_rm_securitygroup_facts:
|
||||
resource_group: "{{ resource_group }}"
|
||||
register: output
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- azure_securitygroups | length == 0
|
||||
@@ -1,39 +0,0 @@
|
||||
- name: Get facts for a specific image
|
||||
azure_rm_virtualmachineimage_facts:
|
||||
location: "{{ location }}"
|
||||
publisher: OpenLogic
|
||||
offer: CentOS
|
||||
sku: '7.1'
|
||||
version: '7.1.20150731'
|
||||
register: output
|
||||
|
||||
- assert:
|
||||
that: azure_vmimages | length == 1
|
||||
|
||||
- name: List available versions
|
||||
azure_rm_virtualmachineimage_facts:
|
||||
location: "{{ location }}"
|
||||
publisher: OpenLogic
|
||||
offer: CentOS
|
||||
sku: '7.1'
|
||||
register: output
|
||||
|
||||
- assert:
|
||||
that: azure_vmimages | length > 0
|
||||
|
||||
- name: List available offers
|
||||
azure_rm_virtualmachineimage_facts:
|
||||
location: "{{ location }}"
|
||||
publisher: OpenLogic
|
||||
register: output
|
||||
|
||||
- assert:
|
||||
that: azure_vmimages | length > 0
|
||||
|
||||
- name: List available publishers
|
||||
azure_rm_virtualmachineimage_facts:
|
||||
location: "{{ location }}"
|
||||
register: output
|
||||
|
||||
- assert:
|
||||
that: azure_vmimages | length > 0
|
||||
Reference in New Issue
Block a user