Merge "pass user_data to heat template"
[yardstick.git] / ansible / roles / cpu_pin_local_setup / tasks / main.yaml
1 ---
2 ##############################################################################
3 # Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
4 #
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10
11 - name: get nova-compute host
12   shell:
13     source /etc/yardstick/openstack.creds;
14     openstack availability zone list --long | grep nova-compute | sort | awk '{print $7}';
15   args:
16       executable: /bin/bash
17   register: compute_nodes
18
19 - name: get existing flavor list
20   shell:
21     source /etc/yardstick/openstack.creds;
22     openstack flavor list | grep "True" | cut -f 2 -d ' ';
23   args:
24       executable: /bin/bash
25   register: flavors
26
27 - name: create pinned-cpu and regular host aggregate
28   shell:
29     source /etc/yardstick/openstack.creds;
30     openstack aggregate create pinned-cpu;
31     openstack aggregate create regular;
32     nova aggregate-set-metadata pinned-cpu pinned=true;
33     nova aggregate-set-metadata regular pinned=false;
34     nova aggregate-add-host pinned-cpu {{ compute_nodes.stdout_lines[0] }};
35     nova aggregate-add-host regular {{ compute_nodes.stdout_lines[1] }};
36   args:
37       executable: /bin/bash
38
39 - name: set flavor default property
40   shell:
41     source /etc/yardstick/openstack.creds;
42     openstack flavor set --property aggregate_instance_extra_specs:pinned=false {{item}};
43   args:
44       executable: /bin/bash
45   with_items:
46       - '{{ flavors.stdout_lines }}'
47
48 - name: create flavor yardstick-pinned-flavor
49   os_nova_flavor:
50     cloud: opnfv
51     state: present
52     name: yardstick-pinned-flavor
53     ram: 512
54     vcpus: 3
55     disk: 3
56
57 - name: set yardstick-pinned-flavor property
58   shell:
59     source /etc/yardstick/openstack.creds;
60     openstack flavor set --property hw:cpu_policy=dedicated yardstick-pinned-flavor;
61     openstack flavor set --property aggregate_instance_extra_specs:pinned=true yardstick-pinned-flavor;
62   args:
63       executable: /bin/bash