You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/test/integration/targets/azure_rm_workspace/tasks/main.yml

129 lines
3.0 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