From 1c9619633840a0e7588a5fdf6996faddf32e8090 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Mon, 27 Aug 2018 20:36:21 +0200 Subject: o Disable IPv6 in LXC containers. o Create LXC configuration from Ansible vars. --- ansible/roles/lxc-host/tasks/main.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 ansible/roles/lxc-host/tasks/main.yml (limited to 'ansible/roles/lxc-host') diff --git a/ansible/roles/lxc-host/tasks/main.yml b/ansible/roles/lxc-host/tasks/main.yml new file mode 100644 index 0000000..a043d4c --- /dev/null +++ b/ansible/roles/lxc-host/tasks/main.yml @@ -0,0 +1,23 @@ +--- +#- debug: +# msg: key="{{ item.key }}", ipv4="{{ item.value.ipv4 }}" +# with_dict: "{{ lxc_containers }}" +- name: Set IPv4 address + lineinfile: + path: "/var/lib/lxc/{{ item.key }}/config" + regexp: "lxc.network.ipv4 *=" + line: "lxc.network.ipv4 = {{ item.value.ipv4.address }}" + with_dict: "{{ lxc_containers }}" +- name: Set IPv4 gateway + lineinfile: + path: "/var/lib/lxc/{{ item.key }}/config" + regexp: "lxc.network.ipv4.gateway *=" + line: "lxc.network.ipv4.gateway = {{ item.value.ipv4.gateway }}" + insertafter: "lxc.network.ipv4 *=" + with_dict: "{{ lxc_containers }}" +- name: Set logfile + lineinfile: + path: "/var/lib/lxc/{{ item.key }}/config" + regexp: "lxc.logfile *=" + line: "lxc.logfile = /var/lib/lxc/{{ item.key }}/{{ item.key }}.log" + with_dict: "{{ lxc_containers }}" -- cgit v1.2.3