Merge pull request #113 from markgoddard/fix-provisioning-issues

Fix provisioning issues
This commit is contained in:
Mark Goddard 2018-01-17 10:06:27 +00:00 committed by GitHub
commit 31befe5340
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 131 additions and 18 deletions

2
.gitignore vendored
View File

@ -57,6 +57,8 @@ ansible/roles/mrlesmithjr.manage-lvm/
ansible/roles/MichaelRigart.interfaces/
ansible/roles/stackhpc.drac/
ansible/roles/stackhpc.drac-facts/
ansible/roles/stackhpc.libvirt-host/
ansible/roles/stackhpc.libvirt-vm/
ansible/roles/stackhpc.os-flavors/
ansible/roles/stackhpc.os-images/
ansible/roles/stackhpc.os-ironic-state/

View File

@ -390,12 +390,14 @@ def net_configdrive_network_device(context, name, inventory_hostname=None):
netmask = net_mask(context, name, inventory_hostname)
gateway = net_gateway(context, name, inventory_hostname)
bootproto = 'static' if ip is not None else 'dhcp'
mtu = net_mtu(context, name, inventory_hostname)
interface = {
'device': device,
'address': ip,
'netmask': netmask,
'gateway': gateway,
'bootproto': bootproto,
'mtu': mtu,
}
interface = {k: v for k, v in interface.items() if v is not None}
return interface

View File

@ -15,3 +15,15 @@ overcloud_groups: >
# As a special case, the group 'ignore' can be used to specify hosts that
# should not be added to the inventory.
overcloud_group_hosts_map: {}
###############################################################################
# Overcloud host image configuration.
# The CentOS cloud images from 7.2 (1511) onwards have a bogus name server
# entry in /etc/resolv.conf, 10.0.2.3. Cloud-init only appends name server
# entries to this file, and will not remove this bogus entry. Typically this
# leads to a delay of around 30 seconds when connecting via SSH, due to a
# timeout in NSS. The workaround employed here is to remove this bogus entry
# from the image using virt-customize, if it exists. See
# https://bugs.centos.org/view.php?id=14369.
overcloud_host_image_workaround_resolv_enabled: True

View File

@ -52,3 +52,9 @@
vars:
activate_virtualenv_path: "{{ virtualenv }}"
when: virtualenv is defined
- name: Ensure pip is installed
easy_install:
name: pip
become: True
when: virtualenv is not defined

View File

@ -39,7 +39,7 @@
# seed as a gateway to allow external access until other networks have
# been configured.
ipv4_gateway: "{{ provision_oc_net_name | net_gateway or provision_oc_net_name | net_ip(seed_host) }}"
ipv4_nameserver: "{{ resolv_nameservers[0] }}"
ipv4_nameserver: "{{ resolv_nameservers }}"
tasks:
- name: Ensure the Bifrost host variable files exist
copy:

View File

@ -60,7 +60,9 @@
owner: "{{ lookup('env', 'USER') }}"
group: "{{ lookup('env', 'USER') }}"
become: True
when: not image_cache_stat.stat.exists
when: >-
not image_cache_stat.stat.exists or
not image_cache_stat.stat.writeable
- name: Ensure Ironic Python Agent images are copied onto the local machine
fetch:

View File

@ -0,0 +1,36 @@
---
# The CentOS cloud images from 7.2 (1511) onwards have a bogus name server
# entry in /etc/resolv.conf, 10.0.2.3. Cloud-init only appends name server
# entries to this file, and will not remove this bogus entry. Typically this
# leads to a delay of around 30 seconds when connecting via SSH, due to a
# timeout in NSS. The workaround employed here is to remove this bogus entry
# from the image using virt-customize, if it exists. See
# https://bugs.centos.org/view.php?id=14369.
- name: Ensure the overcloud host image has bogus name server entries removed
hosts: seed
tags:
- overcloud-host-image-workaround
tasks:
- block:
- name: Ensure libguestfs-tools is installed
command: >
docker exec bifrost_deploy
bash -c '
ansible localhost
--connection local
--become
-m yum
-a "name=libguestfs-tools state=installed"'
- name: Ensure the overcloud host image has bogus name server entries removed
command: >
docker exec bifrost_deploy
bash -c '
export LIBGUESTFS_BACKEND=direct &&
ansible localhost
--connection local
--become
-m command
-a "virt-customize -a /httpboot/deployment_image.qcow2 --edit \"/etc/resolv.conf:s/^nameserver 10\.0\.2\.3\$//\""'
when: overcloud_host_image_workaround_resolv_enabled | bool

View File

@ -76,7 +76,9 @@
owner: "{{ ansible_user }}"
group: "{{ ansible_user }}"
become: True
when: not image_cache_stat.stat.exists
when: >-
not image_cache_stat.stat.exists or
not image_cache_stat.stat.writeable
- name: Ensure locally built Ironic Python Agent (IPA) images are copied
copy:

