mirror of
https://opendev.org/openstack/ansible-collections-openstack.git
synced 2026-05-08 06:13:13 +00:00
Update identity_group for 2.0.0
Replace calls to the sdk cloud layer with proxy layer calls where appropriate. Ensure module return values are converted into dict. General refactoring to bring module more in line with collection conventions. Expand tests to assert idempotency and presence of return values. Rename test role to identity_group to match module name. Change-Id: I06fe28f77431bb151d85c8d9cd924a1634d85d98
This commit is contained in:
committed by
Jakob Meng
parent
d0eb83e934
commit
5e7c29d97e
@@ -1 +0,0 @@
|
||||
group_name: ansible_group
|
||||
@@ -1,19 +0,0 @@
|
||||
---
|
||||
- name: Create group
|
||||
openstack.cloud.identity_group:
|
||||
cloud: "{{ cloud }}"
|
||||
state: present
|
||||
name: "{{ group_name }}"
|
||||
|
||||
- name: Update group
|
||||
openstack.cloud.identity_group:
|
||||
cloud: "{{ cloud }}"
|
||||
state: present
|
||||
name: "{{ group_name }}"
|
||||
description: "updated description"
|
||||
|
||||
- name: Delete group
|
||||
openstack.cloud.identity_group:
|
||||
cloud: "{{ cloud }}"
|
||||
state: absent
|
||||
name: "{{ group_name }}"
|
||||
7
ci/roles/identity_group/defaults/main.yml
Normal file
7
ci/roles/identity_group/defaults/main.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
group_name: ansible_group
|
||||
domain_name: ansible_domain
|
||||
expected_fields:
|
||||
- description
|
||||
- domain_id
|
||||
- id
|
||||
- name
|
||||
138
ci/roles/identity_group/tasks/main.yml
Normal file
138
ci/roles/identity_group/tasks/main.yml
Normal file
@@ -0,0 +1,138 @@
|
||||
---
|
||||
- name: Create domain
|
||||
openstack.cloud.identity_domain:
|
||||
cloud: "{{ cloud }}"
|
||||
state: present
|
||||
name: "{{ domain_name }}"
|
||||
register: domain
|
||||
|
||||
- name: Create group
|
||||
openstack.cloud.identity_group:
|
||||
cloud: "{{ cloud }}"
|
||||
state: present
|
||||
name: "{{ group_name }}"
|
||||
register: group_result
|
||||
|
||||
- name: Assert changed
|
||||
assert:
|
||||
that: group_result is changed
|
||||
|
||||
- name: Assert returned fields
|
||||
assert:
|
||||
that: item in group_result.group
|
||||
loop: "{{ expected_fields }}"
|
||||
|
||||
- name: Create group again
|
||||
openstack.cloud.identity_group:
|
||||
cloud: "{{ cloud }}"
|
||||
state: present
|
||||
name: "{{ group_name }}"
|
||||
register: group_result
|
||||
|
||||
- name: Assert not changed
|
||||
assert:
|
||||
that: group_result is not changed
|
||||
|
||||
- name: Update group
|
||||
openstack.cloud.identity_group:
|
||||
cloud: "{{ cloud }}"
|
||||
state: present
|
||||
name: "{{ group_name }}"
|
||||
description: "updated description"
|
||||
register: group_result
|
||||
|
||||
- name: Assert changed
|
||||
assert:
|
||||
that:
|
||||
- group_result is changed
|
||||
- group_result.group.description == "updated description"
|
||||
|
||||
- name: Create group in specific domain
|
||||
openstack.cloud.identity_group:
|
||||
cloud: "{{ cloud }}"
|
||||
state: present
|
||||
name: "{{ group_name }}"
|
||||
domain_id: "{{ domain.id }}"
|
||||
register: group_result
|
||||
|
||||
- name: Assert results
|
||||
assert:
|
||||
that:
|
||||
- group_result is changed
|
||||
- group_result.group.domain_id == domain.id
|
||||
|
||||
- name: Create group in specific domain again
|
||||
openstack.cloud.identity_group:
|
||||
cloud: "{{ cloud }}"
|
||||
state: present
|
||||
name: "{{ group_name }}"
|
||||
domain_id: "{{ domain.id }}"
|
||||
register: group_result
|
||||
|
||||
- name: Assert not changed
|
||||
assert:
|
||||
that: group_result is not changed
|
||||
|
||||
- name: Delete ambiguous domain
|
||||
openstack.cloud.identity_group:
|
||||
cloud: "{{ cloud }}"
|
||||
state: absent
|
||||
name: "{{ group_name }}"
|
||||
ignore_errors: true
|
||||
register: group_result
|
||||
|
||||
- name: Assert failed
|
||||
assert:
|
||||
that: group_result is failed
|
||||
|
||||
- name: Delete group in specific domain
|
||||
openstack.cloud.identity_group:
|
||||
cloud: "{{ cloud }}"
|
||||
state: absent
|
||||
name: "{{ group_name }}"
|
||||
domain_id: "{{ domain.id }}"
|
||||
register: group_result
|
||||
|
||||
- name: Assert changed
|
||||
assert:
|
||||
that: group_result is changed
|
||||
|
||||
- name: Delete group in specific domain again
|
||||
openstack.cloud.identity_group:
|
||||
cloud: "{{ cloud }}"
|
||||
state: absent
|
||||
name: "{{ group_name }}"
|
||||
domain_id: "{{ domain.id }}"
|
||||
register: group_result
|
||||
|
||||
- name: Assert not changed
|
||||
assert:
|
||||
that: group_result is not changed
|
||||
|
||||
- name: Delete group
|
||||
openstack.cloud.identity_group:
|
||||
cloud: "{{ cloud }}"
|
||||
state: absent
|
||||
name: "{{ group_name }}"
|
||||
register: group_result
|
||||
|
||||
- name: Assert changed
|
||||
assert:
|
||||
that: group_result is changed
|
||||
|
||||
- name: Delete group again
|
||||
openstack.cloud.identity_group:
|
||||
cloud: "{{ cloud }}"
|
||||
state: absent
|
||||
name: "{{ group_name }}"
|
||||
register: group_result
|
||||
|
||||
- name: Assert not changed
|
||||
assert:
|
||||
that: group_result is not changed
|
||||
|
||||
- name: Delete domain
|
||||
openstack.cloud.identity_domain:
|
||||
cloud: "{{ cloud }}"
|
||||
state: absent
|
||||
name: "{{ domain_name }}"
|
||||
@@ -12,7 +12,6 @@
|
||||
- role: object_container
|
||||
tags: object_container
|
||||
when: sdk_version is version(0.18, '>=')
|
||||
- { role: group, tags: group }
|
||||
- role: dns
|
||||
tags: dns
|
||||
when: sdk_version is version(0.28, '>=')
|
||||
@@ -20,6 +19,7 @@
|
||||
- { role: floating_ip_info, tags: floating_ip_info }
|
||||
- { role: host_aggregate, tags: host_aggregate }
|
||||
- { role: identity_domain_info, tags: identity_domain_info }
|
||||
- { role: identity_group, tags: identity_group }
|
||||
- { role: identity_group_info, tags: identity_group_info }
|
||||
- { role: identity_user, tags: identity_user }
|
||||
- { role: identity_user_info, tags: identity_user_info }
|
||||
|
||||
Reference in New Issue
Block a user