Add virtual image generation to install script
[yardstick.git] / ansible / install.yaml
1 # Copyright (c) 2018 Intel Corporation.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #      http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 ---
15 - hosts: jumphost
16   become: yes
17   vars:
18     installation_mode: "{{ INSTALLATION_MODE | default('baremetal') }}"
19     yardstick_dir: "{{ YARDSTICK_DIR | default('/home/opnfv/repos/yardstick') }}"
20     virtual_environment: "{{ VIRTUAL_ENVIRONMENT | default(False) }}"
21     nsb_dir: "{{ NSB_DIR | default('/opt/nsb_bin/') }}"
22
23   pre_tasks:
24
25     - name: Create NSB binaries directory, accesible to any user
26       file:
27         path: "{{ nsb_dir }}"
28         state: directory
29         owner: root
30         mode: 0777
31
32   roles:
33     - add_repos_jumphost
34     - install_dependencies_jumphost
35     - install_yardstick
36     - configure_uwsgi
37     - configure_nginx
38     - configure_gui
39     - download_trex
40     - install_trex
41     - configure_rabbitmq
42
43   post_tasks:
44
45     - service:
46         name: nginx
47         state: restarted
48       when: installation_mode != inst_mode_container
49
50     - shell: uwsgi -i /etc/yardstick/yardstick.ini
51       when: installation_mode != inst_mode_container
52
53
54 - name: Prepare baremetal and standalone servers
55   hosts: yardstick-baremetal,yardstick-standalone
56   become: yes
57   environment: "{{ proxy_env }}"
58
59   roles:
60     - add_custom_repos
61     - role: set_package_installer_proxy
62       when: proxy_env is defined and proxy_env
63     # can't update grub in chroot/docker
64     # ?? - enable_iommu_on_boot
65     - enable_hugepages_on_boot
66     # needed for collectd plugins
67     - increase_open_file_limits
68     - install_image_dependencies
69     - role: download_dpdk
70     # dpdk_version: "17.02"
71     - install_dpdk
72     - download_trex
73     - install_trex
74     - download_civetweb
75     - install_civetweb
76     - download_samplevnfs
77     - role: install_samplevnf
78       vnf_name: PROX
79     - role: install_samplevnf
80       vnf_name: UDP_Replay
81     - role: install_samplevnf
82       vnf_name: ACL
83     - role: install_samplevnf
84       vnf_name: FW
85     - role: install_samplevnf
86       vnf_name: CGNAPT
87     # build shared DPDK for collectd only, required DPDK downloaded already
88     - install_dpdk_shared
89     - install_rabbitmq
90     - download_intel_cmt_cat
91     - install_intel_cmt_cat
92     - download_pmu_tools
93     - install_pmu_tools
94     - download_collectd
95     - install_collectd
96
97
98 - hosts: jumphost
99   become: yes
100   vars:
101     img_prop_item: "{{ IMG_PROPERTY }}"
102     img_arch: "{{ YARD_IMG_ARCH }}"
103
104   tasks:
105     - name: Include pre-build
106       include_role:
107         name: build_yardstick_image
108         tasks_from: pre_build.yml
109
110
111 - hosts: chroot_image
112   connection: chroot
113   become: yes
114   vars:
115     img_property: "{{ IMG_PROPERTY }}"
116   environment: "{{ proxy_env }}"
117
118   tasks:
119     - name: Include image build
120       include_role:
121         name: build_yardstick_image
122         tasks_from: "cloudimg_modify_{{ img_property }}.yml"
123
124
125 - hosts: jumphost
126   become: yes
127
128   tasks:
129     - name: Include post-build
130       include_role:
131         name: build_yardstick_image
132         tasks_from: post_build.yml