Use default CPU allocation for default CPU pool
[ta/caas-cpupooler.git] / ansible / roles / cpupooler / templates / cpu_pooler_config.yaml.j2
1 #jinja2: lstrip_blocks: True
2 {#
3 Copyright 2019 Nokia
4
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8
9     http://www.apache.org/licenses/LICENSE-2.0
10
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16 #}
17 ---
18 {% for hostname, hostdata in hostvars.iteritems() %}
19   {% if hostname != "localhost" %}
20 {{ hostname }}:
21   pools:
22     {% set cpu_allocation = hostdata.get('ansible_local', {}).get('cpu_allocation', {}) %}
23     {% for allocation_name, allocation in cpu_allocation.iteritems() %}
24       {% if allocation_name in cpu_allocation_mapping %}
25     {{ cpu_allocation_mapping[allocation_name]['pool_name'] }}:
26       cpus: "{{ allocation.get('list', '') }}"
27       {% endif %}
28     {% endfor %}
29   nodeSelector:
30     nodename: "{{ hostdata['nodename'] | default('') }}"
31   {% endif %}
32 {% endfor %}