ansible-role-nginx/tasks/config/setup-logrotate.yml
2022-03-24 13:46:38 +01:00

37 lines
1.0 KiB
YAML

---
- name: (Alpine Linux) Install logrotate
community.general.apk:
name: logrotate
when: ansible_facts['os_family'] == "Alpine"
- name: (Debian/Ubuntu) Install logrotate
ansible.builtin.apt:
name: logrotate
state: present
when: ansible_facts['os_family'] == "Debian"
- name: (Amazon Linux/CentOS/Oracle Linux/RHEL) Install logrotate
ansible.builtin.yum:
name: logrotate
state: present
when: ansible_facts['os_family'] == "RedHat"
- name: (SLES) Set up logrotate
block:
- name: (SLES) Configure logrotate repository
community.general.zypper_repository:
repo: https://download.opensuse.org/repositories/openSUSE:Leap:42.1/standard/openSUSE:Leap:42.1.repo
- name: (SLES) Install Logrotate
community.general.zypper:
name: logrotate
state: present
when: ansible_facts['os_family'] == "Suse"
- name: Create logrotate config
ansible.builtin.template:
src: logrotate/nginx.j2
dest: /etc/logrotate.d/nginx
mode: 0644
notify: (Handler) Run logrotate