From 3bf74530cea6ad18f5220a250debaa53aeb0e1a0 Mon Sep 17 00:00:00 2001 From: ant31 <2t.antoine@gmail.com> Date: Sun, 1 Nov 2015 11:12:12 +0100 Subject: [PATCH] Add IP var --- roles/docker/tasks/configure.yml | 2 +- roles/docker/tasks/install.yml | 4 ++-- roles/kubernetes/common/tasks/gen_certs.yml | 2 +- roles/kubernetes/master/templates/apiserver.j2 | 2 +- roles/kubernetes/master/templates/proxy.kubeconfig.j2 | 2 +- roles/kubernetes/node/templates/kubelet.kubeconfig.j2 | 2 +- roles/network_plugin/templates/calico/network-environment.j2 | 4 ++-- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/roles/docker/tasks/configure.yml b/roles/docker/tasks/configure.yml index bf4e6df7e..07506dec1 100644 --- a/roles/docker/tasks/configure.yml +++ b/roles/docker/tasks/configure.yml @@ -4,7 +4,7 @@ when: kube_network_plugin is defined and kube_network_plugin == "calico" - name: Configure calico/docker bridge - shell: /etc/network/if-up.d/create_cbr + command: /etc/network/if-up.d/create_cbr when: kube_network_plugin is defined and kube_network_plugin == "calico" - name: Configure docker to use cbr0 bridge diff --git a/roles/docker/tasks/install.yml b/roles/docker/tasks/install.yml index 9e551b504..ae9c8f8eb 100644 --- a/roles/docker/tasks/install.yml +++ b/roles/docker/tasks/install.yml @@ -16,9 +16,9 @@ - docker-engine=1.8.3-0~{{ ansible_distribution_release }} - name: Copy default docker configuration - template: src=default-docker.j2 dest=/etc/default/docker + template: src=default-docker.j2 dest=/etc/default/docker backup=yes notify: restart docker - name: Copy Docker systemd unit file - copy: src=systemd-docker.service dest=/lib/systemd/system/docker.service + copy: src=systemd-docker.service dest=/lib/systemd/system/docker.service backup=yes notify: restart docker diff --git a/roles/kubernetes/common/tasks/gen_certs.yml b/roles/kubernetes/common/tasks/gen_certs.yml index edc0897a5..74fd4458c 100644 --- a/roles/kubernetes/common/tasks/gen_certs.yml +++ b/roles/kubernetes/common/tasks/gen_certs.yml @@ -19,7 +19,7 @@ args: creates: "{{ kube_cert_dir }}/server.crt" environment: - MASTER_IP: "{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}" + MASTER_IP: "{{ hostvars[inventory_hostname]['ip'] | default(hostvars[inventory_hostname]['ansible_default_ipv4']['address']) }}" MASTER_NAME: "{{ inventory_hostname }}" DNS_DOMAIN: "{{ dns_domain }}" SERVICE_CLUSTER_IP_RANGE: "{{ kube_service_addresses }}" diff --git a/roles/kubernetes/master/templates/apiserver.j2 b/roles/kubernetes/master/templates/apiserver.j2 index 3ec15970c..4a69b1cc9 100644 --- a/roles/kubernetes/master/templates/apiserver.j2 +++ b/roles/kubernetes/master/templates/apiserver.j2 @@ -8,7 +8,7 @@ KUBE_API_ADDRESS="--insecure-bind-address=0.0.0.0" # The port on the local server to listen on. -KUBE_API_PORT="--insecure-port=8080 --secure-port={{ kube_master_port }}" +KUBE_API_PORT="--insecure-port={{kube_master_insecure_port}} --secure-port={{ kube_master_port }}" # KUBELET_PORT="--kubelet_port=10250" diff --git a/roles/kubernetes/master/templates/proxy.kubeconfig.j2 b/roles/kubernetes/master/templates/proxy.kubeconfig.j2 index 3618c4b7c..5e35eb5d2 100644 --- a/roles/kubernetes/master/templates/proxy.kubeconfig.j2 +++ b/roles/kubernetes/master/templates/proxy.kubeconfig.j2 @@ -10,7 +10,7 @@ contexts: clusters: - cluster: certificate-authority: {{ kube_cert_dir }}/ca.crt - server: http://{{ groups['kube-master'][0] }}:8080 + server: http://{{ groups['kube-master'][0] }}:{{kube_master_insecure_port}} name: {{ cluster_name }} users: - name: proxy diff --git a/roles/kubernetes/node/templates/kubelet.kubeconfig.j2 b/roles/kubernetes/node/templates/kubelet.kubeconfig.j2 index 79cb17bd5..28eda1e03 100644 --- a/roles/kubernetes/node/templates/kubelet.kubeconfig.j2 +++ b/roles/kubernetes/node/templates/kubelet.kubeconfig.j2 @@ -5,7 +5,7 @@ preferences: {} clusters: - cluster: certificate-authority: {{ kube_cert_dir }}/ca.crt - server: https://{{ groups['kube-master'][0] }}:443 + server: https://{{ groups['kube-master'][0] }}:{{kube_master_port}} name: {{ cluster_name }} contexts: - context: diff --git a/roles/network_plugin/templates/calico/network-environment.j2 b/roles/network_plugin/templates/calico/network-environment.j2 index d03013f1a..2407f1ecb 100755 --- a/roles/network_plugin/templates/calico/network-environment.j2 +++ b/roles/network_plugin/templates/calico/network-environment.j2 @@ -1,7 +1,7 @@ #! /usr/bin/bash # This node's IPv4 address CALICO_IPAM=true -DEFAULT_IPV4={{ ansible_default_ipv4.address }} +DEFAULT_IPV4={{ip | default(ansible_default_ipv4.address) }} {% if inventory_hostname in groups['kube-node'] %} # The kubernetes master IP @@ -12,7 +12,7 @@ KUBERNETES_MASTER={{ groups['kube-master'][0] }} ETCD_AUTHORITY={{ groups['kube-master'][0] }}:4001 # The kubernetes-apiserver location - used by the calico plugin -KUBE_API_ROOT=http://{{ groups['kube-master'][0] }}:8080/api/v1/ +KUBE_API_ROOT=http://{{ groups['kube-master'][0] }}:{{kube_master_insecure_port}}/api/v1/ # Location of the calicoctl binary - used by the calico plugin CALICOCTL_PATH="{{ bin_dir }}/calicoctl"