diff --git a/states/_modules/pki.py b/states/_modules/pki.py index 1c3fbf9..e9b20e8 100644 --- a/states/_modules/pki.py +++ b/states/_modules/pki.py @@ -31,13 +31,14 @@ def write_file_content(content=None, def get_pki_cert(url="http://pki", username=None, password=None, - domains=None): + domains=None, + provider=None): req = Request(method="POST", url=f"{url}/cert", headers={"Content-Type":"application/json"}) authstring = base64.b64encode(f"{username}:{password}".encode()).decode() req.add_header("Authorization", f"Basic {authstring}") - jsondata = json.dumps({"domains":domains}) + jsondata = json.dumps({"domains":domains, "provider": provider}) res = urlopen(req, jsondata.encode('utf-8')) resj = json.loads(res.read()) diff --git a/states/_states/pki.py b/states/_states/pki.py index 4e050a4..b2c29a0 100644 --- a/states/_states/pki.py +++ b/states/_states/pki.py @@ -8,6 +8,7 @@ def fetched(name=None, username=None, password=None, domains=None, + provider=None, certfile=None, fullcertfile=None, keyfile=None): @@ -29,7 +30,8 @@ def fetched(name=None, newcert, newkey = __salt__['pki.get_pki_cert'](url=url, username=username, password=password, - domains=domains) + domains=domains, + provider=provider) newfullcert = f"{newcert}\n\n{newkey}" if all([newcert,newkey,newfullcert]): diff --git a/states/acme/pkic.sls b/states/acme/pkic.sls index 6d6e564..264f214 100644 --- a/states/acme/pkic.sls +++ b/states/acme/pkic.sls @@ -9,7 +9,8 @@ pki-fetched-{{ k }}: - username: {{ acme.provider.pki.username }} - password: {{ acme.provider.pki.password }} - domains: {{ v.domains }} + - provider: {{ v.provider }} - certfile: {{ v.certfile }} - fullcertfile: {{ v.fullcertfile }} - keyfile: {{ v.keyfile }} -{% endfor %} \ No newline at end of file +{% endfor %}