ansible/test/integration/targets/azure_rm_loadbalancer/tasks/main.yml

198 lines
5 KiB
YAML
Raw Normal View History

- name: create public ip
azure_rm_publicipaddress:
name: ansiblepipstandard
sku: Standard
allocation_method: Static
resource_group: '{{ resource_group }}'
- name: create public ip
azure_rm_publicipaddress:
name: ansiblepip3
resource_group: '{{ resource_group }}'
- name: clear load balancer
azure_rm_loadbalancer:
resource_group: '{{ resource_group }}'
name: lbtestfromansible
state: absent
- name: create load balancer
azure_rm_loadbalancer:
resource_group: '{{ resource_group }}'
name: lbtestfromansible
public_ip: ansiblepip3
register: output
- name: assert load balancer created
assert:
that: output.changed
- name: delete load balancer
azure_rm_loadbalancer:
resource_group: '{{ resource_group }}'
name: lbtestfromansible
state: absent
register: output
- name: assert load balancer deleted
assert:
that: output.changed
- name: delete load balancer (idempotent)
azure_rm_loadbalancer:
resource_group: '{{ resource_group }}'
name: lbtestfromansible
state: absent
register: output
- name: assert load balancer deleted (idempotent)
assert:
that: not output.changed
- name: create another load balancer with more options
azure_rm_loadbalancer:
resource_group: '{{ resource_group }}'
name: lbtestfromansible
sku: Standard
public_ip_address: ansiblepipstandard
probe_protocol: Tcp
probe_port: 80
probe_interval: 10
probe_fail_count: 3
protocol: Tcp
load_distribution: Default
frontend_port: 80
backend_port: 8080
idle_timeout: 4
natpool_frontend_port_start: 30
natpool_frontend_port_end: 40
natpool_backend_port: 80
natpool_protocol: Tcp
register: output
- name: assert complex load balancer created
assert:
that:
- output.changed
- output.state.sku == 'Standard'
- name: delete load balancer
azure_rm_loadbalancer:
resource_group: '{{ resource_group }}'
name: lbtestfromansible
state: absent
- name: create load balancer with multiple parameters
azure_rm_loadbalancer:
resource_group: '{{ resource_group }}'
name: lbtestfromansible
frontend_ip_configurations:
- name: frontendipconf0
public_ip_address: ansiblepip3
backend_address_pools:
- name: backendaddrpool0
probes:
- name: prob0
port: 80
inbound_nat_pools:
- name: inboundnatpool0
frontend_ip_configuration_name: frontendipconf0
protocol: Tcp
frontend_port_range_start: 80
frontend_port_range_end: 81
backend_port: 8080
load_balancing_rules:
- name: lbrbalancingrule0
frontend_ip_configuration: frontendipconf0
backend_address_pool: backendaddrpool0
frontend_port: 80
backend_port: 80
probe: prob0
register: output
- name: assert complex load balancer created
assert:
that: output.changed
- name: delete load balancer
azure_rm_loadbalancer:
resource_group: '{{ resource_group }}'
name: lbtestfromansible
state: absent
- name: Create virtual network
azure_rm_virtualnetwork:
resource_group: "{{ resource_group }}"
name: lbtestfromansiblevn
address_prefixes: "10.10.0.0/16"
- name: Add subnet
azure_rm_subnet:
resource_group: "{{ resource_group }}"
name: lbtestfromansiblesb
address_prefix: "10.10.0.0/24"
virtual_network: lbtestfromansiblevn
register: subnet
- name: create internal loadbalancer
azure_rm_loadbalancer:
resource_group: '{{ resource_group }}'
name: lbtestfromansible
frontend_ip_configurations:
- name: frontendipconf0
private_ip_address: 10.10.0.10
private_ip_allocation_method: Static
subnet: "{{ subnet.state.id }}"
backend_address_pools:
- name: backendaddrpool0
probes:
- name: prob0
port: 80
inbound_nat_pools:
- name: inboundnatpool0
frontend_ip_configuration_name: frontendipconf0
protocol: Tcp
frontend_port_range_start: 80
frontend_port_range_end: 81
backend_port: 8080
load_balancing_rules:
- name: lbrbalancingrule0
frontend_ip_configuration: frontendipconf0
backend_address_pool: backendaddrpool0
frontend_port: 80
backend_port: 80
probe: prob0
register: output
- name: assert complex load balancer created
assert:
that: output.changed
- name: delete load balancer
azure_rm_loadbalancer:
resource_group: '{{ resource_group }}'
name: lbtestfromansible
state: absent
- name: cleanup public ip
azure_rm_publicipaddress:
name: "{{ item }}"
resource_group: '{{ resource_group }}'
state: absent
with_items:
- ansiblepip3
- ansiblepipstandard
- name: cleanup subnet
azure_rm_subnet:
resource_group: "{{ resource_group }}"
name: lbtestfromansiblesb
virtual_network: lbtestfromansiblevn
state: absent
- name: cleanup virtual network
azure_rm_virtualnetwork:
resource_group: "{{ resource_group }}"
name: lbtestfromansiblevn
state: absent