[re2oapi] If user is not specified, use re2o_service_user from the cpasswords vault.

certbot_on_virtu
_pollion 2020-04-19 19:57:38 +02:00
parent c9f6007c43
commit a0ce33a537
1 changed files with 4 additions and 2 deletions

View File

@ -12,8 +12,6 @@ For now:
TODO: Implement a small client for our needs, this will also remove the sys.path extension ... TODO: Implement a small client for our needs, this will also remove the sys.path extension ...
""" """
from ansible.plugins.lookup import LookupBase from ansible.plugins.lookup import LookupBase
from ansible.errors import AnsibleError from ansible.errors import AnsibleError
@ -47,6 +45,10 @@ class LookupModule(LookupBase):
if api_hostname is None: if api_hostname is None:
raise AnsibleError('You must specify a hostname to contact re2oAPI') raise AnsibleError('You must specify a hostname to contact re2oAPI')
if api_username is None and api_password is None:
api_username = variables.get('vault_re2o_service_user')
api_password = variables.get('vault_re2o_service_password')
if api_username is None: if api_username is None:
raise AnsibleError('You must specify a valid username to connect to re2oAPI') raise AnsibleError('You must specify a valid username to connect to re2oAPI')