dc6c0cb9f8
* add workspace * add other properties * add facts modules * add test * add doc * fix lint * fix lint * rename the module * fix docs
128 lines
3 KiB
YAML
128 lines
3 KiB
YAML
- 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
|