Skip to content

Logrotate config interpets string as list #908

@vosdev

Description

@vosdev

Bug Overview

using the nginx_logrotate_conf values from defaults/logrotate.yml:

(I did change the www-data user to nginx..). I tried putting quotes around the path, no change in result.

nginx_logrotate_conf_enable: true
nginx_logrotate_conf:
  paths: /var/log/nginx/*.log # String or list of strings
    # - /var/log/nginx/*.log
  options: # daily # String or a list of strings
    - daily
    - missingok
    - rotate 14
    - compress
    - delaycompress
    - notifempty
    - create 0644 nginx adm # Changes NGINX log permissions
    - sharedscripts

results in /etc/logrotate.d/nginx:

/
v
a
r
/
l
o
g
/
n
g
i
n
x
/
*
.
l
o
g
{
    daily
    missingok
    rotate 14
    compress
    delaycompress
    notifempty
    create 0644 nginx adm
    sharedscripts
    postrotate
        if [ -f /var/run/nginx.pid ]; then
            kill -USR1 `cat /var/run/nginx.pid`
        fi
    endscript
}

Expected Behavior

/var/log/nginx/*.log {
    daily
    missingok
    rotate 14
    compress
    delaycompress
    notifempty
    create 0644 nginx adm
    sharedscripts
    postr

Steps to Reproduce the Bug

Create logrotate config with the example vars from defaults/logrotate.yml

Environment Details

  • Target deployment platforms: local LXC
  • Target OSs: Ubuntu 22.04
  • Host OS (where you are running Ansible from): Ubuntu 24.04
  • Version of the NGINX Ansible role (or specific commit): collections nginxnic.nginx_core 0.8.0
  • Version of Ansible: core 2.17.13
  • How is Ansible being managed: CLI & SemaphoreUI

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions