Fix the undercloud-containers job

The undercloud installer (when using --heat-native) can configure
its own docker settings.

Also, use yum install to add required packages until we can get these
installed via RDO.

Ensure the /etc/hosts file is cleaned out for the undercloud deployment

Co-Authored-By: Wes Hayutin <weshayutin@gmail.com>

Depends-On: I2d569eef136254dc81bdee93a7869fd361a8400d
Change-Id: I583128ef8fb986a08ea372344ed072e506b97d89
This commit is contained in:
Dan Prince
2017-11-13 13:19:47 -05:00
committed by Wes Hayutin
parent aebbc6494a
commit 86ceb2b356
5 changed files with 52 additions and 11 deletions

View File

@@ -2,6 +2,7 @@
overcloud_ipv6: false
containerized_overcloud: false
containerized_undercloud: false
containerized_overcloud_upgrade: false
local_docker_registry_host: "{{undercloud_network_gateway|default(undercloud_network_cidr|nthhost(1))}}"
docker_registry_namespace: tripleoupstream

View File

@@ -52,11 +52,6 @@ glance image-create --container-format bare \
{% endif %}
## .. note:: Workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1391602
## ::
sudo systemctl restart openstack-ironic-conductor && sleep 30
{% if step_register|bool %}
## * Register nodes with Ironic.

View File

@@ -49,11 +49,27 @@ EOF_CAT
sudo yum update -y {{ undercloud_update_packages }}
{% endif %}
# TODO: remove this once we land patch to install them via RPM
sudo yum install -y \
openstack-heat-api \
openstack-heat-engine \
openstack-heat-monolith \
python-heat-agent \
python-heat-agent-apply-config \
python-heat-agent-ansible \
python-heat-agent-hiera \
python-heat-agent-puppet \
python-heat-agent-docker-cmd \
python-heat-agent-json-file \
python-ipaddr \
python-tripleoclient \
openvswitch \
openstack-puppet-modules
## * Start the required services.
## ::
sudo systemctl start openvswitch
sudo systemctl start docker #FIXME: do these in the installer?
## * Update the puppet modules or install custom modules.
## NOTE: breaks installed packages, is a pure hack in for dev envs only!
@@ -68,6 +84,14 @@ sudo systemctl start docker #FIXME: do these in the installer?
#cd "${MODULE_PATH}"
#git clone -b dev https://github.com/foo/puppet-bar bar
## * get build id
## ::
{% if get_build_command is defined: %}
BUILD_ID={{ get_build_command }}
{% else %}
BUILD_ID={{ docker_image_tag }}
{% endif %}
# Copy installed/cloned modules and make a symlink
#sudo rsync -avxH "${MODULE_PATH}" /usr/share/openstack-puppet/
sudo mkdir -p /etc/puppet/modules/
@@ -85,7 +109,6 @@ openstack overcloud container image prepare \
-e {{overcloud_templates_path}}/environments/docker.yaml \
{% endif %}
-r {{undercloud_roles_data}} \
--namespace {{ undercloud_docker_registry_host }}:{{ undercloud_docker_registry_port }}/{{ undercloud_docker_registry_namespace }}
{% else %}
openstack overcloud container image prepare \
{% if containerized_undercloud|bool %}
@@ -95,6 +118,8 @@ openstack overcloud container image prepare \
-e {{overcloud_templates_path}}/environments/docker.yaml \
{% endif %}
-r {{undercloud_roles_data}} \
--namespace {{ docker_registry_host }}/{{ docker_registry_namespace }} \
--tag $BUILD_ID \
--env-file {{ working_dir }}/undercloud-containers-default-parameters.yaml
{% endif %}
@@ -115,6 +140,7 @@ undercloud_local_ip={{ hostvars['undercloud'].undercloud_ip }}
# starts supporting 'openstack undercloud deploy -r' option.
sudo openstack undercloud deploy \
--heat-native \
--templates={{overcloud_templates_path}} \
--local-ip=$undercloud_local_ip \
-e {{ working_dir }}/custom_undercloud_deploy.yaml \

View File

@@ -1,4 +1,15 @@
---
# sanitize the /etc/hosts file in the same way the overcloud node is.
# https://github.com/openstack-infra/tripleo-ci/blob/master/toci-quickstart/playbooks/multinode.yml#L14-L31
# for undercloud containers only
- name: Create a clean hosts file on the undercloud/slave
copy:
dest: /etc/hosts
content: |
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
become: true
when: containerized_undercloud|bool
- name: Install hostname correcting script
template:
@@ -10,3 +21,4 @@
shell: >
set -o pipefail &&
{{ working_dir }}/hostname.sh 2>&1 {{ timestamper_cmd }} > {{ working_dir }}/hostname.sh.log
become: true

View File

@@ -3,22 +3,29 @@ set -eux
### --start_docs
## Adjust the hostname as necessary (usually on the undercloud)
## Note.. run this script with sudo or root
## ============================================================
{% if hostname_correction|bool %}
## * Correct the host's transient hostname to a static one
## ::
sudo hostnamectl set-hostname --transient $(hostnamectl --static)
hostnamectl set-hostname --transient $(hostnamectl --static)
{% elif step_set_undercloud_hostname|bool %}
## * Set the host's transient and static hostnames
## ::
sudo hostnamectl set-hostname --transient {{ undercloud_hostname }}
sudo hostnamectl set-hostname --static {{ undercloud_hostname }}
hostnamectl set-hostname --transient {{ undercloud_hostname }}
hostnamectl set-hostname --static {{ undercloud_hostname }}
{% endif %}
## * Sanitize the /etc/hosts for duplicate entries
## ::
cp /etc/hosts /etc/hosts.bak
awk '!seen[$0]++' /etc/hosts > /etc/hosts.new
mv -f /etc/hosts.new /etc/hosts
### --stop_docs