From 779299de15f2b79f71e334ae229ef0708451ff6f Mon Sep 17 00:00:00 2001
From: Smaine Kahlouch <smaine.kahlouch@arkena.com>
Date: Mon, 1 Feb 2016 15:53:23 +0100
Subject: [PATCH] calico uses --ip option

---
 roles/network_plugin/tasks/calico.yml                        | 4 ++++
 roles/network_plugin/templates/calico/deb-calico.initd.j2    | 1 +
 roles/network_plugin/templates/calico/network-environment.j2 | 2 ++
 roles/network_plugin/templates/calico/rh-calico.initd.j2     | 1 +
 4 files changed, 8 insertions(+)
 create mode 100644 roles/network_plugin/templates/calico/network-environment.j2

diff --git a/roles/network_plugin/tasks/calico.yml b/roles/network_plugin/tasks/calico.yml
index 6e269c5eb..748d044a2 100644
--- a/roles/network_plugin/tasks/calico.yml
+++ b/roles/network_plugin/tasks/calico.yml
@@ -55,6 +55,10 @@
   template: src=calico/calico.conf.j2 dest=/usr/libexec/kubernetes/kubelet-plugins/net/exec/calico/calico_kubernetes.ini
   notify: restart calico-node
 
+- name: Calico | Write /etc/network-environment
+  template: src=calico/network-environment.j2 dest=/etc/network-environment
+  when: init_system == "sysvinit"
+
 - name: Calico | Write calico-node systemd init file
   template: src=calico/calico-node.service.j2 dest=/etc/systemd/system/calico-node.service
   when: init_system == "systemd"
diff --git a/roles/network_plugin/templates/calico/deb-calico.initd.j2 b/roles/network_plugin/templates/calico/deb-calico.initd.j2
index cd66de53f..ddbc22959 100644
--- a/roles/network_plugin/templates/calico/deb-calico.initd.j2
+++ b/roles/network_plugin/templates/calico/deb-calico.initd.j2
@@ -10,6 +10,7 @@
 # Description:
 #   Runs calico as a docker container
 ### END INIT INFO
+set -a
 
 PATH=/sbin:/usr/sbin:/bin:/usr/bin
 DESC="Calico-node Docker"
diff --git a/roles/network_plugin/templates/calico/network-environment.j2 b/roles/network_plugin/templates/calico/network-environment.j2
new file mode 100644
index 000000000..3d3f87b65
--- /dev/null
+++ b/roles/network_plugin/templates/calico/network-environment.j2
@@ -0,0 +1,2 @@
+DEFAULT_IPV4={{ip | default(ansible_default_ipv4.address) }}
+ETCD_AUTHORITY=127.0.0.1:2379
diff --git a/roles/network_plugin/templates/calico/rh-calico.initd.j2 b/roles/network_plugin/templates/calico/rh-calico.initd.j2
index d4f798f56..6fb870652 100644
--- a/roles/network_plugin/templates/calico/rh-calico.initd.j2
+++ b/roles/network_plugin/templates/calico/rh-calico.initd.j2
@@ -4,6 +4,7 @@
 #
 # chkconfig:   2345 95 95
 # description: Daemon for calico-node (http://www.projectcalico.org/)
+set -a
 
 ### BEGIN INIT INFO
 # Provides:       calico-node
-- 
GitLab