Skip to content

Commit

Permalink
Merge pull request #2 from justereseau/fix/var_override
Browse files Browse the repository at this point in the history
Fix: var override
  • Loading branch information
lucasmaurice authored Dec 8, 2020
2 parents 67acb4b + efdc6d8 commit 8efb868
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services: docker

env:
global:
- ROLE_NAME: cloudflare-acme
- ROLE_NAME: cloudflare_acme
matrix:
- MOLECULE_DISTRO: centos7
- MOLECULE_DISTRO: centos8
Expand Down
2 changes: 1 addition & 1 deletion meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
galaxy_info:
role_name: cloudflare-acme
role_name: cloudflare_acme
author: sonic
description: Install and renew SSL certificates with Cloudflare API ; Let's Encrypt ; and acme.sh.
license: MIT
Expand Down
2 changes: 1 addition & 1 deletion molecule/default/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
vars:
acme_sh_domains: []
roles:
- role: cloudflare-acme
- role: cloudflare_acme
13 changes: 12 additions & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@
apt:
update_cache: true
when: ansible_os_family == 'Debian'
changed_when: False

- name: Install dependencies
package:
name:
- git
- wget
state: present

- name: Create git clone path
file:
path: "{{ acme_sh_git_clone_dest | dirname }}"
state: "directory"
mode: "0755"

- name: Git clone acme.sh
git:
Expand Down Expand Up @@ -77,10 +80,18 @@
- acme_cloudflare_token is defined
- acme_cloudflare_email is defined
loop: "{{ acme_sh_domains }}"
register: issue_result
register: issue_result2
changed_when: issue_result.rc == 0 and "Cert success" in issue_result.stdout and not item.force_renew | default(false)
failed_when: issue_result.rc != 0 and "Domains not changed" not in issue_result.stdout

# Because even with the when, the var is overridden.
- name: Grab the good issue result
set_fact:
issue_result: "{{ issue_result2 }}"
when:
- acme_cloudflare_token is defined
- acme_cloudflare_email is defined

- name: Install acme.sh certificate(s)
command: >-
./acme.sh --install-cert -d {{ item.domain }}
Expand Down

0 comments on commit 8efb868

Please sign in to comment.