diff --git a/playbooks/inventory/group_vars/hosts.yml b/playbooks/inventory/group_vars/hosts.yml index a4fba209e5..207752dbec 100644 --- a/playbooks/inventory/group_vars/hosts.yml +++ b/playbooks/inventory/group_vars/hosts.yml @@ -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" diff --git a/playbooks/lxc-containers-create.yml b/playbooks/lxc-containers-create.yml index 7ef0a661be..e518348a19 100644 --- a/playbooks/lxc-containers-create.yml +++ b/playbooks/lxc-containers-create.yml @@ -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') }}" diff --git a/releasenotes/notes/RFC-1034-and-1035-container-update-6e880e4b45e11cf0.yaml b/releasenotes/notes/RFC-1034-and-1035-container-update-6e880e4b45e11cf0.yaml new file mode 100644 index 0000000000..ee1204571c --- /dev/null +++ b/releasenotes/notes/RFC-1034-and-1035-container-update-6e880e4b45e11cf0.yaml @@ -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``.