/ansible-role-win_password

Ansible module to create a random and complex password on Windows-based systems.

Primary LanguagePowerShellApache License 2.0Apache-2.0

win_password - Creates a random and complex password

Synopsis

  • Ansible module to create a random and complex password on Windows-based systems.

Parameters

Parameter Choices/Defaults Comments
length
integer
Default:
8
The number of characters in the generated password. The length must be between 1 and 128 characters.
min_upper_case
integer
Default:
1
The minimum number of uppercase letters of European languages (A through Z).
min_lower_case
integer
Default:
1
The minimum number of lowercase letters of European languages (a through z).
min_digit
integer
Default:
1
The minimum number of characters from base 10 digits (0 through 9).
min_special
integer
Default:
1
The minimum number of non-alphanumeric characters (special characters).
special_characters
string
Default:
!%&=?][#+-
A string containing all special characters allowed to use.

Examples

- hosts: localhost

  roles:

    - role: win_password

  tasks:

    - name: generate a complex password
      win_password:
        length: 14
        min_upper_case: 3
        min_lower_case: 2
        min_digit: 1
        min_special: 4
        special_characters: '+-'

    - name: debug message
      debug:
        var: win_complex_password

    - name: generate a complex password
      win_password:
        length: 14
        min_upper_case: 13
        min_lower_case: 0
        min_digit: 0
        min_special: 1
      register: myComplexPassword

    - name: debug message
      debug:
        var: myComplexPassword.ansible_facts.win_complex_password

Return Values

Facts returned by this module are added/updated in the hostvars host facts and can be referenced by name just like any other host fact. They do not need to be registered in order to use them.

Fact Returned Description
win_complex_password
string
success A string containing the password in plain text.

Authors

  • Stéphane Bilqué (@sbilque)

License

This project is licensed under the Apache 2.0 License.

See LICENSE to see the full text.