Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move application configuration to dedicated tasks file
Browse files Browse the repository at this point in the history
This allows to use the tasks_from option of the import_role module.
This permits to install and configure logrotate basics in one playbook, and
to configure application specifics in another application specific playbook
with something like:

```
- name: "Configure log rotation."
  import_role:
    name: ansible.logrotate
    tasks_from: configure_application
  become: True
  vars:
    logrotate_applications: "{{ redis_logrotate_configurations }}"
  when: redis_logrotate_configurations is defined
```
for instance.
Jonathan Piron committed Feb 13, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 038649f commit b514c75
Showing 2 changed files with 14 additions and 11 deletions.
13 changes: 13 additions & 0 deletions tasks/configure_application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
- name: 'create logrotate application configuration files'
become: true
template:
src: 'etc/logrotate.d/application.j2'
dest: '/etc/logrotate.d/{{ item.name }}'
owner: root
group: root
mode: 0644
with_items:
- '{{ logrotate_applications }}'
tags:
- configuration
12 changes: 1 addition & 11 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -46,17 +46,7 @@
- configuration

- name: 'create logrotate application configuration files'
become: true
template:
src: 'etc/logrotate.d/application.j2'
dest: '/etc/logrotate.d/{{ item.name }}'
owner: root
group: root
mode: 0644
with_items:
- '{{ logrotate_applications }}'
tags:
- configuration
import_tasks: configure_application.yml

- name: Symlink for hourly rotation
file:

0 comments on commit b514c75

Please sign in to comment.