From 9172de48fdc921c06affdd6f090e19499fa7e555 Mon Sep 17 00:00:00 2001 From: Alexander Block Date: Mon, 12 Dec 2016 14:14:22 +0100 Subject: [PATCH] Make growpart only run on Azure --- ...owpart-centos-7.yml => growpart-azure-centos-7.yml} | 2 ++ roles/kubernetes/preinstall/tasks/main.yml | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) rename roles/kubernetes/preinstall/tasks/{growpart-centos-7.yml => growpart-azure-centos-7.yml} (75%) diff --git a/roles/kubernetes/preinstall/tasks/growpart-centos-7.yml b/roles/kubernetes/preinstall/tasks/growpart-azure-centos-7.yml similarity index 75% rename from roles/kubernetes/preinstall/tasks/growpart-centos-7.yml rename to roles/kubernetes/preinstall/tasks/growpart-azure-centos-7.yml index 506589760..afd5ff229 100644 --- a/roles/kubernetes/preinstall/tasks/growpart-centos-7.yml +++ b/roles/kubernetes/preinstall/tasks/growpart-azure-centos-7.yml @@ -1,5 +1,7 @@ --- +# Running growpart seems to be only required on Azure, as other Cloud Providers do this at boot time + - name: install growpart package: name=cloud-utils-growpart state=latest diff --git a/roles/kubernetes/preinstall/tasks/main.yml b/roles/kubernetes/preinstall/tasks/main.yml index 5f2662339..3c1e3692b 100644 --- a/roles/kubernetes/preinstall/tasks/main.yml +++ b/roles/kubernetes/preinstall/tasks/main.yml @@ -181,8 +181,14 @@ - include: resolvconf.yml tags: [bootstrap-os, resolvconf] -- include: growpart-centos-7.yml - when: ansible_distribution in ["CentOS","RedHat"] and +- name: Check if we are running inside a Azure VM + stat: path=/var/lib/waagent/ + register: azure_check + tags: bootstrap-os + +- include: growpart-azure-centos-7.yml + when: azure_check.stat.exists and + ansible_distribution in ["CentOS","RedHat"] and ansible_distribution_major_version >= 7 tags: bootstrap-os