2017-12-07 05:30:28 +01:00
|
|
|
- name: Create an container registry
|
|
|
|
azure_rm_containerregistry:
|
|
|
|
name: "acr{{ resource_group | hash('md5') | truncate(7, True, '') }}"
|
|
|
|
resource_group: "{{ resource_group }}"
|
|
|
|
location: eastus2
|
|
|
|
state: present
|
|
|
|
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
|
|
|
|
|
2018-08-30 11:56:12 +02:00
|
|
|
- name: Update the ACR instance sku, tags and admin_user_enabled
|
2017-12-07 05:30:28 +01:00
|
|
|
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
|
|
|
|
|
2018-08-30 11:56:12 +02:00
|
|
|
- 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
|
|
|
|
state: present
|
|
|
|
admin_user_enabled: false
|
|
|
|
sku: Premium
|
|
|
|
tags:
|
|
|
|
Release: beta1
|
|
|
|
Environment: Production
|
|
|
|
|
|
|
|
- name: Assert the ACR instance is well updated
|
2017-12-07 05:30:28 +01:00
|
|
|
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
|
|
|
|
|
2018-08-30 11:56:12 +02:00
|
|
|
- name: Gather facts for single Container Registry
|
|
|
|
azure_rm_containerregistry_facts:
|
|
|
|
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_facts:
|
|
|
|
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
|
2017-12-07 05:30:28 +01:00
|
|
|
azure_rm_containerregistry:
|
|
|
|
name: "acr{{ resource_group | hash('md5') | truncate(7, True, '') }}"
|
|
|
|
resource_group: "{{ resource_group }}"
|
2018-08-30 11:56:12 +02:00
|
|
|
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
|