new module cdnendpoint (#46796)

* new module cdnendpoint
This commit is contained in:
Yunge Zhu 2018-11-28 09:57:04 +08:00 committed by Zim Kalinowski
commit e0af9b2ce0
3 changed files with 788 additions and 1 deletions

View file

@ -1,4 +1,5 @@
cloud/azure
shippable/azure/group4
destructive
azure_rm_cdnprofile_facts
azure_rm_cdnprofile_facts
azure_rm_cdnendpoint

View file

@ -1,6 +1,7 @@
- name: Prepare random number
set_fact:
cdnprofilename: "cdnprofile{{ resource_group | hash('md5') | truncate(7, True, '') }}{{ 1000 | random }}"
endpointname: "endpoint{{ resource_group | hash('md5') | truncate(7, True, '') }}{{ 1000 | random }}"
run_once: yes
@ -108,6 +109,130 @@
- fact.cdnprofiles[0].tags.foo == 'bar'
- fact.cdnprofiles[0].tags.baz == 'qux'
- name: Create a Azure CDN endpoint(check mode)
azure_rm_cdnendpoint:
resource_group: "{{ resource_group }}"
name: "{{ endpointname }}"
profile_name: "{{ cdnprofilename }}"
origins:
- name: "org{{ endpointname }}"
host_name: "www.google.com"
tags:
testing: testing
delete: on-exit
foo: bar
check_mode: yes
- name: Create a Azure CDN endpoint
azure_rm_cdnendpoint:
resource_group: "{{ resource_group }}"
name: "{{ endpointname }}"
profile_name: "{{ cdnprofilename }}"
origins:
- name: "org{{ endpointname }}"
host_name: "www.google.com"
tags:
testing: testing
delete: on-exit
foo: bar
register: output
- name: Assert the Azure CDN endpoint is well created
assert:
that:
- output.changed
- output.id
- name: Create a Azure CDN endpoint(idempotent)
azure_rm_cdnendpoint:
resource_group: "{{ resource_group }}"
name: "{{ endpointname }}"
profile_name: "{{ cdnprofilename }}"
origins:
- name: "org{{ endpointname }}"
host_name: "www.google.com"
tags:
testing: testing
delete: on-exit
foo: bar
register: output
- name: Assert idempotent
assert:
that:
- not output.changed
- name: Stop a Azure CDN endpoint
azure_rm_cdnendpoint:
resource_group: "{{ resource_group }}"
name: "{{ endpointname }}"
profile_name: "{{ cdnprofilename }}"
started: False
register: output
- name: Assert stopped
assert:
that:
- output.changed
- name: Stop a Azure CDN endpoint(idempotent)
azure_rm_cdnendpoint:
resource_group: "{{ resource_group }}"
name: "{{ endpointname }}"
profile_name: "{{ cdnprofilename }}"
started: False
register: output
- name: Assert still stopped and not changed
assert:
that:
- not output.changed
- name: Start a Azure CDN endpoint
azure_rm_cdnendpoint:
resource_group: "{{ resource_group }}"
name: "{{ endpointname }}"
profile_name: "{{ cdnprofilename }}"
started: True
register: output
- name: Assert started
assert:
that:
- output.changed
- name: Update the Azure CDN endpoint
azure_rm_cdnendpoint:
resource_group: "{{ resource_group }}"
name: "{{ endpointname }}"
profile_name: "{{ cdnprofilename }}"
origin_path: /test/
tags:
testing: testing
delete: on-exit
foo: baz
register: output
- name: Assert the Azure CDN endpoint is updated
assert:
that:
- output.changed
- name: Delete a Azure CDN endpoint(check mode)
azure_rm_cdnendpoint:
resource_group: "{{ resource_group }}"
name: "{{ endpointname }}"
profile_name: "{{ cdnprofilename }}"
state: absent
check_mode: yes
- name: Delete a Azure CDN endpoint
azure_rm_cdnendpoint:
resource_group: "{{ resource_group }}"
name: "{{ endpointname }}"
profile_name: "{{ cdnprofilename }}"
state: absent
- name: Delete the CDN profile
azure_rm_cdnprofile:
resource_group: "{{ resource_group }}"