make artifacts conditional (#52975)

This commit is contained in:
Zim Kalinowski 2019-02-26 17:12:15 +08:00 committed by GitHub
parent c4926db774
commit 0b1cfa52e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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