Manages Ansible 2.4+ with Docker

Closes #30
pull/35/head
Emilien Mantel 2018-03-15 18:06:38 +01:00
parent 737dfbeb30
commit c2685732a4
2 changed files with 23 additions and 5 deletions

View File

@ -2,21 +2,35 @@
- name: reload nginx - name: reload nginx
command: nginx -t command: nginx -t
notify: real-reload nginx notify:
- real-reload nginx
- docker reload nginx
- name: restart nginx - name: restart nginx
command: nginx -t command: nginx -t
notify: real-restart nginx notify:
- real-restart nginx
- docker restart nginx
- name: real-reload nginx - name: real-reload nginx
service: service:
name: nginx name: nginx
state: reloaded state: reloaded
when: ansible_virtualization_type != 'docker'
- name: real-restart nginx - name: real-restart nginx
service: service:
name: nginx name: nginx
state: restarted state: restarted
when: ansible_virtualization_type != 'docker'
- name: docker reload nginx
command: service nginx reload
when: ansible_virtualization_type == 'docker'
- name: docker restart nginx
command: service nginx restart
when: ansible_virtualization_type == 'docker'
- name: restart nginx freebsd - name: restart nginx freebsd
service: service:

View File

@ -48,11 +48,15 @@
with_items: "{{ acme_create }}" with_items: "{{ acme_create }}"
register: fake_site register: fake_site
- name: SERVICE | Reload nginx - name: SERVICE | Restart nginx
service: service:
name: nginx name: nginx
state: reloaded state: restarted
when: fake_site.changed when: fake_site.changed and ansible_virtualization_type != 'docker'
- name: COMMAND | Restart nginx
command: service nginx restart
when: fake_site.changed and ansible_virtualization_type == 'docker'
- name: SHELL | Get certificates - name: SHELL | Get certificates
shell: '{{ nginx_acmesh_bin }} --issue{% if item.name is string %} -d {{ item.name }}{% else %}{% for name in item.name %} -d {{ name }}{% endfor %}{% endif %} --nginx {% if nginx_acmesh_test %}--test{% endif %}' shell: '{{ nginx_acmesh_bin }} --issue{% if item.name is string %} -d {{ item.name }}{% else %}{% for name in item.name %} -d {{ name }}{% endfor %}{% endif %} --nginx {% if nginx_acmesh_test %}--test{% endif %}'