Commit b8471719 authored by Mattia Rizzolo's avatar Mattia Rizzolo

lxd-container: rename variable

for some reason ansible is now failing with a variable named "name",
claiming it is not defined.  just rename it, making it also more clear
what it is referring to.
Signed-off-by: Mattia Rizzolo's avatarMattia Rizzolo <mapreri@ubuntu.com>
parent be7e6491
...@@ -30,13 +30,13 @@ ...@@ -30,13 +30,13 @@
- role: lxd - role: lxd
- role: lxd-container - role: lxd-container
name: spock container_name: spock
ip: "{{ lxd_subnet }}.2" ip: "{{ lxd_subnet }}.2"
image: ubuntu/xenial/amd64 image: ubuntu/xenial/amd64
expose_ports: expose_ports:
- 2222 - 2222
- role: lxd-container - role: lxd-container
name: bromuro container_name: bromuro
ip: "{{ lxd_subnet }}.3" ip: "{{ lxd_subnet }}.3"
image: ubuntu/trusty/amd64 image: ubuntu/trusty/amd64
--- ---
- name: "Create the {{ name }} container" - name: "Create the {{ container_name }} container"
lxd_container: lxd_container:
name: "{{ name }}" name: "{{ container_name }}"
state: started state: started
source: source:
...@@ -19,20 +19,20 @@ ...@@ -19,20 +19,20 @@
- block: - block:
- name: "Upload the bootstrap script for the {{ name }} container" - name: "Upload the bootstrap script for the {{ container_name }} container"
template: template:
src: bootstrap-container.sh.j2 src: bootstrap-container.sh.j2
dest: "/tmp/bootstrap-container-{{ name }}.sh" dest: "/tmp/bootstrap-container-{{ container_name }}.sh"
mode: 0700 mode: 0700
- name: "Execute the bootstrap script for the {{ name }} container" - name: "Execute the bootstrap script for the {{ container_name }} container"
command: "/tmp/bootstrap-container-{{ name }}.sh" command: "/tmp/bootstrap-container-{{ container_name }}.sh"
- name: "Delete the bootstrap script for the {{ name }} container" - name: "Delete the bootstrap script for the {{ container_name }} container"
file: file:
path: "/tmp/bootstrap-container-{{ name }}.sh" path: "/tmp/bootstrap-container-{{ container_name }}.sh"
state: absent state: absent
......
--- ---
- name: "Assign a static IP address to the {{ name }} container" - name: "Assign a static IP address to the {{ container_name }} container"
lineinfile: lineinfile:
line: "dhcp-host={{ name }},{{ ip }}" line: "dhcp-host={{ container_name }},{{ ip }}"
regexp: "^dhcp\\-host={{ name }}" regexp: "^dhcp\\-host={{ container_name }}"
state: present state: present
path: /etc/lxd_dnsmasq.conf path: /etc/lxd_dnsmasq.conf
notify: notify:
- lxd.restart-bridge - lxd.restart-bridge
- "lxd-container.restart-{{ name }}" - "lxd-container.restart-{{ container_name }}"
- name: "Expose {{ name }} ports" - name: "Expose {{ container_name }} ports"
template: template:
src: firewall.sh.j2 src: firewall.sh.j2
dest: "/etc/firewall/lxd-container-{{ name }}.sh" dest: "/etc/firewall/lxd-container-{{ container_name }}.sh"
mode: 0744 mode: 0744
when: expose_ports when: expose_ports
......
...@@ -3,10 +3,10 @@ set -euo pipefail ...@@ -3,10 +3,10 @@ set -euo pipefail
IFS=$'\n\t' IFS=$'\n\t'
NAME="{{ name }}" NAME="{{ container_name }}"
ex() { ex() {
lxc exec "${NAME}" -- $@ lxc exec "${NAME}" -- "${@}"
return $? return $?
} }
......
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