Role lxc_container_create for OpenStack-Ansible
Go to file
Jesse Pretorius 23830066ad Test container creation based on IP address
This test executes an LXC container listing from the LXC host, then
verifies that the container is present by name and IP address.

The test will work whether there is one or more IP addresses in
each containers created.

This patch also includes the following in order to unblock testing
for this role:
 - A forced apt-get update
 - A base other-requirements.txt file to ensure that the
   OpenStack-CI fallback requirements aren't used, which conflict
   with LXC and cause the instance to hang.

Change-Id: I2619b1090300a161c108fcc3f65059e8d50c851e
2016-03-05 23:05:35 +00:00
defaults Ability to define the mtu globally (for all the container networks) 2015-12-02 17:22:17 +01:00
doc Updates for typos 2015-12-08 16:50:45 -06:00
handlers IRR for lxc_container_create 2015-11-03 08:00:45 -06:00
meta IRR for lxc_container_create 2015-11-03 08:00:45 -06:00
tasks Reformat YAML condition to list 2016-03-02 10:45:34 -05:00
templates Remove unwanted veth pair creation from lxc_container_create role 2016-01-07 14:20:46 -05:00
tests Test container creation based on IP address 2016-03-05 23:05:35 +00:00
.gitignore New git dotfiles for independant repository 2015-11-26 00:43:02 +00:00
.gitreview New git dotfiles for independant repository 2015-11-26 00:43:02 +00:00
CONTRIBUTING.rst IRR for lxc_container_create 2015-11-03 08:00:45 -06:00
LICENSE IRR for lxc_container_create 2015-11-03 08:00:45 -06:00
other-requirements.txt Test container creation based on IP address 2016-03-05 23:05:35 +00:00
README.rst IRR for lxc_container_create 2015-11-03 08:00:45 -06:00
run_tests.sh Update run_tests to be more complete 2015-12-09 13:41:26 +00:00
setup.cfg Updates for typos 2015-12-08 16:50:45 -06:00
setup.py IRR for lxc_container_create 2015-11-03 08:00:45 -06:00
test-requirements.txt Update tox config and add bashate E006, E040 exceptions 2016-02-12 11:30:15 +00:00
tox.ini Update tox config and add bashate E006, E040 exceptions 2016-02-12 11:30:15 +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",
                }
            }
        }
    }
}