Fix linters and metadata
With update of ansible-lint to version >=6.0.0 a lot of new linters were added, that enabled by default. In order to comply with linter rules we're applying changes to the role. With that we also update metdata to reflect current state. Change-Id: I4aab8ba621228d3fbf79b1da8227be41f3258b5f
This commit is contained in:
parent
f3396119a4
commit
b763b73ffc
@ -24,21 +24,21 @@ systemd_service_restart_changed: yes
|
||||
systemd_tempd_prefix: tempd
|
||||
|
||||
# Give a reasonable amount of time for the server to start up/shut down
|
||||
systemd_TimeoutSec: 120
|
||||
systemd_Restart: on-failure
|
||||
systemd_RestartSec: 2
|
||||
systemd_service_timeout_sec: "{{ systemd_TimeoutSec | default(120) }}"
|
||||
systemd_service_restart: "{{ systemd_Restart | default('on-failure') }}"
|
||||
systemd_service_restart_sec: "{{ systemd_RestartSec | default(2) }}"
|
||||
|
||||
# Accounting options
|
||||
systemd_CPUAccounting: true
|
||||
systemd_BlockIOAccounting: true
|
||||
systemd_MemoryAccounting: true
|
||||
systemd_TasksAccounting: true
|
||||
systemd_service_cpu_accounting: "{{ systemd_CPUAccounting | default(true) }}"
|
||||
systemd_service_block_io_accounting: "{{ systemd_BlockIOAccounting | default(true) }}"
|
||||
systemd_service_memory_accounting: "{{ systemd_MemoryAccounting | default(true) }}"
|
||||
systemd_service_tasks_accounting: "{{ systemd_TasksAccounting | default(true) }}"
|
||||
|
||||
# Sandboxing options
|
||||
systemd_PrivateTmp: false
|
||||
systemd_PrivateDevices: false
|
||||
systemd_PrivateNetwork: false
|
||||
systemd_PrivateUsers: false
|
||||
systemd_service_private_tmp: "{{ systemd_PrivateTmp | default(false) }}"
|
||||
systemd_service_private_devices: "{{ systemd_PrivateDevices | default(false) }}"
|
||||
systemd_service_private_network: "{{ systemd_PrivateNetwork | default(false) }}"
|
||||
systemd_service_private_users: "{{ systemd_PrivateUsers | default(false) }}"
|
||||
|
||||
# Start service after a given target. This is here because we want to define common
|
||||
# after targets used on most services. This can be overridden or agumented using
|
||||
|
@ -15,7 +15,10 @@
|
||||
|
||||
- name: "Restart service {{ services_results.item.service_name | replace(' ', '_') }}"
|
||||
systemd:
|
||||
name: "{{ services_results.item.service_name | replace(' ', '_') }}{{ template_argument }}.{{ (services_results.item.timer is defined) | ternary('timer', 'service') }}"
|
||||
name: >-
|
||||
{{ services_results.item.service_name | replace(' ', '_') }}{{ template_argument }}.{{
|
||||
(services_results.item.timer is defined) | ternary('timer', 'service')
|
||||
}}
|
||||
state: restarted
|
||||
loop: "{{ services_results.item.template_arguments | default(['']) }}"
|
||||
loop_control:
|
||||
|
@ -18,18 +18,20 @@ galaxy_info:
|
||||
description: Installation and setup of systemd_service
|
||||
company: Rackspace
|
||||
license: Apache2
|
||||
min_ansible_version: 2.0
|
||||
role_name: systemd_service
|
||||
namespace: openstack
|
||||
min_ansible_version: "2.10"
|
||||
platforms:
|
||||
- name: Debian
|
||||
versions:
|
||||
- buster
|
||||
- bullseye
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- bionic
|
||||
- focal
|
||||
- jammy
|
||||
- name: EL
|
||||
versions:
|
||||
- 8
|
||||
categories:
|
||||
- "9"
|
||||
galaxy_tags:
|
||||
- systemd
|
||||
- development
|
||||
|
@ -0,0 +1,22 @@
|
||||
---
|
||||
|
||||
deprecations:
|
||||
- |
|
||||
In order to follow ansible naming conventions for variables,
|
||||
following variables were renamed:
|
||||
|
||||
* systemd_TimeoutSec -> systemd_service_timeout_sec
|
||||
* systemd_Restart -> systemd_service_restart
|
||||
* systemd_RestartSec -> systemd_service_restart_sec
|
||||
* systemd_CPUAccounting -> systemd_service_cpu_accounting
|
||||
* systemd_BlockIOAccounting -> systemd_service_block_io_accounting
|
||||
* systemd_MemoryAccounting -> systemd_service_memory_accounting
|
||||
* systemd_TasksAccounting -> systemd_service_tasks_accounting
|
||||
* systemd_PrivateTmp -> systemd_service_private_tmp
|
||||
* systemd_PrivateDevices -> systemd_service_private_devices
|
||||
* systemd_PrivateNetwork -> systemd_service_private_network
|
||||
* systemd_PrivateUsers -> systemd_service_private_users
|
||||
|
||||
Old variable names were kept for backwards compatibility but will be
|
||||
removed in next releases. It is highly adviced to use new variable
|
||||
names in your deployments.
|
@ -141,9 +141,13 @@
|
||||
systemd:
|
||||
daemon_reload: yes
|
||||
when:
|
||||
- (systemd_services_result is changed) or (systemd_timer_result is changed) or (systemd_override_result is changed ) or (systemd_socket.results | selectattr('changed', 'true') | length > 0)
|
||||
- (systemd_services_result is changed) or
|
||||
(systemd_timer_result is changed) or
|
||||
(systemd_override_result is changed ) or
|
||||
(systemd_socket.results | selectattr('changed', 'true') | length > 0)
|
||||
|
||||
- include_tasks: systemd_load.yml
|
||||
- name: Including systemd_load tasks
|
||||
include_tasks: systemd_load.yml
|
||||
loop: "{{ systemd_services }}"
|
||||
loop_control:
|
||||
loop_var: service
|
||||
|
@ -65,10 +65,10 @@ ExecStopPost={{ execstoppost }}
|
||||
{% endfor %}
|
||||
|
||||
# Give a reasonable amount of time for the server to start up/shut down
|
||||
TimeoutSec={{ systemd_TimeoutSec }}
|
||||
TimeoutSec={{ systemd_service_timeout_sec }}
|
||||
{% if service_type != 'oneshot' %}
|
||||
Restart={{ systemd_Restart }}
|
||||
RestartSec={{ systemd_RestartSec }}
|
||||
Restart={{ systemd_service_restart }}
|
||||
RestartSec={{ systemd_service_restart_sec }}
|
||||
{% endif %}
|
||||
|
||||
{% if item.standard_output is defined %}
|
||||
@ -86,10 +86,10 @@ Slice={{ systemd_slice_name }}.slice
|
||||
{{ key }}={{ value }}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
CPUAccounting={{ systemd_CPUAccounting }}
|
||||
BlockIOAccounting={{ systemd_BlockIOAccounting }}
|
||||
MemoryAccounting={{ systemd_MemoryAccounting }}
|
||||
TasksAccounting={{ systemd_TasksAccounting }}
|
||||
CPUAccounting={{ systemd_service_cpu_accounting }}
|
||||
BlockIOAccounting={{ systemd_service_block_io_accounting }}
|
||||
MemoryAccounting={{ systemd_service_memory_accounting }}
|
||||
TasksAccounting={{ systemd_service_tasks_accounting }}
|
||||
{% endif %}
|
||||
|
||||
{% if service_type != 'oneshot' %}
|
||||
@ -99,15 +99,15 @@ TasksAccounting={{ systemd_TasksAccounting }}
|
||||
{{ key }}={{ value }}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
PrivateTmp={{ systemd_PrivateTmp }}
|
||||
PrivateDevices={{ systemd_PrivateDevices }}
|
||||
PrivateNetwork={{ systemd_PrivateNetwork }}
|
||||
PrivateTmp={{ systemd_service_private_tmp }}
|
||||
PrivateDevices={{ systemd_service_private_devices }}
|
||||
PrivateNetwork={{ systemd_service_private_network }}
|
||||
{# NOTE(cloudnull): Limit the use of PrivateUsers
|
||||
The systemd directive "PrivateUsers" was implemented in systemd version 232.
|
||||
To correct a lot of spam messages in the journal the default directive is
|
||||
limited when to systemd version greater than or equal to 232 #}
|
||||
{% if (systemd_version | int) >= 232 %}
|
||||
PrivateUsers={{ systemd_PrivateUsers }}
|
||||
PrivateUsers={{ systemd_service_private_users }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if systemd_version|int >= 235 and item.state_directory is defined %}
|
||||
|
Loading…
Reference in New Issue
Block a user