Fix container hostname for RFC 1034/1035

In lxc-container create this update will ensure we're using good
hostnames. This is required in some logging cases as well as SSL.
This will also allow a deployer to customize the domain name
based on their needs.

A new variable has been created called ``lxc_container_domain``
with a default value of "openstack.local". This change has no
upgrade impact as its being done as part of the post_tasks within
the container create play and any changes that need to happen
within an existing environment will be automatically taken care
of within impacting the functionality of an existing deployment.

Change-Id: Ib31a48dd480ecb376a6a8c5b35b09dfa5d2e58f6
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
(cherry picked from commit 9a737adb97)
This commit is contained in:
Kevin Carter 2016-04-17 00:45:13 -05:00 committed by Jesse Pretorius (odyssey4me)
parent c17b4ff5db
commit 48c7b1553c
3 changed files with 39 additions and 0 deletions

View File

@ -40,6 +40,7 @@ openstack_repo_git_url: "http://{{ internal_lb_vip_address }}:{{ repo_server_por
## LXC options
lxc_container_domain: "openstack.local"
lxc_container_caches:
- url: "https://rpc-repo.rackspace.com/container_images/rpc-trusty-container.tgz"
name: "trusty.tgz"

View File

@ -30,6 +30,29 @@
delay: 1
tags:
- lxc-container-wait-for-ssh
- name: Create domain config
lineinfile:
dest: "/etc/hosts"
regexp: "^127.0.1.1"
line: "127.0.1.1 {{ inventory_hostname | replace('_', '-') }}.{{ lxc_container_domain }} {{ inventory_hostname | replace('_', '-') }}"
owner: "root"
group: "root"
mode: "0644"
tags:
- lxc-container-hostname
- name: Create hostname
copy:
dest: "/etc/hostname"
content: "{{ inventory_hostname | replace('_', '-') }}"
owner: "root"
group: "root"
mode: "0644"
tags:
- lxc-container-hostname
- name: Setup hostname
command: hostname -F /etc/hostname
tags:
- lxc-container-hostname
vars:
is_metal: "{{ properties.is_metal|default(false) }}"
lxc_container_release: "{{ properties.container_release|default('trusty') }}"

View File

@ -0,0 +1,15 @@
---
features:
- LXC containers will now have a proper RFC1034/5 hostname set during post
build tasks. A localhost entry for 127.0.1.1 will be created by converting
all of the "_" in the ``inventory_hostname`` to "-". Containers will be
created with a default domain of *openstack.local*.
This domain name can be customized to meet your deployment needs by
setting the option ``lxc_container_domain``.
upgrade:
- LXC containers will now have a proper RFC1034/5 hostname set during post
build tasks. A localhost entry for 127.0.1.1 will be created by converting
all of the "_" in the ``inventory_hostname`` to "-". Containers will be
created with a default domain of *openstack.local*.
This domain name can be customized to meet your deployment needs by
setting the option ``lxc_container_domain``.