Fix dhcp job

Change-Id: Ibb1d32ae8b69e9ad47db55d455fb3d7f0cfc4219
This commit is contained in:
Riccardo Pittau 2020-03-11 11:10:00 +01:00
parent 21cb4ea6fc
commit a47c553e05
4 changed files with 13 additions and 7 deletions

View File

@ -51,6 +51,7 @@
mode: 0644
when: inventory_dhcp | bool == true
become: yes
- name: "Setup DNS address for nodes."
template:
src: dns-address.j2
@ -60,12 +61,14 @@
mode: 0644
when: inventory_dns | bool == true
become: yes
- name: "Restarting dnsmasq"
service:
name: dnsmasq
state: restarted
become: yes
when: (inventory_dhcp | bool == true) or (inventory_dns | bool == true)
- name: "Deploy to hardware - Using custom instance_info."
os_ironic_node:
auth_type: "{{ auth_type | default(omit) }}"
@ -78,6 +81,7 @@
wait: "{{ wait_for_node_deploy }}"
timeout: " {{ wait_timeout | default(1800) }}"
when: instance_info is defined and instance_info | to_json != '{}'
- name: "Collect the checksum of the deployment image."
stat:
path: "{{ deploy_image }}"
@ -86,9 +90,11 @@
register: test_deploy_image
become: yes
when: instance_info is not defined or ( instance_info is defined and instance_info | to_json == '{}' )
- name: "Error if deploy_image is not present, and instance_info is not defined"
fail: msg="The user-defined deploy_image, which is the image to be written to the remote node(s) upon deployment, was not found. Cannot proceed."
when: instance_info is not defined and test_deploy_image.stat.exists | bool == false
- name: "Deploy to hardware - bifrost default"
os_ironic_node:
cloud: "{{ cloud_name | default(omit) }}"
@ -102,7 +108,6 @@
image_source: "{{ deploy_url_protocol }}://{{ hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address'] }}:{{ file_url_port }}/{{deploy_image_filename}}"
image_checksum: "{{ test_deploy_image.stat.checksum }}"
image_disk_format: "qcow2"
root_gb: 10
wait: "{{ wait_for_node_deploy }}"
timeout: " {{ wait_timeout | default(1800) }}"
when: instance_info is not defined or ( instance_info is defined and instance_info | to_json == '{}' )

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#
# Copyright (c) 2016 Hewlett-Packard Enterprise Development Company LP
#
# Licensed under the Apache License, Version 2.0 (the "License");
@ -121,5 +119,6 @@ def main(argv):
sys.exit(0)
if __name__ == "__main__":
main(sys.argv[1:])

View File

@ -15,3 +15,5 @@
- name: Execute python dhcp check file
become: true
script: test-dhcp.py "{{inventory_dhcp}}" "{{inventory_dhcp_static_ip}}"
args:
executable: "{{ansible_python.executable}}"

View File

@ -106,10 +106,11 @@ if [ ${USE_DHCP} = "true" ]; then
VM_MEMORY_SIZE="1024"
ENABLE_INSPECTOR=false
INSPECT_NODES=false
TEST_VM_NUM_NODES=5
TEST_VM_NUM_NODES=3
INVENTORY_DHCP=true
INVENTORY_DHCP_STATIC_IP=true
WRITE_INTERFACES_FILE=false
VM_DISK=12
elif [ ${BUILD_IMAGE} = "true" ]; then
USE_CIRROS=false
TESTING_USER=root
@ -152,16 +153,15 @@ ${ANSIBLE} -vvvv \
-e test_vm_num_nodes=${TEST_VM_NUM_NODES} \
-e test_vm_memory_size=${VM_MEMORY_SIZE} \
-e test_vm_domain_type=${VM_DOMAIN_TYPE} \
-e test_vm_disk_gib=${VM_DISK:-10} \
-e baremetal_json_file=${BAREMETAL_DATA_FILE} \
-e enable_venv=${ENABLE_VENV} \
-e bifrost_venv_dir=${VENV}
if [ ${USE_DHCP} = "true" ]; then
# reduce the number of nodes in JSON file
# to limit number of nodes to enroll for testing purposes
python $BIFROST_HOME/scripts/split_json.py 3 \
python $BIFROST_HOME/scripts/split_json.py 2 \
${BAREMETAL_DATA_FILE} \
${BAREMETAL_DATA_FILE}.new \
${BAREMETAL_DATA_FILE}.rest \