openstack-ansible-lxc_conta.../defaults/main.yml

82 lines
3.1 KiB
YAML

---
# Copyright 2014, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
lxc_container_config: /etc/lxc/lxc-openstack.conf
# Default container template to build from
lxc_container_template: ubuntu
# lxc container rootfs directory and cache path
lxc_container_directory: "/var/lib/lxc"
lxc_container_cache_path: "/var/cache/lxc"
lxc_container_rootfs_directory: "{{ lxc_container_directory }}/{{ container_name }}/rootfs"
# container_fs.* is only used with building on an LVM backend
lxc_container_fs_size: 5G
lxc_container_fs_type: ext4
# Default store is lvm, however will fall back to dir if the
# container_volume_group is not found.
lxc_container_backing_store: lvm
lxc_container_vg_name: lxc
# Default image to build from
lxc_container_release: trusty
lxc_container_user_name: ubuntu
lxc_container_user_password: "{{ lookup('pipe', 'date --rfc-3339=ns | sha512sum | base64 | head -c 32') }}"
lxc_container_template_options: >
--release {{ lxc_container_release }}
--user {{ lxc_container_user_name }}
--password {{ lxc_container_user_password }}
lxc_container_template_main_apt_repo: "https://mirror.rackspace.com/ubuntu"
lxc_container_template_security_apt_repo: "https://mirror.rackspace.com/ubuntu"
lxc_container_default_interfaces: |
# The loopback network interface
auto lo
iface lo inet loopback
# LXC interface, this is ALWAYS assumed to be DHCP.
auto eth0
iface eth0 inet dhcp
# Load any additional configs
source /etc/network/interfaces.d/*.cfg
# The container interface variable is a a default object that assume the
# Ansible iterator type is `with_dict`.
lxc_container_interface: |
### start generated network for [ {{ item.value.interface }} ] ###
auto {{ item.value.interface }}
{% if item.value.address is defined %}
iface {{ item.value.interface }} inet static
address {{ item.value.address }}
netmask {{ item.value.netmask }}
# needed to enable gratuitous arps on interface events
post-up sysctl -w net.ipv4.conf.$IFACE.arp_notify=1
# needed to force an interface event (setting mac to what it already is)
post-up ip link set $IFACE address $(cat /sys/class/net/$IFACE/address)
{% if item.value.gateway is defined %}
gateway {{ item.value.gateway }}
{% endif %}
{% if item.value.static_routes is defined %}
{% for route in item.value.static_routes %}
post-up ip route add {{ route['cidr'] }} via {{ route['gateway'] }} || true
{% endfor %}
{% endif %}
{% else %}
iface {{ item.value.interface }} inet manual
{% endif %}
### end generated network for [ {{ item.value.interface }} ] ###