password#

Exec module for generating random strings usable as passwords

idem_random.exec.random.password.generate_random_string(hub, length: int, *, upper: bool = True, lower: bool = True, numeric: bool = True, special: bool = True, min_numeric: int = 0, min_lower: int = 0, min_upper: int = 0, min_special: int = 0, override_special: str = None) Dict[str, Any][source]#

Generate a random string.

Parameters:
  • length (int) – The length of the required random password. Defaults to True.

  • upper (bool, Optional) – Include upper-case in generated password. Defaults to True.

  • lower (bool, Optional) – Include lower-case in generated password. Defaults to True.

  • numeric (bool, Optional) – Include numbers in generated password. Defaults to True.

  • special (bool, Optional) – Include special characters (!@#$%&*()-_=+[]{}<>:?) in generated password. Defaults to True.

  • min_lower (int, Optional) – Minimum number of lowercase alphabet characters in the result. Default value is 0.

  • min_numeric (int, Optional) – Minimum number of numeric characters in the result. Default value is 0.

  • min_special (int, Optional) – Minimum number of special characters in the result. Default value is 0.

  • min_upper (int, Optional) – Minimum number of uppercase alphabet characters in the result. Default value is 0.

  • override_special (str, Optional) – Supply your own sequence of special characters to use for string generation. This overrides the default special character list. The special argument must still be set to true for any overwritten characters to be used in generation.

Returns:

Dict[str, Any]

Command line example:

idem exec random.password.generate_random_string length=10

State example:

service_password:
  exec.run:
    - path: random.password.generate_random_string
    - kwargs:
        length: 10