mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
Add backup feature to user module (#41854)
* Add backup option * Only backup shadow file when the OS has one * Only backup shadow file for SunOS * Update docs on backup feature * Add changelog fragment * Add tests for shadow backup * Remove backup option, make it automatic Remove the option to enable/disable backups and make it automatic. Add note to docs describing this behavior. Change tests to account for new module behavior. Change section name in changelog fragment since minor_features is not a valid section.
This commit is contained in:
@@ -386,3 +386,26 @@
|
||||
that:
|
||||
- bsd_account_expiration.stdout == '0'
|
||||
when: ansible_os_family == 'FreeBSD'
|
||||
|
||||
|
||||
## shadow backup
|
||||
- block:
|
||||
- name: Create a user to test shadow file backup
|
||||
user:
|
||||
name: ansibulluser
|
||||
state: present
|
||||
register: result
|
||||
|
||||
- name: Find shadow backup files
|
||||
find:
|
||||
path: /etc
|
||||
patterns: 'shadow\..*~$'
|
||||
use_regex: yes
|
||||
register: shadow_backups
|
||||
|
||||
- name: Assert that a backup file was created
|
||||
assert:
|
||||
that:
|
||||
- result.bakup
|
||||
- shadow_backups.files | map(attribute='path') | list | length > 0
|
||||
when: ansible_os_family == 'Solaris'
|
||||
|
||||
Reference in New Issue
Block a user