From 48a85ce8f84b894edb1b6d136918c0c92b760e8f Mon Sep 17 00:00:00 2001
From: Smana <smainklh@gmail.com>
Date: Mon, 11 Apr 2016 09:33:08 +0200
Subject: [PATCH] use docker repository to install on CentOS

---
 .travis.yml                                    |  5 +++++
 roles/docker/tasks/main.yml                    | 15 +++------------
 roles/kubernetes/preinstall/tasks/main.yml     |  9 ++++-----
 roles/kubernetes/secrets/tasks/check-certs.yml |  2 +-
 4 files changed, 13 insertions(+), 18 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 00e27304e..7b3978b86 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -91,6 +91,11 @@ matrix:
   allow_failures:
     - env: KUBE_NETWORK_PLUGIN=weave CLOUD_IMAGE=ubuntu-1404-trusty CLOUD_REGION=asia-east1-c
     - env: KUBE_NETWORK_PLUGIN=calico CLOUD_IMAGE=ubuntu-1404-trusty CLOUD_REGION=us-east1-d
+    # Issue with Weave #177 to be fixed
+    - env: KUBE_NETWORK_PLUGIN=weave CLOUD_IMAGE=debian-8-kubespray CLOUD_REGION=us-east1-d
+    - env: KUBE_NETWORK_PLUGIN=weave CLOUD_IMAGE=centos-7-sudo CLOUD_REGION=us-central1-c
+    - env: KUBE_NETWORK_PLUGIN=weave CLOUD_IMAGE=rhel-7-sudo CLOUD_REGION=europe-west1-b
+    - env: KUBE_NETWORK_PLUGIN=weave CLOUD_IMAGE=ubuntu-1510-wily CLOUD_REGION=us-east1-d
 
 before_install:
   # Install Ansible.
diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml
index 3b39bd850..47e5d24a1 100644
--- a/roles/docker/tasks/main.yml
+++ b/roles/docker/tasks/main.yml
@@ -38,12 +38,12 @@
   with_items: "{{ docker_repo_info.repos }}"
   when: docker_repo_info.repos|length > 0
 
-- name: Configure docker repository on RedHat
+- name: Configure docker repository on RedHat/CentOS
   copy:
     src: "rh_docker.repo"
     dest: "/etc/yum.repos.d/docker.repo"
-  when: ansible_distribution == "RedHat" and
-        ansible_distribution_major_version > 7
+  when: ansible_distribution in ["CentOS","RedHat"] and
+        ansible_distribution_major_version >= 7
 
 - name: ensure docker packages are installed
   action: "{{ docker_package_info.pkg_mgr }}"
@@ -53,15 +53,6 @@
   with_items: "{{ docker_package_info.pkgs }}"
   when: docker_package_info.pkgs|length > 0
 
-- name: Centos needs xfs storage type for devicemapper if used
-  lineinfile:
-    dest: /etc/sysconfig/docker-storage
-    line: "DOCKER_STORAGE_OPTIONS='--storage-opt dm.fs=xfs'"
-    regexp: '^DOCKER_STORAGE_OPTIONS=.*$'
-    state: present
-    backup: yes
-  when: ansible_distribution == "CentOS"
-
 - meta: flush_handlers
 
 - name: ensure docker service is started and enabled
diff --git a/roles/kubernetes/preinstall/tasks/main.yml b/roles/kubernetes/preinstall/tasks/main.yml
index 29fa2f1ab..36a444675 100644
--- a/roles/kubernetes/preinstall/tasks/main.yml
+++ b/roles/kubernetes/preinstall/tasks/main.yml
@@ -79,11 +79,10 @@
   changed_when: False
 
 - name: Install epel-release on RedHat/CentOS
-  action:
-    module: "{{ ansible_pkg_mgr }}"
-    name: "epel-release"
-    state: latest
-  when: ansible_distribution in ['CentOS', 'RedHat']
+  command: rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
+  when: ansible_distribution in ["CentOS","RedHat"] and
+        ansible_distribution_major_version >= 7
+  changed_when: False
 
 - name: Install packages requirements
   action:
diff --git a/roles/kubernetes/secrets/tasks/check-certs.yml b/roles/kubernetes/secrets/tasks/check-certs.yml
index a5ed1af67..5875fdbf4 100644
--- a/roles/kubernetes/secrets/tasks/check-certs.yml
+++ b/roles/kubernetes/secrets/tasks/check-certs.yml
@@ -2,7 +2,7 @@
 - name: "Check certs | check if the certs have already been generated on first master"
   stat:
     path: "{{ kube_cert_dir }}/ca.pem"
-  delegate_to: groups['kube-master'][0]
+  delegate_to: "{{groups['kube-master'][0]}}"
   register: kubecert_master
   run_once: true
 
-- 
GitLab