3cba98b6b47b6f569917c9a3cf8dbbf926f2f96c
[releng.git] / prototypes / bifrost / playbooks / opnfv-virtual.yaml
1 # SPDX-license-identifier: Apache-2.0
2 ##############################################################################
3 # Copyright (c) 2016 RedHat and others.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
9 ---
10 - hosts: localhost
11   connection: local
12   name: "Setting pre-test conditions"
13   become: yes
14   ignore_errors: yes
15   tasks:
16   - name: Remove pre-existing leases file
17     file: path=/var/lib/misc/dnsmasq.leases state=absent
18 - hosts: localhost
19   connection: local
20   name: "Executes install, enrollment, and testing in one playbook"
21   become: no
22   gather_facts: yes
23   pre_tasks:
24     - name: "Override the ipv4_gateway setting"
25       set_fact:
26          ipv4_gateway: "192.168.122.1"
27   roles:
28     - { role: bifrost-prep-for-install, when: skip_install is not defined }
29   environment:
30     http_proxy: "{{ lookup('env','http_proxy') }}"
31     https_proxy: "{{ lookup('env','https_proxy') }}"
32 - hosts: localhost
33   connection: local
34   name: "Executes install, enrollment, and testing in one playbook"
35   become: yes
36   gather_facts: yes
37   roles:
38     - role: bifrost-keystone-install
39     - role: bifrost-ironic-install
40       cleaning: false
41       testing: true
42     # NOTE(TheJulia): While the next step creates a ramdisk, some elements
43     # do not support ramdisk-image-create as they invoke steps to cleanup
44     # the ramdisk which causes ramdisk-image-create to believe it failed.
45     - role: bifrost-create-dib-image
46       dib_imagename: "{{ http_boot_folder }}/ipa"
47       build_ramdisk: false
48       dib_os_element: "{{ ipa_dib_os_element|default('debian') }}"
49       dib_os_release: "jessie"
50       dib_elements: "ironic-agent {{ ipa_extra_dib_elements | default('') }}"
51       dib_notmpfs: true
52       when: create_ipa_image | bool == true
53     - role: bifrost-create-dib-image
54       dib_imagetype: "qcow2"
55       dib_imagename: "{{deploy_image}}"
56       dib_os_element: "{{ lookup('env','DIB_OS_ELEMENT') }}"
57       dib_os_release: "{{ lookup('env', 'DIB_OS_RELEASE') }}"
58       extra_dib_elements: "{{ lookup('env', 'EXTRA_DIB_ELEMENTS') | default('') }}"
59       dib_elements: "vm enable-serial-console simple-init devuser growroot {{ extra_dib_elements }}"
60       dib_packages: "{{ lookup('env', 'DIB_OS_PACKAGES') }}"
61       dib_notmpfs: true
62       when: create_image_via_dib | bool == true and transform_boot_image | bool == false
63     - role: bifrost-keystone-client-config
64       user: "{{ ansible_env.SUDO_USER }}"
65       clouds:
66         bifrost:
67           config_username: "{{ ironic.keystone.default_username }}"
68           config_password: "{{ ironic.keystone.default_password }}"
69           config_project_name: "baremetal"
70           config_region_name: "{{ keystone.bootstrap.region_name }}"
71           config_auth_url: "{{ keystone.bootstrap.public_url }}"
72   environment:
73     http_proxy: "{{ lookup('env','http_proxy') }}"
74     https_proxy: "{{ lookup('env','https_proxy') }}"
75 - hosts: baremetal
76   name: "Enroll node with Ironic"
77   become: no
78   connection: local
79   roles:
80     - role: ironic-enroll-dynamic
81     - { role: ironic-inspect-node, when: inspect_nodes | default('false') | bool == true }
82 - hosts: baremetal
83   name: "Create configuration drive files and deploy machines"
84   vars:
85     multinode_testing: "{{ inventory_dhcp | bool == true }}"
86   become: no
87   connection: local
88   roles:
89     - role: bifrost-configdrives-dynamic
90     - role: bifrost-deploy-nodes-dynamic
91 - hosts: baremetal
92   name: "Deploy machines."
93   become: no
94   connection: local
95   serial: 1
96   roles:
97     - role: bifrost-prepare-for-test-dynamic