2018-03-22 04:58:28 +01:00
|
|
|
- name: Fix resource prefix
|
|
|
|
set_fact:
|
|
|
|
fixed_resource_prefix: "{{ resource_prefix | replace('-','x') }}"
|
|
|
|
|
2017-08-30 03:54:58 +02:00
|
|
|
- name: create storage account for function apps
|
|
|
|
azure_rm_storageaccount:
|
|
|
|
resource_group: '{{ resource_group }}'
|
2018-03-22 04:58:28 +01:00
|
|
|
name: sa{{ fixed_resource_prefix }}
|
2017-08-30 03:54:58 +02:00
|
|
|
account_type: Standard_LRS
|
|
|
|
|
|
|
|
- name: create basic function app
|
|
|
|
azure_rm_functionapp:
|
|
|
|
resource_group: '{{ resource_group }}'
|
2018-03-22 04:58:28 +01:00
|
|
|
name: af{{ fixed_resource_prefix }}
|
|
|
|
storage_account: sa{{ fixed_resource_prefix }}
|
2017-08-30 03:54:58 +02:00
|
|
|
register: output
|
|
|
|
|
|
|
|
- name: assert the function was created
|
|
|
|
assert:
|
|
|
|
that: output.changed
|
|
|
|
|
|
|
|
- name: list facts for function
|
|
|
|
azure_rm_functionapp_facts:
|
|
|
|
resource_group: '{{ resource_group }}'
|
2018-03-22 04:58:28 +01:00
|
|
|
name: af{{ fixed_resource_prefix }}
|
2017-12-07 18:41:19 +01:00
|
|
|
register: results
|
2017-08-30 03:54:58 +02:00
|
|
|
|
|
|
|
- name: assert the facts were retrieved
|
|
|
|
assert:
|
2017-12-07 18:41:19 +01:00
|
|
|
that:
|
|
|
|
- results.ansible_facts.azure_functionapps|length == 1
|
2018-03-22 04:58:28 +01:00
|
|
|
- results.ansible_facts.azure_functionapps[0].name == 'af{{ fixed_resource_prefix }}'
|
2017-08-30 03:54:58 +02:00
|
|
|
|
|
|
|
- name: delete basic function app
|
|
|
|
azure_rm_functionapp:
|
|
|
|
resource_group: '{{ resource_group }}'
|
2018-03-22 04:58:28 +01:00
|
|
|
name: af{{ fixed_resource_prefix }}
|
2017-08-30 03:54:58 +02:00
|
|
|
state: absent
|
|
|
|
register: output
|
|
|
|
|
|
|
|
- name: assert the function was deleted
|
|
|
|
assert:
|
|
|
|
that: output.changed
|
|
|
|
|
|
|
|
- name: create a function with app settings
|
|
|
|
azure_rm_functionapp:
|
|
|
|
resource_group: '{{ resource_group }}'
|
2018-03-22 04:58:28 +01:00
|
|
|
name: af{{ fixed_resource_prefix }}
|
|
|
|
storage_account: sa{{ fixed_resource_prefix }}
|
2017-08-30 03:54:58 +02:00
|
|
|
app_settings:
|
|
|
|
hello: world
|
|
|
|
things: more stuff
|
|
|
|
register: output
|
|
|
|
|
|
|
|
- name: assert the function with app settings was created
|
|
|
|
assert:
|
|
|
|
that: output.changed
|
|
|
|
|
|
|
|
- name: change app settings
|
|
|
|
azure_rm_functionapp:
|
|
|
|
resource_group: '{{ resource_group }}'
|
2018-03-22 04:58:28 +01:00
|
|
|
name: af{{ fixed_resource_prefix }}
|
|
|
|
storage_account: sa{{ fixed_resource_prefix }}
|
2017-08-30 03:54:58 +02:00
|
|
|
app_settings:
|
|
|
|
hello: world
|
|
|
|
things: more stuff
|
|
|
|
another: one
|
|
|
|
register: output
|
|
|
|
|
|
|
|
- name: assert the function was changed
|
|
|
|
assert:
|
|
|
|
that: output.changed
|
|
|
|
|
|
|
|
- name: delete the function app
|
|
|
|
azure_rm_functionapp:
|
|
|
|
resource_group: '{{ resource_group }}'
|
2018-03-22 04:58:28 +01:00
|
|
|
name: af{{ fixed_resource_prefix }}
|
2017-08-30 03:54:58 +02:00
|
|
|
state: absent
|
|
|
|
register: output
|
|
|
|
|
|
|
|
- name: assert the function was deleted
|
|
|
|
assert:
|
|
|
|
that: output.changed
|
|
|
|
|
|
|
|
- name: delete storage account
|
|
|
|
azure_rm_storageaccount:
|
|
|
|
resource_group: '{{ resource_group }}'
|
2018-03-22 04:58:28 +01:00
|
|
|
name: sa{{ fixed_resource_prefix }}
|
2017-08-30 03:54:58 +02:00
|
|
|
state: absent
|