You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/test/integration/targets/azure_rm_containerregistry/tasks/main.yml

117 lines
4.1 KiB
YAML

- name: Create an container registry
azure_rm_containerregistry:
name: "acr{{ resource_group | hash('md5') | truncate(7, True, '') }}"
resource_group: "{{ resource_group }}"
location: eastus2
admin_user_enabled: true
sku: Premium
tags:
Release: beta1
Environment: Production
register: output
- name: Assert the container registry instance is well created
assert:
that:
- output.changed
- output.admin_user_enabled
- output.location == 'eastus2'
- output.sku == 'Premium'
- output.tags['Environment'] == 'Production'
- output.tags['Release'] == 'beta1'
- output.provisioning_state == 'Succeeded'
- output.credentials['password'] is defined
- output.credentials['password2'] is defined
- name: Update the ACR instance sku, tags and admin_user_enabled
azure_rm_containerregistry:
name: "acr{{ resource_group | hash('md5') | truncate(7, True, '') }}"
resource_group: "{{ resource_group }}"
location: eastus2
admin_user_enabled: false
sku: Standard
tags:
NewTag: newtag
Release: beta1
Environment: Production
register: output
- name: Create second container registry (to test facts)
azure_rm_containerregistry:
name: "acr{{ resource_group | hash('md5') | truncate(7, True, '') }}sec"
resource_group: "{{ resource_group }}"
location: eastus2
admin_user_enabled: false
sku: Premium
tags:
Release: beta1
Environment: Production
- name: Assert the ACR instance is well updated
assert:
that:
- output.changed == True
- output.admin_user_enabled == False
- output.sku == 'Standard'
- output.tags['NewTag'] == 'newtag'
- output.credentials | length == 0
- output.credentials['password'] is not defined
- output.credentials['password2'] is not defined
- name: Gather facts for single Container Registry
azure_rm_containerregistry_info:
resource_group: "{{ resource_group }}"
name: "acr{{ resource_group | hash('md5') | truncate(7, True, '') }}"
register: output
- name: Assert that facts are returned
assert:
that:
- output.changed == False
- output.registries[0]['name'] != None
- output.registries[0]['location'] != None
- output.registries[0]['admin_user_enabled'] != None
- output.registries[0]['sku'] != None
- output.registries[0]['provisioning_state'] != None
- output.registries[0]['login_server'] != None
- output.registries[0]['id'] != None
- output.registries[0]['credentials'] != None
- name: Gather facts for all Container Registries in the resource group
azure_rm_containerregistry_info:
resource_group: "{{ resource_group }}"
register: output
- name: Assert that facts are returned
assert:
that:
- output.changed == False
- output.registries[0]['name'] != None
- output.registries[0]['location'] != None
- output.registries[0]['admin_user_enabled'] != None
- output.registries[0]['sku'] != None
- output.registries[0]['provisioning_state'] != None
- output.registries[0]['login_server'] != None
- output.registries[0]['id'] != None
- output.registries[0]['credentials'] != None
- output.registries[1]['name'] != None
- output.registries[1]['location'] != None
- output.registries[1]['admin_user_enabled'] != None
- output.registries[1]['sku'] != None
- output.registries[1]['provisioning_state'] != None
- output.registries[1]['login_server'] != None
- output.registries[1]['id'] != None
- output.registries[1]['credentials'] != None
- name: Delete first container registry
azure_rm_containerregistry:
name: "acr{{ resource_group | hash('md5') | truncate(7, True, '') }}"
resource_group: "{{ resource_group }}"
state: absent
- name: Delete second container registry
azure_rm_containerregistry:
name: "acr{{ resource_group | hash('md5') | truncate(7, True, '') }}sec"
resource_group: "{{ resource_group }}"
state: absent