diff --git a/README.md b/README.md index c87eece..14ebd19 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,9 @@ Here is a list of all the default variables for this role, which are also availa # apache2_confs: # - { id: security, state: absent } # - { name: mime, state: present } +# - id: my_config +# state: present +# template: path/to/template.j2 # apache2_sites: # - id: mysite (required) # name: mysite.local (required) diff --git a/defaults/main.yml b/defaults/main.yml index fee2572..53071ac 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -8,6 +8,9 @@ # apache2_confs: # - { id: security, state: absent } # - { name: mime, state: present } +# - id: my_config +# state: present +# template: path/to/template.j2 # apache2_sites: # - id: mysite (required) # name: mysite.local (required) diff --git a/tasks/manage_confs.yml b/tasks/manage_confs.yml index 4801699..a289d49 100644 --- a/tasks/manage_confs.yml +++ b/tasks/manage_confs.yml @@ -1,5 +1,16 @@ --- +- name: Creating confs + template: + src: "{{ item.template }}" + dest: "/etc/apache2/conf-available/{{ item.id }}.conf" + owner: root + group: root + mode: "0644" + when: item.template is defined + with_items: "{{ apache2_confs }}" + notify: reload apache2 + - name: Enabling conf command: > a2enconf {{ item.id }}