File tree Expand file tree Collapse file tree 6 files changed +23
-2
lines changed
Expand file tree Collapse file tree 6 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ This example is taken from [`molecule/default/converge.yml`](https://github.com/
2121 logrotate_frequency : daily
2222 logrotate_keep : 7
2323 logrotate_compress : true
24+ logrotate_create : false
2425 logrotate_entries :
2526 - name : example
2627 path : " /var/log/example/*.log"
@@ -180,6 +181,9 @@ logrotate_compress: true
180181# Use date extension on log file names
181182logrotate_dateext: false
182183
184+ # Enable the global ` create` directive in /etc/logrotate.conf.
185+ logrotate_create : true
186+
183187# User/Group for rotated log files (Loaded by OS-Specific vars if found, or and can be set manually)
184188logrotate_user : " {{ _logrotate_user[ansible_distribution] | default(_logrotate_user['default']) }}"
185189logrotate_group : " {{ _logrotate_group[ansible_distribution] | default(_logrotate_group['default']) }}"
Original file line number Diff line number Diff line change @@ -13,6 +13,9 @@ logrotate_compress: true
1313# Use date extension on log file names
1414logrotate_dateext : false
1515
16+ # Enable the global `create` directive in /etc/logrotate.conf.
17+ logrotate_create : true
18+
1619# User/Group for rotated log files (Loaded by OS-Specific vars if found, or and can be set manually)
1720logrotate_user : " {{ _logrotate_user[ansible_distribution] | default(_logrotate_user['default']) }}"
1821logrotate_group : " {{ _logrotate_group[ansible_distribution] | default(_logrotate_group['default']) }}"
Original file line number Diff line number Diff line change @@ -28,6 +28,10 @@ argument_specs:
2828 type : bool
2929 description : " Use date extension on log file names"
3030 default : false
31+ logrotate_create :
32+ type : bool
33+ description : " Enable the global `create` directive in /etc/logrotate.conf."
34+ default : true
3135 logrotate_user :
3236 type : str
3337 description : " User for rotated log files. Automatically determined, but overridable."
Original file line number Diff line number Diff line change 88 logrotate_frequency : daily
99 logrotate_keep : 7
1010 logrotate_compress : true
11+ logrotate_create : false
1112 logrotate_entries :
1213 - name : example
1314 path : " /var/log/example/*.log"
Original file line number Diff line number Diff line change 2828 - logrotate_dateext is boolean
2929 quiet : true
3030
31+ - name : assert | Test logrotate_create
32+ ansible.builtin.assert :
33+ that :
34+ - logrotate_create is defined
35+ - logrotate_create is boolean
36+ quiet : true
37+
3138- name : assert | Test logrotate_user
3239 ansible.builtin.assert :
3340 that :
Original file line number Diff line number Diff line change @@ -12,16 +12,18 @@ su {{ logrotate_user }} {{ logrotate_group }}
1212rotate {{ logrotate_keep }}
1313
1414# create new (empty) log files after rotating old ones
15+ {% if logrotate_create %}
1516create
17+ {% else %}
18+ #create
19+ {% endif %}
1620
17- # add dateext
1821{% if logrotate_dateext %}
1922dateext
2023{% else %}
2124#dateext
2225{% endif %}
2326
24- # uncomment this if you want your log files compressed
2527{% if logrotate_compress %}
2628compress
2729{% else %}
You can’t perform that action at this time.
0 commit comments