ansible/test/integration/roles/azure_rm_storageblob/tasks/main.yml
Matt Clay c27ebfc368 Migrate roles from ansible/azure-testing (#28074)
* Migrate roles from ansible/azure-testing as-is.
* Fix yamllint issues.
* Remove unused binary file.
2017-08-11 16:16:39 -07:00

145 lines
3.3 KiB
YAML

- name: Create resource group
azure_rm_resourcegroup:
name: "{{ resource_group }}"
location: "{{ location }}"
- name: Create storage account
azure_rm_storageaccount:
resource_group: "{{ resource_group }}"
name: testgroup03blobs
account_type: Standard_LRS
state: present
- name: Create container
azure_rm_storageblob:
resource_group: "{{ resource_group }}"
account_name: testgroup03blobs
container_name: my-blobs
register: create_facts
- debug: var=create_facts
when: playbook_debug
- name: Force upload blob
azure_rm_storageblob:
resource_group: "{{ resource_group }}"
account_name: testgroup03blobs
container_name: my-blobs
blob: 'Ratings.png'
src: './roles/azure_rm_storageblob/files/Ratings.png'
content_type: image/png
tags:
val1: foo
val2: bar
force: yes
register: upload_facts
- debug: var=upload_facts
when: playbook_debug
- name: Upload blob idempotence
azure_rm_storageblob:
resource_group: "{{ resource_group }}"
account_name: testgroup03blobs
container_name: my-blobs
blob: 'Ratings.png'
src: './roles/azure_rm_storageblob/files/Ratings.png'
content_type: image/png
tags:
val1: foo
val2: bar
register: upload_facts
- debug: var=upload_facts
when: playbook_debug
- assert:
that: "not upload_facts.changed"
- name: Download file idempotence
azure_rm_storageblob:
resource_group: "{{ resource_group }}"
account_name: testgroup03blobs
container_name: my-blobs
blob: 'Ratings.png'
dest: './roles/azure_rm_storageblob/files/Ratings.png'
register: download_results
- debug: var=download_results
when: playbook_debug
- assert:
that: not download_results.changed
- file: path="/tmp/Ratings.png" state=absent
- name: Download file
azure_rm_storageblob:
resource_group: "{{ resource_group }}"
account_name: testgroup03blobs
container_name: my-blobs
blob: 'Ratings.png'
dest: '/tmp/Ratings.png'
register: download_results
- assert:
that: "download_results.changed"
- find: paths='/tmp' patterns="Ratings.png"
register: find_results
- assert: { that: "find_results['matched'] == 1" }
- name: Do not delete container that has blobs
azure_rm_storageblob:
resource_group: "{{ resource_group }}"
account_name: testgroup03blobs
container_name: my-blobs
state: absent
register: output
- debug: var=output
when: playbook_debug
- assert:
that: "not output.changed"
- name: Delete blob object
azure_rm_storageblob:
resource_group: "{{ resource_group }}"
account_name: testgroup03blobs
container_name: my-blobs
blob: "Ratings.png"
state: absent
register: output
- debug: var=output
when: playbook_debug
- assert:
that: "output.changed"
- name: Delete container
azure_rm_storageblob:
resource_group: "{{ resource_group }}"
account_name: testgroup03blobs
container_name: my-blobs
state: absent
register: output
- debug: var=output
when: playbook_debug
- assert:
that: "output.changed"
- name: Delete storage account
azure_rm_storageaccount:
resource_group: "{{ resource_group }}"
location: "{{ location }}"
name: testgroup03blobs
state: absent
register: output
- debug: var=output
when: playbook_debug