aboutsummaryrefslogtreecommitdiff
path: root/ansible/roles/lxc-host/tasks/main.yml
diff options
context:
space:
mode:
Diffstat (limited to 'ansible/roles/lxc-host/tasks/main.yml')
-rw-r--r--ansible/roles/lxc-host/tasks/main.yml72
1 files changed, 66 insertions, 6 deletions
diff --git a/ansible/roles/lxc-host/tasks/main.yml b/ansible/roles/lxc-host/tasks/main.yml
index ba511c9..ab86969 100644
--- a/ansible/roles/lxc-host/tasks/main.yml
+++ b/ansible/roles/lxc-host/tasks/main.yml
@@ -1,11 +1,71 @@
-- name: Remove default network setup packages
+- name: Install packages
+ tags:
+ - lxc-host
+ - lxc-host-packages
+ - radvd
+ become: yes
apt:
- name: "{{ item }}"
+ name: "{{ items }}"
install_recommends: no
- with_items:
- - python-lxc
+ vars:
+ items:
+ - lxc
+ - python-lxc
+ - radvd
+
+#- debug:
+# msg: "item={{ item }}, host={{ host }}, lan={{ lan }}"
+# tags:
+# - lxc-host
+# with_dict: "{{ lxc_host_containers }}"
+# vars:
+# i: "{{ item }}"
+# host: "{{ host_database[item.key] }}"
+# lan: "{{ host_database | json_query(item.key + '.interfaces | * | [?role==`lan`]') | first }}"
+
+- name: Configure radvd
+ become: yes
+ tags:
+ - lxc-host
+ - radvd
+ vars:
+ ipv6: "{{ host_database[ansible_hostname].interfaces[lxc_host__internal_if].ipv6 }}"
+ notify: restart radvd
+ copy:
+ dest: /etc/radvd.conf
+ content: |
+ interface {{ lxc_host__br_if }}
+ {
+ AdvSendAdvert on;
+ MinRtrAdvInterval 5;
+ MaxRtrAdvInterval 10;
+ MinDelayBetweenRAs 1;
+
+ AdvDefaultPreference medium;
+ AdvLinkMTU 1500;
+
+ prefix {{ ipv6.address }}/{{ ipv6.netmask }}
+ {
+ AdvOnLink on;
+ AdvAutonomous on;
+
+ AdvValidLifetime 14400;
+ AdvPreferredLifetime 3600;
+ AdvRouterAddr on;
+ };
+ };
+
+- name: Configure host networking
+ when: lxc_host__enable_network_cfg
+ tags:
+ - lxc-host
+ - lxc-host-network
+ include_tasks: networkd.yml
-- include_tasks: per-host.yml
+- tags: lxc-host
+ with_dict: "{{ lxc_host_containers }}"
vars:
i: "{{ item }}"
- with_dict: "{{ lxc_containers }}"
+ host: "{{ host_database[item.key] }}"
+ lan: "{{ host_database | json_query(item.key + '.interfaces | * | [?role==`lan`]') | first }}"
+ include_tasks: per-host.yml