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

View File

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