diff --git a/defaults/main.yml b/defaults/main.yml index 3fc8aaa7..ca3d1d4b 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -217,14 +217,19 @@ glance_pip_packages: - python-swiftclient - warlock +glance_api_init_overrides: {} +glance_registry_init_overrides: {} + ## Service Names glance_services: glance-api: group: glance_api service_name: glance-api + init_config_overrides: "{{ glance_api_init_overrides }}" glance-registry: group: glance_registry service_name: glance-registry + init_config_overrides: "{{ glance_registry_init_overrides }}" # This variable is used by the repo_build process to determine # which host group to check for members of before building the diff --git a/releasenotes/notes/glance-init-config-overrides-ffce7e419061c4da.yaml b/releasenotes/notes/glance-init-config-overrides-ffce7e419061c4da.yaml new file mode 100644 index 00000000..10f6db86 --- /dev/null +++ b/releasenotes/notes/glance-init-config-overrides-ffce7e419061c4da.yaml @@ -0,0 +1,10 @@ +--- +features: + - New variables have been added to allow a deployer to customize + a glance systemd unit file to their liking. + - The task dropping the glance 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/glance_init_systemd.yml b/tasks/glance_init_systemd.yml index cce37a2b..e9cf8cf0 100644 --- a/tasks/glance_init_systemd.yml +++ b/tasks/glance_init_systemd.yml @@ -54,12 +54,14 @@ when: inventory_hostname in groups[item.value.group] - name: Place the systemd init script - template: + config_template: src: "glance-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: "{{ glance_services }}" when: inventory_hostname in groups[item.value.group] notify: diff --git a/templates/glance-systemd-init.j2 b/templates/glance-systemd-init.j2 index d94125d3..9811d2f7 100644 --- a/templates/glance-systemd-init.j2 +++ b/templates/glance-systemd-init.j2 @@ -21,5 +21,14 @@ TimeoutSec=300 Restart=on-failure RestartSec=150 +# This creates a specific slice which all nova services will operate from +# The accounting options give us the ability to see resource usage through +# the `systemd-cgtop` command. +Slice=glance.slice +CPUAccounting=true +BlockIOAccounting=true +MemoryAccounting=false +TasksAccounting=true + [Install] WantedBy=multi-user.target