From 9356f0ecd846923560b3248c571de07093ae5e71 Mon Sep 17 00:00:00 2001 From: Mario Lenz Date: Tue, 26 Dec 2023 16:24:26 +0100 Subject: [PATCH 1/2] vcenter_root_password_expiration: Add integration test --- .../vcenter_root_password_expiration/aliases | 3 +++ .../tasks/main.yml | 22 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 tests/integration/targets/vcenter_root_password_expiration/aliases create mode 100644 tests/integration/targets/vcenter_root_password_expiration/tasks/main.yml diff --git a/tests/integration/targets/vcenter_root_password_expiration/aliases b/tests/integration/targets/vcenter_root_password_expiration/aliases new file mode 100644 index 000000000..b1682114e --- /dev/null +++ b/tests/integration/targets/vcenter_root_password_expiration/aliases @@ -0,0 +1,3 @@ +cloud/vcenter +needs/target/prepare_vmware_tests +zuul/vmware/vcenter_only diff --git a/tests/integration/targets/vcenter_root_password_expiration/tasks/main.yml b/tests/integration/targets/vcenter_root_password_expiration/tasks/main.yml new file mode 100644 index 000000000..349ab9fa5 --- /dev/null +++ b/tests/integration/targets/vcenter_root_password_expiration/tasks/main.yml @@ -0,0 +1,22 @@ +# Test code for the vcenter_root_password_expiration module. +# Copyright: (c) 2023, Mario Lenz +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +- import_role: + name: prepare_vmware_tests + +- name: Set vCenter root password expiration + vcenter_root_password_expiration: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + state: present + max_days_between_password_change: 93 + min_days_between_password_change: 7 + warn_days_before_password_expiration: 22 + validate_certs: false + register: pw_expiration + +- assert: + that: + - pw_expiration is changed From 6a1171267e82467bd4e0a123340b132d340df44d Mon Sep 17 00:00:00 2001 From: Mario Lenz Date: Wed, 27 Dec 2023 17:56:57 +0100 Subject: [PATCH 2/2] Add email parameter --- .../targets/vcenter_root_password_expiration/tasks/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/integration/targets/vcenter_root_password_expiration/tasks/main.yml b/tests/integration/targets/vcenter_root_password_expiration/tasks/main.yml index 349ab9fa5..e80baf9c9 100644 --- a/tests/integration/targets/vcenter_root_password_expiration/tasks/main.yml +++ b/tests/integration/targets/vcenter_root_password_expiration/tasks/main.yml @@ -11,6 +11,7 @@ username: "{{ vcenter_username }}" password: "{{ vcenter_password }}" state: present + email: "vCenter-Admin@community.vmware.example" max_days_between_password_change: 93 min_days_between_password_change: 7 warn_days_before_password_expiration: 22