@ -209,7 +209,7 @@
- assert:
- assert:
that:
that:
- local_duplicate_gid_result['results'][0] is success
- local_duplicate_gid_result['results'][0] is success
- local_duplicate_gid_result['results'][1]['msg'] == "GID '1337' already exists "
- local_duplicate_gid_result['results'][1]['msg'] == "GID '1337' already exists with group 'group1_local_test' "
always:
always:
- name : Cleanup
- name : Cleanup
group:
group:
@ -217,3 +217,44 @@
state : absent
state : absent
# only applicable to Linux, limit further to CentOS where 'luseradd' is installed
# only applicable to Linux, limit further to CentOS where 'luseradd' is installed
when : ansible_distribution == 'CentOS'
when : ansible_distribution == 'CentOS'
# https://github.com/ansible/ansible/pull/59769
- block:
- name : create a local group with a gid
group:
name : group1_local_test
gid : 1337
local : yes
state : present
register : create_local_group_gid
- name : get gid of created local group
command : "{{ ansible_python_interpreter | quote }} -c \"import grp; print(grp.getgrnam('group1_local_test').gr_gid)\""
register : create_local_group_gid_actual
- name : assert create local group with a gid
assert:
that:
- create_local_group_gid is changed
- create_local_group_gid.gid | int == 1337 | int
- create_local_group_gid_actual.stdout | trim | int == 1337 | int
- name : create a local group with a gid (idempotent)
group:
name : group1_local_test
gid : 1337
state : present
register : create_local_group_gid_again
- name : assert create local group with a gid (idempotent)
assert:
that:
- not create_local_group_gid_again is changed
- create_local_group_gid_again.gid | int == 1337 | int
always:
- name : Cleanup create local group with a gid
group:
name : group1_local_test
state : absent
# only applicable to Linux, limit further to CentOS where 'luseradd' is installed
when : ansible_distribution == 'CentOS'