From 56b460823c64e4ce2adf6a358a562dade10d2a1d Mon Sep 17 00:00:00 2001 From: jurgenhaas <juergen@paragon-es.de> Date: Tue, 16 Jan 2018 16:26:48 +0100 Subject: [PATCH] ansible-roles/haproxy#8 Sync proxy pool when certs got renewed --- tasks/main.yml | 26 ++------------------------ tasks/proxypool.yml | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 24 deletions(-) create mode 100644 tasks/proxypool.yml diff --git a/tasks/main.yml b/tasks/main.yml index 62f92bf..b7f6dae 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -25,32 +25,10 @@ - name: "Renew Existing Cert" include: '../../letsencrypt/tasks/renew.yml' - - name: "Build HaCerts" + - name: "Build HaProxy Certs" include: 'buildcerts.yml' - - name: "Set directory permissions to current user" - file: - path: '/etc/letsencrypt' - owner: '{{ ansible_env.SUDO_USER }}' - recurse: yes - tags: 'Certs' - when: proxy_active - tags: 'Certs' when: 'proxy_active and "letsencrypt" not in excluded_roles' -- block: - - - name: "Pull Certs from active Proxy" - include: 'pullcerts.yml' - tags: 'Certs' - - when: 'not proxy_active and "letsencrypt" not in excluded_roles' - -- name: "Set directory permissions to root" - file: - path: '/etc/letsencrypt' - owner: 'root' - recurse: yes - tags: 'Certs' - when: 'proxy_active and "letsencrypt" not in excluded_roles' +- include_tasks: 'proxypool.yml' diff --git a/tasks/proxypool.yml b/tasks/proxypool.yml new file mode 100644 index 0000000..4db3c9d --- /dev/null +++ b/tasks/proxypool.yml @@ -0,0 +1,23 @@ +--- +# file: roles/haproxy/tasks/proxypool.yml + +- name: "Set directory permissions to current user" + file: + path: '/etc/letsencrypt' + owner: '{{ ansible_env.SUDO_USER }}' + recurse: yes + tags: 'Certs' + when: 'proxy_active is defined and proxy_active and "letsencrypt" not in excluded_roles' + +- name: "Pull Certs from active Proxy" + include: 'pullcerts.yml' + tags: 'Certs' + when: 'proxy_active is defined and not proxy_active and "letsencrypt" not in excluded_roles' + +- name: "Set directory permissions to root" + file: + path: '/etc/letsencrypt' + owner: 'root' + recurse: yes + tags: 'Certs' + when: 'proxy_active is defined and proxy_active and "letsencrypt" not in excluded_roles' -- GitLab