Merge pull request #2 from justereseau/fix/var_override
Fix: var override
This commit is contained in:
commit
8efb868a29
|
@ -4,7 +4,7 @@ services: docker
|
||||||
|
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- ROLE_NAME: cloudflare-acme
|
- ROLE_NAME: cloudflare_acme
|
||||||
matrix:
|
matrix:
|
||||||
- MOLECULE_DISTRO: centos7
|
- MOLECULE_DISTRO: centos7
|
||||||
- MOLECULE_DISTRO: centos8
|
- MOLECULE_DISTRO: centos8
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
galaxy_info:
|
galaxy_info:
|
||||||
role_name: cloudflare-acme
|
role_name: cloudflare_acme
|
||||||
author: sonic
|
author: sonic
|
||||||
description: Install and renew SSL certificates with Cloudflare API ; Let's Encrypt ; and acme.sh.
|
description: Install and renew SSL certificates with Cloudflare API ; Let's Encrypt ; and acme.sh.
|
||||||
license: MIT
|
license: MIT
|
||||||
|
|
|
@ -5,4 +5,4 @@
|
||||||
vars:
|
vars:
|
||||||
acme_sh_domains: []
|
acme_sh_domains: []
|
||||||
roles:
|
roles:
|
||||||
- role: cloudflare-acme
|
- role: cloudflare_acme
|
||||||
|
|
|
@ -3,17 +3,20 @@
|
||||||
apt:
|
apt:
|
||||||
update_cache: true
|
update_cache: true
|
||||||
when: ansible_os_family == 'Debian'
|
when: ansible_os_family == 'Debian'
|
||||||
|
changed_when: False
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
package:
|
package:
|
||||||
name:
|
name:
|
||||||
- git
|
- git
|
||||||
- wget
|
- wget
|
||||||
|
state: present
|
||||||
|
|
||||||
- name: Create git clone path
|
- name: Create git clone path
|
||||||
file:
|
file:
|
||||||
path: "{{ acme_sh_git_clone_dest | dirname }}"
|
path: "{{ acme_sh_git_clone_dest | dirname }}"
|
||||||
state: "directory"
|
state: "directory"
|
||||||
|
mode: "0755"
|
||||||
|
|
||||||
- name: Git clone acme.sh
|
- name: Git clone acme.sh
|
||||||
git:
|
git:
|
||||||
|
@ -77,10 +80,18 @@
|
||||||
- acme_cloudflare_token is defined
|
- acme_cloudflare_token is defined
|
||||||
- acme_cloudflare_email is defined
|
- acme_cloudflare_email is defined
|
||||||
loop: "{{ acme_sh_domains }}"
|
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)
|
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
|
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)
|
- name: Install acme.sh certificate(s)
|
||||||
command: >-
|
command: >-
|
||||||
./acme.sh --install-cert -d {{ item.domain }}
|
./acme.sh --install-cert -d {{ item.domain }}
|
||||||
|
|
Loading…
Reference in New Issue