userlogrotate: create role separated from packweb-apache
gitea/ansible-roles/pipeline/head This commit looks good Details

This commit is contained in:
William Hirigoyen 2023-02-21 17:55:46 +01:00
parent ae5c829373
commit 2c1db6a222
6 changed files with 38 additions and 29 deletions

View File

@ -16,6 +16,7 @@ The **patch** part changes is incremented if multiple releases happen the same m
* nagios-nrpe: add tasks/files for a wrapper
* fail2ban: add "Internal login failure" to Dovecot filter
* php: add a way to choose which version to install using sury repository
* userlogrotate: create role separated from packweb-apache
### Changed

View File

@ -65,19 +65,8 @@
- access.log
- error.log
- name: "Install userlogrotate (jessie)"
copy:
src: userlogrotate_jessie
dest: /etc/cron.weekly/userlogrotate
mode: "0755"
when: ansible_distribution_release == "jessie"
- name: "Install userlogrotate (Debian 9 or later)"
copy:
src: userlogrotate
dest: /etc/cron.weekly/userlogrotate
mode: "0755"
when: ansible_distribution_major_version is version('9', '>=')
- include_role:
name: userlogrotate
- name: Force DIR_MODE to 0750 in /etc/adduser.conf
lineinfile:
@ -102,3 +91,4 @@
- include: multiphp.yml
when: packweb_multiphp_versions | length > 0

View File

@ -1,16 +0,0 @@
---
- name: "Cherche l'emplacement de userlogrotate"
ansible.builtin.find:
path: /etc
patterns: userlogrotate
register: find_logrotate
- name: "Met-à-jour userlogrotate"
ansible.builtin.copy:
src: userlogrotate
dest: "{{ item }}"
mode: "0755"
loop: "{{ find_logrotate.files }}"
when: find_logrotate.files | length>0

View File

@ -0,0 +1,34 @@
---
- name: "Is userlogrotate present ?"
ansible.builtin.find:
paths: ["/etc/cron.weekly", "/etc/cron.daily"]
patterns: ["userlogrotate"]
register: find_logrotate
check_mode: no
- name: "Update userlogrotate"
ansible.builtin.copy:
src: userlogrotate
dest: "{{ item.path }}"
mode: "0755"
loop: "{{ find_logrotate.files }}"
when: find_logrotate.files | length>0
- name: "Install userlogrotate (jessie)"
copy:
src: userlogrotate_jessie
dest: /etc/cron.weekly/userlogrotate
mode: "0755"
when:
- ansible_distribution_release == "jessie"
- find_logrotate.files | length==0
- name: "Install userlogrotate (Debian 9 or later)"
copy:
src: userlogrotate
dest: /etc/cron.weekly/userlogrotate
mode: "0755"
when:
- ansible_distribution_major_version is version('9', '>=')
- find_logrotate.files | length==0