roles/nginx: Fix issue raised by ansible-lint

[ANSIBLE0006] systemctl used in place of systemd module

Also, move the functionality of the changed check to the systemd task,
because it has the ability to simply daemon-reload itself now.
This commit is contained in:
Alan Orth 2017-10-31 23:18:15 +02:00
parent 4ad4d79b3d
commit 73e6d0b7ed
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9

View File

@ -2,19 +2,13 @@
- name: Copy systemd service to renew Let's Encrypt certs
template: src=renew-letsencrypt.service.j2 dest=/etc/systemd/system/renew-letsencrypt.service mode=0644 owner=root group=root
register: letsencrypt_service
- name: Copy systemd timer to renew Let's Encrypt certs
copy: src=renew-letsencrypt.timer dest=/etc/systemd/system/renew-letsencrypt.timer mode=0644 owner=root group=root
register: letsencrypt_timer
# need to reload to pick up service/timer changes
- name: Reload systemd daemon
command: /bin/systemctl daemon-reload
when: letsencrypt_service|changed or letsencrypt_timer|changed
# always issues daemon-reload just in case the server/timer changed
- name: Start and enable systemd timer to renew Let's Encrypt certs
service: name=renew-letsencrypt.timer state=started enabled=yes
systemd: name=renew-letsencrypt.timer state=started enabled=yes daemon_reload=yes
- name: Download certbot
get_url: dest={{ letsencrypt_certbot_dest }} url=https://dl.eff.org/certbot-auto mode=700