Commit 63ea6e42 authored by John Hackett's avatar John Hackett

Changed main.tf and makefile to use cached lxd image

parent da433dee
......@@ -15,6 +15,8 @@ docker:
cat dockerfiles/inspec | docker build -t inspec -
cat dockerfiles/terraform-lxd | docker build -t terraform-lxd -
openfaas:
ssh root@`terraform output -json | jq -r .ip.value` 'docker swarm init --advertise-addr 127.0.0.1 --listen-addr 127.0.0.1 || true && git clone https://github.com/openfaas/faas || true && cd faas && git checkout 0.7.1 && ./deploy_stack.sh'
ansible:
ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -i `terraform output -json | jq -r .ip.value`, playbook.yml -u root
......@@ -25,6 +27,15 @@ rebuild: destroy apply ansible
cache: apt-cache gem-cache
lxd-image:
lxc delete opennebula-dev-build --force || true
lxc image delete opennebula-dev || true
lxc launch images:debian/stretch opennebula-dev-build --storage default --network lxdbr0
sleep 3
echo "apt-get update && apt-get install --install-recommends -y udev iptables bridge-utils busybox-static python gnupg openssh-server avahi-daemon" | lxc exec opennebula-dev-build bash
lxc publish opennebula-dev-build --alias opennebula-dev --force
lxc delete opennebula-dev-build --force
apt-cache:
cat dockerfiles/apt-cache-ng | docker build -t apt-cache-ng -
docker kill apt-cache-ng || true
......
......@@ -11,14 +11,6 @@ resource "lxd_container_file" "apt_cache" {
create_directories = true
}
resource "lxd_container_file" "bridge" {
container_name = "${lxd_container.opennebula.name}"
target_file = "/etc/network/interfaces"
source = "files/interface.onebr0"
create_directories = true
}
resource "lxd_container_file" "authorized_keys" {
container_name = "${lxd_container.opennebula.name}"
target_file = "/root/.ssh/authorized_keys"
......@@ -29,11 +21,13 @@ resource "lxd_container_file" "authorized_keys" {
resource "lxd_container" "opennebula" {
name = "opennebula"
image = "images:debian/stretch"
# image = "images:debian/stretch"
image = "opennebula-dev"
config {
security.privileged = "true"
security.nesting = "true"
user.access_interface = "onebr0"
}
device {
......@@ -57,8 +51,26 @@ resource "lxd_container" "opennebula" {
profiles = ["${lxd_profile.opennebula.name}"]
file {
source = "networking/lo.interface"
target_file = "/etc/network/interfaces.d/lo"
create_directories = "true"
}
file {
source = "networking/network_includes.interface"
target_file = "/etc/network/interfaces"
create_directories = "true"
}
file {
source = "networking/bridge_ip46.interface"
target_file = "/etc/network/interfaces.d/bridge_ip46"
create_directories = "true"
}
provisioner "local-exec" {
command = "lxc exec ${lxd_container.opennebula.name} -- apt-get -y install python gnupg openssh-server avahi-daemon && lxc exec ${lxd_container.opennebula.name} -- systemctl start sshd && lxc exec ${lxd_container.opennebula.name} -- systemctl start avahi-daemon"
command = "lxc exec ${lxd_container.opennebula.name} -- systemctl restart networking && lxc exec ${lxd_container.opennebula.name} -- systemctl status networking && lxc exec ${lxd_container.opennebula.name} -- systemctl start avahi-daemon"
}
}
......@@ -93,6 +105,12 @@ resource "lxd_storage_pool" "opennebula" {
resource "lxd_network" "opennebula" {
name = "opennebula"
# config {
# ipv4.address = "none"
# ipv6.address = "none"
# }
config {
ipv4.address = "10.0.25.1/24"
ipv4.nat = "true"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment