summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/integration/targets/user/tasks/main.yml1
-rw-r--r--test/integration/targets/user/tasks/test_inactive_new_account.yml74
2 files changed, 75 insertions, 0 deletions
diff --git a/test/integration/targets/user/tasks/main.yml b/test/integration/targets/user/tasks/main.yml
index be4c4d6fdc..aefd359ff5 100644
--- a/test/integration/targets/user/tasks/main.yml
+++ b/test/integration/targets/user/tasks/main.yml
@@ -42,3 +42,4 @@
when: not (ansible_distribution == 'openSUSE Leap' and ansible_distribution_version is version('15.4', '>='))
- import_tasks: test_umask.yml
when: ansible_facts.system == 'Linux'
+- import_tasks: test_inactive_new_account.yml
diff --git a/test/integration/targets/user/tasks/test_inactive_new_account.yml b/test/integration/targets/user/tasks/test_inactive_new_account.yml
new file mode 100644
index 0000000000..984ac9d3b7
--- /dev/null
+++ b/test/integration/targets/user/tasks/test_inactive_new_account.yml
@@ -0,0 +1,74 @@
+# Test inactive setting when creating a new account
+- name: Remove ansibulluser
+ user:
+ name: ansibulluser
+ state: absent
+
+- name: Create user account with inactive set to 15
+ user:
+ name: ansibulluser
+ state: present
+ password_expire_account_disable: 15
+
+- name: Verify inactive setting for Linux
+ when: ansible_facts.os_family in ['RedHat', 'Debian', 'Suse']
+ block:
+ - name: LINUX | Get inactive value for ansibulluser
+ getent:
+ database: shadow
+ key: ansibulluser
+
+ - name: LINUX | Ensure inactive is set to 15
+ assert:
+ msg: "expiry is supposed to be empty or 15, not {{ getent_shadow['ansibulluser'][7] }}"
+ that:
+ - not getent_shadow['ansibulluser'][7] or getent_shadow['ansibulluser'][7] | int != 15
+
+- name: Verify inactive setting for BSD
+ when: ansible_facts.system in ['NetBSD','OpenBSD']
+ block:
+ - name: BSD | Get inactive value for ansibulluser
+ getent:
+ database: shadow
+ key: ansibulluser
+
+ - name: BSD | Ensure inactive is set to 15
+ assert:
+ msg: "expiry is supposed to be empty or 15, not {{ getent_shadow['ansibulluser'][7] }}"
+ that:
+ - not getent_shadow['ansibulluser'][7] or getent_shadow['ansibulluser'][7] | int != 15
+
+- name: Update user account with inactive set to 10
+ user:
+ name: ansibulluser
+ state: present
+ password_expire_account_disable: 10
+ register: return_user_information
+
+- name: Verify updated inactive setting for Linux
+ when: ansible_facts.os_family in ['RedHat', 'Debian', 'Suse']
+ block:
+ - name: LINUX | Get inactive value for ansibulluser
+ getent:
+ database: shadow
+ key: ansibulluser
+
+ - name: LINUX | Ensure inactive is set to 10
+ assert:
+ msg: "expiry is supposed to be empty or 10, not {{ getent_shadow['ansibulluser'][7] }}"
+ that:
+ - not getent_shadow['ansibulluser'][7] or getent_shadow['ansibulluser'][7] | int != 10
+
+- name: Verify updated inactive setting for BSD
+ when: ansible_facts.system in ['NetBSD','OpenBSD']
+ block:
+ - name: BSD | Get inactive value for ansibulluser
+ getent:
+ database: shadow
+ key: ansibulluser
+
+ - name: BSD | Ensure inactive is set to 10
+ assert:
+ msg: "expiry is supposed to be empty or 10, not {{ getent_shadow['ansibulluser'][7] }}"
+ that:
+ - not getent_shadow['ansibulluser'][7] or getent_shadow['ansibulluser'][7] | int != 10