break: change with_items to loop

This commit is contained in:
Adrien Waksberg 2018-11-25 20:24:19 +01:00
parent 289e2d34e6
commit 79445d9d05
6 changed files with 11 additions and 10 deletions

View file

@ -2,7 +2,6 @@ sudo: required
language: ruby
env:
- ANSIBLE_VERSION=2.4
- ANSIBLE_VERSION=2.5
- ANSIBLE_VERSION=2.6
- ANSIBLE_VERSION=2.7

View file

@ -4,6 +4,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
Which is based on [Keep A Changelog](http://keepachangelog.com/)
## [Unreleased]
- BREAKING CHANGE: minimal ansible version is 2.5 now
- fix: replace inline module to cron for renew cron
- test: use new docker images
- test: add tavis-ci to run tests

View file

@ -7,7 +7,7 @@ Generate certificate SSL with certbot.
## Requirements
* Ansible >= 2.4
* Ansible >= 2.5
* Debian Stretch
## Role variables

View file

@ -2,7 +2,7 @@ galaxy_info:
author: Adrien Waksberg
description: Generate certificate SSL with certbot
license: Apache2
min_ansible_version: 2.4
min_ansible_version: 2.5
platforms:
- name: Debian

View file

@ -1,11 +1,12 @@
- name: install certbot package
apt:
name: '{{ item }}'
name: '{{ packages }}'
default_release: '{{ certbot_distribution|default(ansible_distribution_release) }}'
state: present
with_items:
- certbot
- cron
vars:
packages:
- certbot
- cron
tags: certbot
- name: create webroot path directory

View file

@ -1,7 +1,7 @@
- name: check if certificate exist
stat:
path: '/etc/letsencrypt/live/{{ item.name }}'
with_items: '{{ certbot_domains }}'
loop: '{{ certbot_domains }}'
register: st
tags: certbot
@ -13,12 +13,12 @@
- name: create a new certificate
shell: 'certbot certonly -n --agree-tos -d {{ item.item.name }} -m {{ certbot_mail }} --webroot --webroot-path {{ certbot_path }} --rsa-key-size {{ certbot_key_size }}'
with_items: '{{ st.results }}'
loop: '{{ st.results }}'
when: (certbot_role == 'master' or item.item.name == ansible_fqdn) and not item.stat.exists and ng.stat.exists
tags: certbot
- name: create a new certificate (standalone)
shell: 'certbot certonly -n --agree-tos -d {{ item.item.name }} -m {{ certbot_mail }} --standalone --rsa-key-size {{ certbot_key_size }}'
with_items: '{{ st.results }}'
loop: '{{ st.results }}'
when: (certbot_role == 'master' or item.item.name == ansible_fqdn) and not item.stat.exists and not ng.stat.exists
tags: certbot