remove loop control when running include_role

When running an included role with_items + loop control is slow. This
change feeds the role the entire list of curated services which will
improve execution speed, especially when dealing with hundreds of hosts.

Change-Id: I6258d23300c8b26469f8480aa042d53b91d90ad1
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
Kevin Carter 2018-10-04 00:44:56 -05:00
parent f88a41dc92
commit ca6b0d729a
No known key found for this signature in database
GPG Key ID: 9443251A787B9FB3
1 changed files with 16 additions and 10 deletions

View File

@ -114,16 +114,22 @@
systemd_BlockIOAccounting: true
systemd_MemoryAccounting: true
systemd_TasksAccounting: true
systemd_services:
- service_name: "{{ service_var.service_name }}"
enabled: yes
state: started
execstarts: "{{ service_var.execstarts }}"
execreloads: "{{ service_var.execreloads | default([]) }}"
config_overrides: "{{ swift_service_defaults | combine(service_var.init_config_overrides) }}"
with_items: "{{ filtered_swift_services }}"
loop_control:
loop_var: service_var
systemd_services: |-
{% set services = [] %}
{% for service in filtered_swift_services %}
{%
set _ = service.update(
{
'enabled': 'yes',
'state': 'started',
'config_overrides': swift_service_defaults | combine(service.init_config_overrides)
}
)
%}
{% set _ = service.pop('init_config_overrides') -%}
{% set _ = services.append(service) -%}
{% endfor %}
{{ services }}
tags:
- swift-config
- systemd-service