ansible/test/integration/targets/azure_rm_automationaccount/tasks/main.yml
Yuwei Zhou 1c06b302bc Support automation account managment (#56429)
* add automation account

* add test

* update sdk version

* fix doc

* Update azure_rm_automationaccount.py

* Update azure_rm_automationaccount_facts.py

* Update main.yml

* add type define (#64)

* add new (#67)

* change 'example' to 'sample'

* changed 'path' to 'ID'
2019-08-27 07:38:47 +08:00

88 lines
2 KiB
YAML

- name: Prepare random number
set_fact:
rpfx: "{{ resource_group | hash('md5') | truncate(7, True, '') }}{{ 1000 | random }}"
name: "account{{ resource_group | hash('md5') | truncate(7, True, '') }}{{ 1000 | random }}"
run_once: yes
- name: Create automation account
azure_rm_automationaccount:
name: "{{ name }}"
resource_group: "{{ resource_group }}"
check_mode: yes
register: output
- assert:
that:
- output.changed
- name: Create automation account
azure_rm_automationaccount:
name: "{{ name }}"
resource_group: "{{ resource_group }}"
register: output
- assert:
that:
- output.changed
- output.id
- name: Create automation account
azure_rm_automationaccount:
name: "{{ name }}"
resource_group: "{{ resource_group }}"
register: output
- assert:
that:
- not output.changed
- name: Get automation account
azure_rm_automationaccount_facts:
name: "{{ name }}"
resource_group: "{{ resource_group }}"
list_statistics: yes
list_usages: yes
list_keys: yes
register: facts
- assert:
that:
- facts.automation_accounts | length == 1
- facts.automation_accounts[0].keys
- facts.automation_accounts[0].usages
- facts.automation_accounts[0].statistics
- facts.automation_accounts[0].state == "Ok"
- name: Delete account
azure_rm_automationaccount:
name: "{{ name }}"
resource_group: "{{ resource_group }}"
state: absent
check_mode: yes
register: output
- assert:
that:
- output.changed
- name: Delete account
azure_rm_automationaccount:
name: "{{ name }}"
resource_group: "{{ resource_group }}"
state: absent
register: output
- assert:
that:
- output.changed
- name: Delete account
azure_rm_automationaccount:
name: "{{ name }}"
resource_group: "{{ resource_group }}"
state: absent
register: output
- assert:
that:
- not output.changed