ignore seuser on alpine

pull/85649/head
lum7na 4 months ago
parent 45d62a726c
commit b01d0d8c76

@ -0,0 +1,2 @@
bugfixes:
- user - The seuser parameter will be ignored on Alpine and print warning

@ -44,6 +44,7 @@ options:
seuser:
description:
- Optionally sets the C(seuser) type C(user_u) on SELinux enabled systems.
- This parameter will be ignored on Alpine and Buildroot.
type: str
version_added: "2.1"
group:
@ -3164,6 +3165,9 @@ class BusyBox(User):
cmd.append('-K')
cmd.append('UID_MAX=' + str(self.uid_max))
if self.seuser is not None:
self.module.warn(f"The 'seuser' parameter is not supported on {self.distribution} as it lacks SELinux support and has been ignored.")
cmd.append(self.name)
rc, out, err = self.execute_command(cmd)

@ -34,3 +34,6 @@
- ansible_facts.system == 'Linux'
- ansible_distribution != 'Alpine'
- import_tasks: ssh_keygen.yml
- import_tasks: test_seuser.yml
when:
- ansible_distribution == 'Alpine'

@ -0,0 +1,10 @@
- name: Try creating user with nonexistent SELinux user
user:
name: badseuser
seuser: nonexistent_u
state: present
register: test_seuser
- name: there should be warnings
assert:
that: "'warnings' in test_seuser"
Loading…
Cancel
Save