2018-05-04 07:17:05 +02:00
|
|
|
- name: create public ip
|
|
|
|
azure_rm_publicipaddress:
|
|
|
|
name: ansiblepipstandard
|
|
|
|
sku: Standard
|
|
|
|
allocation_method: Static
|
|
|
|
resource_group: '{{ resource_group }}'
|
|
|
|
|
2017-08-29 23:29:44 +02:00
|
|
|
- name: create public ip
|
|
|
|
azure_rm_publicipaddress:
|
|
|
|
name: ansiblepip3
|
|
|
|
resource_group: '{{ resource_group }}'
|
|
|
|
|
2018-02-08 10:32:27 +01:00
|
|
|
- name: clear load balancer
|
|
|
|
azure_rm_loadbalancer:
|
|
|
|
resource_group: '{{ resource_group }}'
|
|
|
|
name: lbtestfromansible
|
|
|
|
state: absent
|
|
|
|
|
2017-08-29 23:29:44 +02:00
|
|
|
- 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
|
|
|
|
|
2018-02-08 10:32:27 +01:00
|
|
|
- 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
|
|
|
|
|
2017-08-29 23:29:44 +02:00
|
|
|
- name: create another load balancer with more options
|
|
|
|
azure_rm_loadbalancer:
|
|
|
|
resource_group: '{{ resource_group }}'
|
|
|
|
name: lbtestfromansible
|
2018-05-04 07:17:05 +02:00
|
|
|
sku: Standard
|
|
|
|
public_ip_address: ansiblepipstandard
|
2017-08-29 23:29:44 +02:00
|
|
|
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:
|
2018-05-04 07:17:05 +02:00
|
|
|
that:
|
|
|
|
- output.changed
|
|
|
|
- output.state.sku == 'Standard'
|
2017-08-29 23:29:44 +02:00
|
|
|
|
|
|
|
- name: delete load balancer
|
|
|
|
azure_rm_loadbalancer:
|
|
|
|
resource_group: '{{ resource_group }}'
|
|
|
|
name: lbtestfromansible
|
|
|
|
state: absent
|
|
|
|
|
2018-02-08 10:32:27 +01:00
|
|
|
- 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
|
|
|
|
|
2018-05-04 07:17:05 +02:00
|
|
|
- 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
|
|
|
|
|
2017-08-29 23:29:44 +02:00
|
|
|
- name: cleanup public ip
|
|
|
|
azure_rm_publicipaddress:
|
2018-05-04 07:17:05 +02:00
|
|
|
name: "{{ item }}"
|
2017-08-29 23:29:44 +02:00
|
|
|
resource_group: '{{ resource_group }}'
|
|
|
|
state: absent
|
2018-05-04 07:17:05 +02:00
|
|
|
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
|