diff --git a/README.md b/README.md index 81a043b..d1c6fdf 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ Role Variables * aliases : list of alternative FQDN for the website * proxy : URL to direct traffic for the FQDN to, e.g. http://localhost:8080 * redirect : Where should we send traffic? + * repo : git URL of website repo to clone/update ~~~ lets_encrypt_admin: 'acme@example.com' diff --git a/tasks/main.yml b/tasks/main.yml index f224451..a47da60 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -133,6 +133,7 @@ - ensure_apache is defined - http_vhost is defined - http_vhost is iterable + - item.fqdn is defined ansible.builtin.file: path: '/srv/http/{{ item.fqdn }}' state: 'directory' @@ -140,6 +141,20 @@ loop: '{{ http_vhost }}' loop_control: label: '/srv/http/{{ item.fqdn }} will be ensured' +- name: 'ensure website content from git repos' + when: + - ansible_system == 'Linux' + - ensure_apache is defined + - http_vhost is defined + - http_vhost is iterable + - item.fqdn is defined + - item.repo is defined + ansible.builtin.git: + dest: '/srv/http/{{ item.fqdn }}' + repo: '{{ item.repo }}' + loop: '{{ http_vhost }}' + loop_control: + label: '/srv/http/{{ item.fqdn }} will be populated...' - name: 'ensure services' when: - ansible_system == 'Linux' @@ -158,4 +173,3 @@ - 'ensure_apache.service_facts' - name: 'flush handlers' meta: 'flush_handlers' -