View File

@ -62,19 +62,6 @@ Configure the controller host::
kayobe overcloud host configure
During execution of this command, SELinux will be disabled and the VM will be
rebooted, causing you to be logged out. Wait for the VM to finish rebooting and
log in, performing the same environment setup steps as before::
vagrant ssh
source kayobe-venv/bin/activate
cd /vagrant
source kayobe-env
Run the host configuration command again to completion::
kayobe overcloud host configure
At this point, container images must be acquired. They can either be built
locally or pulled from an image repository if appropriate images are available.

View File

@ -87,6 +87,13 @@ Upgrade Notes
The previous behaviour of installing python dependencies directly to the host
can be used by setting ``kolla_ansible_target_venv`` to ``None``.
* Adds a workaround for an issue with CentOS cloud images 7.2 (1511) onwards,
which have a bogus name server entry in /etc/resolv.conf, 10.0.2.3.
Cloud-init only appends name server entries to this file, and will not remove
this bogus entry. Typically this leads to a delay of around 30 seconds when
connecting via SSH, due to a timeout in NSS. The workaround employed here is
to remove this bogus entry from the image using virt-customize, if it exists.
See https://bugs.centos.org/view.php?id=14369.
Kayobe 3.0.0
============

View File

@ -13,6 +13,18 @@
# should not be added to the inventory.
#overcloud_group_hosts_map:
###############################################################################
# Overcloud host image configuration.
# The CentOS cloud images from 7.2 (1511) onwards have a bogus name server
# entry in /etc/resolv.conf, 10.0.2.3. Cloud-init only appends name server
# entries to this file, and will not remove this bogus entry. Typically this
# leads to a delay of around 30 seconds when connecting via SSH, due to a
# timeout in NSS. The workaround employed here is to remove this bogus entry
# from the image using virt-customize, if it exists. See
# https://bugs.centos.org/view.php?id=14369.
#overcloud_host_image_workaround_resolv_enabled:
###############################################################################
# Dummy variable to allow Ansible to accept this file.
workaround_ansible_issue_8743: yes

View File

@ -450,6 +450,7 @@ class SeedServiceDeploy(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin,
* Configures the bifrost service.
* Deploys the bifrost container using kolla-ansible.
* Builds disk images for the overcloud hosts using Diskimage Builder (DIB).
* Performs a workaround in the overcloud host image to fix resolv.conf.
* Configures ironic inspector introspection rules in the bifrost inspector
service.
* When enabled, configures a Bare Metal Provisioning (BMP) environment for
@ -461,10 +462,13 @@ class SeedServiceDeploy(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin,
playbooks = _build_playbook_list("kolla-ansible")
self.run_kayobe_playbooks(parsed_args, playbooks, tags="config")
self.run_kayobe_playbook(parsed_args, "ansible/kolla-bifrost.yml")
playbooks = _build_playbook_list("kolla-bifrost")
self.run_kayobe_playbooks(parsed_args, playbooks)
self.run_kolla_ansible_seed(parsed_args, "deploy-bifrost")
playbooks = _build_playbook_list(
"seed-introspection-rules", "dell-switch-bmp")
"overcloud-host-image-workaround-resolv",
"seed-introspection-rules",
"dell-switch-bmp")
self.run_kayobe_playbooks(parsed_args, playbooks)

View File

@ -387,6 +387,47 @@ class TestCase(unittest.TestCase):
]
self.assertEqual(expected_calls, mock_run.call_args_list)
@mock.patch.object(commands.KayobeAnsibleMixin,
"run_kayobe_playbooks")
@mock.patch.object(commands.KollaAnsibleMixin,
"run_kolla_ansible_seed")
def test_service_deploy(self, mock_kolla_run, mock_run):
command = commands.SeedServiceDeploy(TestApp(), [])
parser = command.get_parser("test")
parsed_args = parser.parse_args([])
result = command.run(parsed_args)
self.assertEqual(0, result)
expected_calls = [
mock.call(
mock.ANY,
["ansible/kolla-ansible.yml"],
tags="config",
),
mock.call(
mock.ANY,
["ansible/kolla-bifrost.yml"],
),
mock.call(
mock.ANY,
[
"ansible/overcloud-host-image-workaround-resolv.yml",
"ansible/seed-introspection-rules.yml",
"ansible/dell-switch-bmp.yml",
],
),
]
self.assertEqual(expected_calls, mock_run.call_args_list)
expected_calls = [
mock.call(
mock.ANY,
"deploy-bifrost",
),
]
self.assertEqual(expected_calls, mock_kolla_run.call_args_list)
@mock.patch.object(commands.KayobeAnsibleMixin,
"run_kayobe_config_dump")
@mock.patch.object(commands.KayobeAnsibleMixin,