make artifacts conditional (#52975)
This commit is contained in:
parent
c4926db774
commit
0b1cfa52e6
1 changed files with 77 additions and 63 deletions
|
@ -173,51 +173,69 @@
|
|||
- output.virtualnetworks[0]['description'] != None
|
||||
- output.virtualnetworks[0]['provisioning_state'] != None
|
||||
|
||||
#- name: Create instance of DevTest Labs artifacts source
|
||||
# azure_rm_devtestlabartifactsource:
|
||||
# resource_group: "{{ resource_group }}"
|
||||
# lab_name: "{{ lab_name }}"
|
||||
# name: "{{ artifacts_name }}"
|
||||
# uri: https://github.com/Azure/azure_preview_modules.git
|
||||
# source_type: github
|
||||
# folder_path: /tasks
|
||||
# security_token: "{{ github_token }}"
|
||||
# register: output
|
||||
#- name: Assert if the change was correctly reported
|
||||
# assert:
|
||||
# that:
|
||||
# - output.changed
|
||||
- name: Create instance of DevTest Labs artifacts source
|
||||
azure_rm_devtestlabartifactsource:
|
||||
resource_group: "{{ resource_group }}"
|
||||
lab_name: "{{ lab_name }}"
|
||||
name: "{{ artifacts_name }}"
|
||||
uri: https://github.com/Azure/azure_preview_modules.git
|
||||
source_type: github
|
||||
folder_path: /tasks
|
||||
security_token: "{{ github_token }}"
|
||||
register: output
|
||||
when: "github_token | length > 0"
|
||||
- name: Assert if the change was correctly reported
|
||||
assert:
|
||||
that:
|
||||
- output.changed
|
||||
when: "github_token | length > 0"
|
||||
|
||||
#- name: Update instance of DevTest Labs artifacts source with same parameters
|
||||
# azure_rm_devtestlabartifactsource:
|
||||
# resource_group: "{{ resource_group }}"
|
||||
# lab_name: "{{ lab_name }}"
|
||||
# name: "{{ artifacts_name }}"
|
||||
# uri: https://github.com/Azure/azure_preview_modules.git
|
||||
# source_type: github
|
||||
# folder_path: /tasks
|
||||
# security_token: "{{ github_token }}"
|
||||
# register: output
|
||||
#- name: Assert that nothing was changed
|
||||
# assert:
|
||||
# that:
|
||||
# - output.changed == false
|
||||
- name: Update instance of DevTest Labs artifacts source with same parameters
|
||||
azure_rm_devtestlabartifactsource:
|
||||
resource_group: "{{ resource_group }}"
|
||||
lab_name: "{{ lab_name }}"
|
||||
name: "{{ artifacts_name }}"
|
||||
uri: https://github.com/Azure/azure_preview_modules.git
|
||||
source_type: github
|
||||
folder_path: /tasks
|
||||
security_token: "{{ github_token }}"
|
||||
register: output
|
||||
when: "github_token | length > 0"
|
||||
- name: Assert that nothing was changed
|
||||
assert:
|
||||
that:
|
||||
- output.changed == false
|
||||
when: "github_token | length > 0"
|
||||
|
||||
#- name: Update instance of DevTest Labs artifacts source, add display name, change folder
|
||||
# azure_rm_devtestlabartifactsource:
|
||||
# resource_group: "{{ resource_group }}"
|
||||
# lab_name: "{{ lab_name }}"
|
||||
# name: "{{ artifacts_name }}"
|
||||
# uri: https://github.com/Azure/azure_preview_modules.git
|
||||
# source_type: github
|
||||
# folder_path: /library
|
||||
# security_token: "{{ github_token }}"
|
||||
# display_name: My Artifacts Source
|
||||
# register: output
|
||||
#- name: Assert that nothing was changed
|
||||
# assert:
|
||||
# that:
|
||||
# - output.changed
|
||||
- name: Update instance of DevTest Labs artifacts source, add display name, change folder
|
||||
azure_rm_devtestlabartifactsource:
|
||||
resource_group: "{{ resource_group }}"
|
||||
lab_name: "{{ lab_name }}"
|
||||
name: "{{ artifacts_name }}"
|
||||
uri: https://github.com/Azure/azure_preview_modules.git
|
||||
source_type: github
|
||||
folder_path: /library
|
||||
security_token: "{{ github_token }}"
|
||||
display_name: My Artifacts Source
|
||||
register: output
|
||||
when: "github_token | length > 0"
|
||||
- name: Assert that nothing was changed
|
||||
assert:
|
||||
that:
|
||||
- output.changed
|
||||
when: "github_token | length > 0"
|
||||
|
||||
- name:
|
||||
set_fact:
|
||||
artifact_source:
|
||||
- source_name: "{{ artifacts_name }}"
|
||||
source_path: "/Artifacts/linux-install-mongodb"
|
||||
when: "github_token | length > 0"
|
||||
|
||||
- name:
|
||||
set_fact:
|
||||
artifact_source: null
|
||||
when: "github_token | length == 0"
|
||||
|
||||
- name: Create instance of DTL Virtual Machine
|
||||
azure_rm_devtestlabvirtualmachine:
|
||||
|
@ -239,9 +257,7 @@
|
|||
sku: 16.04-LTS
|
||||
os_type: Linux
|
||||
version: latest
|
||||
# artifacts:
|
||||
# - source_name: "{{ artifacts_name }}"
|
||||
# source_path: "/Artifacts/linux-install-mongodb"
|
||||
artifacts: "{{ artifact_source }}"
|
||||
allow_claim: no
|
||||
expiration_date: "2029-02-22T01:49:12.117974Z"
|
||||
register: output
|
||||
|
@ -271,9 +287,7 @@
|
|||
sku: 16.04-LTS
|
||||
os_type: Linux
|
||||
version: latest
|
||||
# artifacts:
|
||||
# - source_name: "{{ artifacts_name }}"
|
||||
# source_path: "/Artifacts/linux-install-mongodb"
|
||||
artifacts: "{{ artifact_source }}"
|
||||
allow_claim: no
|
||||
expiration_date: "2029-02-22T01:49:12.117974Z"
|
||||
register: output
|
||||
|
@ -303,9 +317,7 @@
|
|||
sku: 16.04-LTS
|
||||
os_type: Linux
|
||||
version: latest
|
||||
# artifacts:
|
||||
# - source_name: "{{ artifacts_name }}"
|
||||
# source_path: "/Artifacts/linux-install-mongodb"
|
||||
artifacts: "{{ artifact_source }}"
|
||||
allow_claim: no
|
||||
expiration_date: "2029-02-22T01:49:12.117974Z"
|
||||
register: output
|
||||
|
@ -370,17 +382,19 @@
|
|||
- output.virtualmachines[0]['user_name'] != None
|
||||
- output.virtualmachines[0]['vm_size'] != None
|
||||
|
||||
#- name: Delete instance of DevTest Labs artifacts source
|
||||
# azure_rm_devtestlabartifactsource:
|
||||
# resource_group: "{{ resource_group }}"
|
||||
# lab_name: "{{ lab_name }}"
|
||||
# name: "{{ artifacts_name }}"
|
||||
# state: absent
|
||||
# register: output
|
||||
#- name: Assert that change was correctly registered
|
||||
# assert:
|
||||
# that:
|
||||
# - output.changed
|
||||
- name: Delete instance of DevTest Labs artifacts source
|
||||
azure_rm_devtestlabartifactsource:
|
||||
resource_group: "{{ resource_group }}"
|
||||
lab_name: "{{ lab_name }}"
|
||||
name: "{{ artifacts_name }}"
|
||||
state: absent
|
||||
register: output
|
||||
when: "github_token | length > 0"
|
||||
- name: Assert that change was correctly registered
|
||||
assert:
|
||||
that:
|
||||
- output.changed
|
||||
when: "github_token | length > 0"
|
||||
|
||||
- name: Delete instance of Lab -- check mode
|
||||
azure_rm_devtestlab:
|
||||
|
|
Loading…
Reference in a new issue