mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 05:10:22 -07: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:
parent
0971a342d8
commit
00e7c020b2
3 changed files with 33 additions and 0 deletions
|
@ -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'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue