VCenter appliance root password expiration set module name & playbook issue

VCenter appliance root password expiration set module name & playbook issue

Hi Team,

Please share me module name for “VCenter appliance root password expiration set”.
Getting “ERROR! couldn’t resolve module/action ‘vmware.vmware_rest’. This often indicates a misspelling, missing collection, or incorrect module path.”

  • hosts: localhost
    name: VC Root Password Expiration Set
    gather_facts: false
    vars_files: …/answerfile.ymltasks:
    • name: Password Expiration Set
      vmware.vmware_rest:
      hostname: “{{ vcenter_hostname }}”
      username: “{{ vcenter_username }}”
      password: “{{ vcenter_password }}”
      validate_certs: no
      #max_days_between_password_change: 9999
      #min_days_between_password_change: 6
      #warn_days_before_password_expiration: 7
      root_password_expires: “{{ expire_password }}”
      root_password_expire_days: “{{ password_expiration_days }}”
      state: present
      delegate_to: localhost

Is the collection installed? You can check this like this:

ansible-galaxy collection list | grep -e ^vmware.vmware_rest
vmware.vmware_rest            2.3.1  
2 Likes

Hi,

vmware.vmware_rest is a collection, not a module. Also, you’re missing tasks keyword in your play.

Edit: I don’t know how familiar you are with Ansible, but for clarification, a task refers to a module, which would be part of a collection.
Here vmware.vmware_rest is the collection namespace, and contains different modules (as well as plugins and perhaps roles), such as vmware.vmware_rest.vcenter_vm, which you could use in a task to create a VM, for example.

Edit 2: I think community.vmware.vcenter_root_password_expiration module would be a good fit for your needs, assuming I understand correctly what you’re trying to achieve.

4 Likes

yes chris…it is installed . The below are the output.
root@ubuntu-virtual-machine:~# ansible-galaxy collection list | grep -e ^vmware.vmware_rest
vmware.vmware_rest 2.2.0
root@ubuntu-virtual-machine:~#

1 Like

Hi Pierre,

Answer your first question : Yes , Im new to Ansible …I’m just started learning.

Answer to your second question : I’m going to achieve here is, I will set VCenter appliance root password expiration to 9999 days.
by default 90 days …Could you please review my play book ?

I’ve change to “community.vmware.vcenter_root_password_expiration” but still getting the same error.

ERROR! couldn’t resolve module/action ‘community.vmware.vcenter_root_password_expiration’. This often indicates a misspelling, missing collection, or incorrect module path.

The error appears to be in ‘/home/kkrishnasamy/VCenter_deploy_playbook/playbooks/04-VC-RootPWD-expiration-Set.yml’: line 8, column 8, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

** tasks:**
** - name: Password Expiration Set**
** ^ here**

Could you also share your playbook ? As a side note, consider using fenced code blocks for better readability :slight_smile:

2 Likes

Hi Pierre,

Please find my playbook.


  • hosts: localhost
    name: VC Root Password Expiration Set
    gather_facts: false
    vars_files: …/answerfile.yml

    tasks:

    • name: Password Expiration Set
      vcenter_root_password_expiration:
      hostname: “{{ vcenter_hostname }}”
      username: “{{ vcenter_username }}”
      password: “{{ vcenter_password }}”
      validate_certs: no
      #max_days_between_password_change: 9999
      #min_days_between_password_change: 6
      #warn_days_before_password_expiration: 7
      root_password_expires: “{{ expire_password }}”
      root_password_expire_days: “{{ password_expiration_days }}”
      state: present
      delegate_to: localhost

Thanks ! Though you haven’t used a code block, so I can’t tell if you used correct indentation, as I suspect your issue lies there. Could you edit your post to paste your playbook content into one of those ?

2 Likes

Hi Pierre,

Yes, I’m not using code block.

Please find my playbook.


  • hosts: localhost
    name: VC Root Password Expiration Set
    gather_facts: false
    vars_files: …/answerfile.ymltasks:
    • name: Password Expiration Set
      vcenter_root_password_expiration:
      hostname: “{{ vcenter_hostname }}”
      username: “{{ vcenter_username }}”
      password: “{{ vcenter_password }}”
      validate_certs: no
      #max_days_between_password_change: 9999
      #min_days_between_password_change: 6
      #warn_days_before_password_expiration: 7
      root_password_expires: “{{ expire_password }}”
      root_password_expire_days: “{{ password_expiration_days }}”
      state: present
      delegate_to: localhost

Yes, I’m not using code block.

I think there might be a misunderstanding, sorry. I am asking you to use a code block to better format your code, because right now, I can’t tell if it is correctly indented (and I think this might be where your error comes from). So, would you ? :slight_smile:

If that’s an issue for whatever reason, you can also share it from a gist or any other similar service.

Also I don’t understand why there was a tasks block the first time you shared it, but it is gone now.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.