openstack-ansible/playbooks/roles/lxc_container_create
Major Hayden 5e6dea8ab6 Used named veth pairs that match container
The default veth names from LXC make it difficult to tell which veth
corresponds to each container.  This patch sets a unique veth name
that matches the container as well as the network device inside the
container.  It should make troubleshooting a little easier.

Oddly enough, this patch seems to fix or greatly reduce the occurence
of the issues seen in ticket 1491440.

Partial-Bug: 1491440
Implements: blueprint named-veths
Change-Id: I28553fd1b4f36991e11d55d56c3f0f46af9e52be
2015-09-02 10:36:17 -05:00
..
defaults Merge "Add support for specifying custom static routes" 2015-06-30 21:17:15 +00:00
handlers Updated ansible to use the latest stable release 2015-04-08 08:29:53 +01:00
meta Convert existing roles into galaxy roles 2015-02-18 10:56:25 +00:00
tasks Used named veth pairs that match container 2015-09-02 10:36:17 -05:00
templates Used named veth pairs that match container 2015-09-02 10:36:17 -05:00
CONTRIBUTING.rst Convert existing roles into galaxy roles 2015-02-18 10:56:25 +00:00
LICENSE Convert existing roles into galaxy roles 2015-02-18 10:56:25 +00:00
README.rst Convert existing roles into galaxy roles 2015-02-18 10:56:25 +00:00

OpenStack LXC container create

tags

openstack, lxc, container, cloud, ansible

category

*nix

Role for creating LXC containers. This role has been setup for use in OpenStack. This role will create several directories on the LXC host for use in bind mounted storage within the container.

Example Play:
- name: Create container(s)
  hosts: all_containers
  gather_facts: false
  user: root
  roles:
    - { role: "lxc_container_create", tags: [ "lxc-container-create" ] }
Example Inventory:
{
    "all_containers": {
        "children": [
            "group_of_containers"
        ],
        "hosts": []
    },
    "lxc_hosts": {
        "children": [],
        "hosts": [
            "infra1"
        ]
    },
    "group_of_containers": {
        "children": [],
        "hosts": [
            "container1"
        ]
    },
    "_meta": {
        "hostvars": {
            "infra1": {
                "ansible_ssh_host": "192.168.0.1",
                "container_address": "192.168.0.1",
                "container_name": "infra1",
                "container_networks": {
                    "management_address": {
                        "bridge": "br-mgmt",
                        "interface": "eth1",
                        "netmask": "255.255.252.0",
                        "type": "veth"
                    }
                },
                "properties": {
                    "container_release": "trusty",
                    "is_metal": true
                }
            },
            "container1": {
                "ansible_ssh_host": "10.0.0.1",
                "container_address": "10.0.0.1",
                "container_name": "container1",
                "container_networks": {
                    "management_address": {
                        "address": "10.0.0.1",
                        "bridge": "br-mgmt",
                        "interface": "eth1",
                        "netmask": "255.255.252.0",
                        "type": "veth"
                    }
                },
                "physical_host": "infra1",
                "physical_host_group": "lxc_hosts",
                "properties": {
                    "container_release": "trusty",
                }
            }
        }
    }
}