e12f665f45
Metalsmith no longer requires the checksum for file based URLs[1], so this change removes the calculation of the checksum for the default image. Since the image is already on disk having a checksum adds no protection, and may even be a valid checksum for a corrupt image. [1] https://review.opendev.org/#/c/749719/ Change-Id: I4d70e8cb78470badc483ecb4ad473bbb478fd028
141 lines
4.8 KiB
YAML
141 lines
4.8 KiB
YAML
---
|
|
# Copyright 2020 Red Hat, Inc.
|
|
# All Rights Reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
#
|
|
- name: Overcloud Node Provision
|
|
connection: "{{ (tripleo_target_host is defined) | ternary('ssh', 'local') }}"
|
|
hosts: "{{ tripleo_target_host | default('localhost') }}"
|
|
remote_user: "{{ tripleo_target_user | default(lookup('env', 'USER')) }}"
|
|
gather_facts: "{{ (tripleo_target_host is defined) | ternary(true, false) }}"
|
|
any_errors_fatal: true
|
|
vars:
|
|
node_timeout: 3600
|
|
concurrency: 20
|
|
|
|
pre_tasks:
|
|
- fail:
|
|
msg: stack_name is a required input
|
|
when:
|
|
- stack_name is undefined
|
|
- fail:
|
|
msg: baremetal_deployment is a required input
|
|
when:
|
|
- baremetal_deployment is undefined
|
|
- fail:
|
|
msg: baremetal_deployed_path is a required input
|
|
when:
|
|
- baremetal_deployed_path is undefined
|
|
|
|
tasks:
|
|
- name: Detect default overcloud-full image
|
|
block:
|
|
- name: stat overcloud-full.raw
|
|
stat:
|
|
path: /var/lib/ironic/images/overcloud-full.raw
|
|
get_checksum: false
|
|
register: overcloud_full_stat
|
|
|
|
- name: stat overcloud-full.initrd
|
|
stat:
|
|
path: /var/lib/ironic/images/overcloud-full.initrd
|
|
get_checksum: false
|
|
register: overcloud_full_initrd_stat
|
|
|
|
- name: Set file based default image
|
|
set_fact:
|
|
default_image:
|
|
href: file:///var/lib/ironic/images/overcloud-full.raw
|
|
kernel: file:///var/lib/ironic/images/overcloud-full.vmlinuz
|
|
ramdisk: file:///var/lib/ironic/images/overcloud-full.initrd
|
|
when:
|
|
- overcloud_full_stat.stat.exists|bool
|
|
- overcloud_full_initrd_stat.stat.exists|bool
|
|
|
|
- name: Set whole-disk file based default image
|
|
set_fact:
|
|
default_image:
|
|
href: file:///var/lib/ironic/images/overcloud-full.raw
|
|
when:
|
|
- overcloud_full_stat.stat.exists|bool
|
|
- not overcloud_full_initrd_stat.stat.exists|bool
|
|
|
|
- name: Set glance based default image
|
|
set_fact:
|
|
default_image:
|
|
href: overcloud-full
|
|
when: not overcloud_full_stat.stat.exists|bool
|
|
|
|
- name: Expand roles
|
|
tripleo_baremetal_expand_roles:
|
|
baremetal_deployment: "{{ baremetal_deployment }}"
|
|
state: present
|
|
stack_name: "{{ stack_name }}"
|
|
ssh_public_keys: "{{ ssh_public_keys }}"
|
|
user_name: "{{ ssh_user_name }}"
|
|
default_image: "{{ default_image }}"
|
|
register: baremetal_instances
|
|
|
|
- name: Find existing instances
|
|
tripleo_baremetal_check_existing:
|
|
instances: "{{ baremetal_instances.instances }}"
|
|
register: baremetal_existing
|
|
|
|
- name: Reserve instances
|
|
metalsmith_instances:
|
|
instances: "{{ baremetal_existing.not_found }}"
|
|
state: reserved
|
|
clean_up: true
|
|
log_level: info
|
|
register: baremetal_reserved
|
|
|
|
- name: Metalsmith log for reserve instances
|
|
debug:
|
|
var: baremetal_reserved.logging
|
|
|
|
# NOTE(cloudnull): This limits the concurrency so that we're not adding
|
|
# more threads than needed.
|
|
- name: Set concurrency fact
|
|
set_fact:
|
|
runtime_concurrency: "{{
|
|
((concurrency | int) > (baremetal_reserved.instances | length)) |
|
|
ternary((baremetal_reserved.instances | length), (concurrency | int))
|
|
}}"
|
|
|
|
- name: Provision instances
|
|
metalsmith_instances:
|
|
instances: "{{ baremetal_reserved.instances }}"
|
|
state: present
|
|
wait: true
|
|
clean_up: false
|
|
timeout: "{{ node_timeout }}"
|
|
concurrency: "{{ runtime_concurrency }}"
|
|
log_level: info
|
|
register: baremetal_provisioned
|
|
|
|
- name: Metalsmith log for provision instances
|
|
debug:
|
|
var: baremetal_provisioned.logging
|
|
|
|
- name: Populate environment
|
|
tripleo_baremetal_populate_environment:
|
|
environment: "{{ baremetal_instances.environment }}"
|
|
instances: "{{ baremetal_provisioned.instances + baremetal_existing.instances }}"
|
|
register: baremetal_environment
|
|
|
|
- name: Write environment to {{ baremetal_deployed_path }}
|
|
copy:
|
|
dest: "{{ baremetal_deployed_path }}"
|
|
content: "{{ baremetal_environment.environment | default({}) | to_nice_yaml(indent=2) }}"
|