skip to Main Content

I would be really happy if someone can help me with the following problem. When I want to apply my state to the minion I get the following error:

Function: acme.cert
  Result: False
 Comment: State 'acme.cert' was not found in SLS 'certbot'
          Reason: 'acme.cert' is not available.
 Started:
Duration:
 Changes:

This is my state file. certbot.sls:

certbot:
pkg.installed:
– name: certbot

reload-nginx:
cmd.run:
– name: systemctl reload nginx.service

<my.domain>:
acme.cert:
– aliases:
– <my.domain>
– email: <my.email>
– webroot_path: /srv/<my.domain>/
– renew: 14
– agree_tos: True
– fire_event: acme/<my.domain>
– onchanges:
– cmd: reload-nginx

I assume that the problem occurs because I didnt install acme.cert modul but I cant find it anywhere and maybe is their a oter solution for this problem?

Best Regards

I tried to find the repo but wasnt able. iam not that good in salt.

2

Answers


  1. acme.cert didn’t load when the salt-minion started because certbot wasn’t available at minion start time.

    So to fix this you’ll need to run your certbot.sls file, then restart the salt-minin, then the rest of your state should work.

    Login or Signup to reply.
  2. After installing certbot, you must reload the salt modules so they can see it.

    Your onchanges is also the wrong way around.

    certbot:
      pkg.installed:
        - reload_modules: true
    
    nginx:
      service.running:
        - reload: true
    
    <my.domain>:
      acme.cert:
        - aliases: 
          - <my.domain> 
        - email: <my.email> 
        - webroot_path: /srv/<my.domain>/ 
        - renew: 14 
        - agree_tos: true 
        - fire_event: acme/<my.domain>
        - require:
          - service: nginx
        - listen_in:
          - service: nginx
    

    Though I’m assuming you already have an nginx state elsewhere? You should reference that instead of adding another one.

    https://docs.saltproject.io/en/latest/ref/states/requisites.html

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search