openstack-ansible/playbooks/roles/lxc_container_create
Kevin Carter ef0d28eb80 Adds the ability to define repositories within a container
This change implements the ability to set the apt repositories
within a container upon container create from both a deployed
image as well as when using the lxc-openstack container build
template.

* There are two new namespaced variables that set the main
  and security repositories for Ubuntu. These two variables
  are the same in both the `lxc_container_create` and `lxc_hosts`
  roles. These two new variables have been set as defaults in their
  respective roles.

* The method by which the template and container create deploy the
  repositories within the container is the same. The old sources list
  is removed and the new entries are created. This will provide a
  consistent experience between hosts and containers as they can now
  use the same repositories without human intervention.

With this change it will now be possible to deploy containers within
a walled garden where the apt repository may not be publicly
accessible.

Juno-Backport-Potential
Closes-Bug: #1433412
Change-Id: Iaf51a5e3919f684b20da370a9470dc45e2452d4e
2015-03-17 23:28:42 -05:00
..
defaults Adds the ability to define repositories within a container 2015-03-17 23:28:42 -05:00
handlers Convert existing roles into galaxy roles 2015-02-18 10:56:25 +00:00
meta Convert existing roles into galaxy roles 2015-02-18 10:56:25 +00:00
tasks Adds the ability to define repositories within a container 2015-03-17 23:28:42 -05:00
templates Convert existing roles into galaxy roles 2015-02-18 10:56:25 +00: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

README.rst

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",
                }
            }
        }
    }
}