diff --git a/defaults/main.yml b/defaults/main.yml index a5ea297..efdf62a 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -85,14 +85,19 @@ cloudkitty_cloudkitty_conf_overrides: {} cloudkitty_policy_overrides: {} cloudkitty_api_paste_ini_overrides: {} +cloudkitty_api_init_overrides: {} +cloudkitty_processor_init_overrides: {} + ## Service Name-Group Mapping cloudkitty_services: cloudkitty-api: group: cloudkitty_api service_name: cloudkitty-api + init_config_overrides: "{{ cloudkitty_api_init_overrides }}" cloudkitty-processor: group: cloudkitty_api service_name: cloudkitty-processor + init_config_overrides: "{{ cloudkitty_processor_init_overrides }}" cloudkitty_pip_packages: - cloudkitty diff --git a/releasenotes/notes/cloudkitty-init-config-overrides-ffce7e419061c4da.yaml b/releasenotes/notes/cloudkitty-init-config-overrides-ffce7e419061c4da.yaml new file mode 100644 index 0000000..fc6f32d --- /dev/null +++ b/releasenotes/notes/cloudkitty-init-config-overrides-ffce7e419061c4da.yaml @@ -0,0 +1,10 @@ +--- +features: + - New variables have been added to allow a deployer to customize + a cloudkitty systemd unit file to their liking. + - The task dropping the cloudkitty systemd unit files now uses the + ``config_template`` action plugin allowing deployers access to + customize the unit files as they see fit without having to + load extra options into the defaults and polute the generic + systemd unit file with jinja2 variables and conditionals. + diff --git a/tasks/cloudkitty_init_systemd.yml b/tasks/cloudkitty_init_systemd.yml index 2882c90..43ae0db 100644 --- a/tasks/cloudkitty_init_systemd.yml +++ b/tasks/cloudkitty_init_systemd.yml @@ -44,12 +44,14 @@ when: inventory_hostname in groups[item.value.group] - name: Place the systemd init script - template: + config_template: src: "cloudkitty-systemd-init.j2" dest: "/etc/systemd/system/{{ item.value.service_name }}.service" mode: "0644" owner: "root" group: "root" + config_overrides: "{{ item.value.init_config_overrides }}" + config_type: "ini" with_dict: "{{ cloudkitty_services }}" when: inventory_hostname in groups[item.value.group] notify: diff --git a/templates/cloudkitty-systemd-init.j2 b/templates/cloudkitty-systemd-init.j2 index b5ee2ba..7fc898a 100644 --- a/templates/cloudkitty-systemd-init.j2 +++ b/templates/cloudkitty-systemd-init.j2 @@ -21,5 +21,14 @@ TimeoutSec=300 Restart=on-failure RestartSec=150 +# This creates a specific slice which all services will operate from +# The accounting options give us the ability to see resource usage through +# the `systemd-cgtop` command. +Slice=cloudkitty.slice +CPUAccounting=true +BlockIOAccounting=true +MemoryAccounting=false +TasksAccounting=true + [Install] WantedBy=multi-user.target

AltStyle によって変換されたページ (->オリジナル) /