mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 05:12:45 +00:00
Add workspace module for azure (#53731)
* add workspace * add other properties * add facts modules * add test * add doc * fix lint * fix lint * rename the module * fix docs
This commit is contained in:
5
test/integration/targets/azure_rm_workspace/aliases
Normal file
5
test/integration/targets/azure_rm_workspace/aliases
Normal file
@@ -0,0 +1,5 @@
|
||||
cloud/azure
|
||||
shippable/azure/group4
|
||||
destructive
|
||||
azure_rm_workspace
|
||||
azure_rm_workspace_facts
|
||||
@@ -0,0 +1,2 @@
|
||||
dependencies:
|
||||
- setup_azure
|
||||
128
test/integration/targets/azure_rm_workspace/tasks/main.yml
Normal file
128
test/integration/targets/azure_rm_workspace/tasks/main.yml
Normal file
@@ -0,0 +1,128 @@
|
||||
- name: Prepare random number
|
||||
set_fact:
|
||||
name: "workspace{{ resource_group | hash('md5') | truncate(7, True, '') }}{{ 1000 | random }}"
|
||||
|
||||
- name: Create workspace (check mode)
|
||||
azure_rm_loganalyticsworkspace:
|
||||
name: "{{ name }}"
|
||||
resource_group: "{{ resource_group }}"
|
||||
retention_in_days: 40
|
||||
check_mode: yes
|
||||
register: output
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- output.changed
|
||||
|
||||
- name: Get workspace
|
||||
azure_rm_loganalyticsworkspace_facts:
|
||||
name: "{{ name }}"
|
||||
resource_group: "{{ resource_group }}"
|
||||
register: facts
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- facts.workspaces | length == 0
|
||||
|
||||
- name: Create workspace
|
||||
azure_rm_loganalyticsworkspace:
|
||||
name: "{{ name }}"
|
||||
resource_group: "{{ resource_group }}"
|
||||
retention_in_days: 40
|
||||
register: output
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- output.retention_in_days == 40
|
||||
- output.changed
|
||||
- output.intelligence_packs
|
||||
|
||||
- name: Create workspace (idempontent)
|
||||
azure_rm_loganalyticsworkspace:
|
||||
name: "{{ name }}"
|
||||
resource_group: "{{ resource_group }}"
|
||||
retention_in_days: 40
|
||||
register: output
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- not output.changed
|
||||
|
||||
- name: Get workspace
|
||||
azure_rm_loganalyticsworkspace_facts:
|
||||
name: "{{ name }}"
|
||||
resource_group: "{{ resource_group }}"
|
||||
register: facts
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- facts.workspaces | length == 1
|
||||
- facts.workspaces[0].id == output.id
|
||||
|
||||
- set_fact:
|
||||
pack: "{{ pack | default({}) | combine({output.intelligence_packs[0].name: not output.intelligence_packs[0].enabled}) }}"
|
||||
|
||||
- name: Update intelligence pack
|
||||
azure_rm_loganalyticsworkspace:
|
||||
name: "{{ name }}"
|
||||
resource_group: "{{ resource_group }}"
|
||||
intelligence_packs: "{{ pack }}"
|
||||
register: intelligence
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- intelligence.intelligence_packs[0].enabled != output.intelligence_packs[0].enabled
|
||||
|
||||
- name: Remove workspace (check mode)
|
||||
azure_rm_loganalyticsworkspace:
|
||||
name: "{{ name }}"
|
||||
resource_group: "{{ resource_group }}"
|
||||
state: absent
|
||||
check_mode: yes
|
||||
register: output
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- output.changed
|
||||
|
||||
- name: Get workspace
|
||||
azure_rm_loganalyticsworkspace_facts:
|
||||
name: "{{ name }}"
|
||||
resource_group: "{{ resource_group }}"
|
||||
register: facts
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- facts.workspaces | length == 1
|
||||
|
||||
- name: Remove workspace
|
||||
azure_rm_loganalyticsworkspace:
|
||||
name: "{{ name }}"
|
||||
resource_group: "{{ resource_group }}"
|
||||
state: absent
|
||||
register: output
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- output.changed
|
||||
|
||||
- name: Get workspace
|
||||
azure_rm_loganalyticsworkspace_facts:
|
||||
name: "{{ name }}"
|
||||
resource_group: "{{ resource_group }}"
|
||||
register: facts
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- facts.workspaces | length == 0
|
||||
|
||||
- name: Remove workspace (idempontent)
|
||||
azure_rm_loganalyticsworkspace:
|
||||
name: "{{ name }}"
|
||||
resource_group: "{{ resource_group }}"
|
||||
state: absent
|
||||
register: output
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- not output.changed
|
||||
@@ -32,3 +32,4 @@ azure-graphrbac==0.40.0
|
||||
azure-mgmt-cosmosdb==0.5.2
|
||||
azure-mgmt-hdinsight==0.1.0
|
||||
azure-mgmt-devtestlabs==3.0.0
|
||||
azure-mgmt-loganalytics==0.2.0
|
||||
|
||||
Reference in New Issue
Block a user