Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Older Ansible not supported any more? Getting "'ssl_certificate' is undefined" #66

Open
centic9 opened this issue Feb 7, 2018 · 0 comments

Comments

@centic9
Copy link

centic9 commented Feb 7, 2018

Trying to run the current version of this role from Galaxy, I get the following when using Ansible 2.0.0 (the latest on base Ubuntu Xenial):

TASK [../../roles/thefinn93.letsencrypt : Create directory for `ssl_certificate` and `ssl_certificate_key`] ***
task path: /opt/svn/Ansible/roles/thefinn93.letsencrypt/tasks/main.yml:86
fatal: [vserver]: FAILED! => {"failed": true, "msg": "ERROR! 'ssl_certificate' is undefined"}

It looks like the with_items is not supported with "when"?

  - name: Create directory for `ssl_certificate` and `ssl_certificate_key`
    file:
      path: '{{ item }}'
      state: directory
      recurse: yes
    when: ssl_certificate is defined and ssl_certificate_key is defined
    with_items:
      - "{{ ssl_certificate|dirname }}"
      - "{{ ssl_certificate_key|dirname }}"

If I change that to the following it seems to work:


  - name: Create directory for `ssl_certificate` and `ssl_certificate_key`
    file:
      path: "{{ ssl_certificate_key|dirname }}"
      state: directory
      recurse: yes
    when: ssl_certificate is defined and ssl_certificate_key is defined

  - name: Create directory for `ssl_certificate` and `ssl_certificate_key`
    file:
      path: "{{ ssl_certificate|dirname }}"
      state: directory
      recurse: yes
    when: ssl_certificate is defined and ssl_certificate_key is defined

  - name: Symlink certificates to `ssl_certificate` and `ssl_certificate_key`
    file:
      src: /etc/letsencrypt/live/{{ letsencrypt_cert_domains[0] }}/fullchain.pem
      dest: "{{ssl_certificate}}"
      state: link
    when: ssl_certificate is defined and ssl_certificate_key is defined

  - name: Symlink certificates to `ssl_certificate` and `ssl_certificate_key`
    file:
      src: /etc/letsencrypt/live/{{ letsencrypt_cert_domains[0] }}/privkey.pem
      dest: "{{ssl_certificate_key}}"
      state: link
    when: ssl_certificate is defined and ssl_certificate_key is defined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant