diff --git a/cluster.yml b/cluster.yml index 9bb149fd2..6f8e63505 100644 --- a/cluster.yml +++ b/cluster.yml @@ -2,6 +2,10 @@ - hosts: all any_errors_fatal: true gather_facts: false + vars: + # Need to disable pipelining for bootstrap-os as some systems have requiretty in sudoers set, which makes pipelining + # fail. bootstrap-os fixes this on these systems, so in later plays it can be enabled. + ansible_ssh_pipelining: false roles: - bootstrap-os tags: diff --git a/inventory/group_vars/all.yml b/inventory/group_vars/all.yml index 06561e78f..65b65fe39 100644 --- a/inventory/group_vars/all.yml +++ b/inventory/group_vars/all.yml @@ -1,4 +1,4 @@ -# Valid bootstrap options (required): ubuntu, coreos, none +# Valid bootstrap options (required): ubuntu, coreos, centos, none bootstrap_os: none # Directory where the binaries will be installed diff --git a/roles/bootstrap-os/tasks/bootstrap-centos.yml b/roles/bootstrap-os/tasks/bootstrap-centos.yml new file mode 100644 index 000000000..9c41ae84c --- /dev/null +++ b/roles/bootstrap-os/tasks/bootstrap-centos.yml @@ -0,0 +1,14 @@ +--- + +- name: Check presence of fastestmirror.conf + stat: path=/etc/yum/pluginconf.d/fastestmirror.conf + register: fastestmirror + +# fastestmirror plugin actually slows down Ansible deployments +- name: Disable fastestmirror plugin + lineinfile: + dest: /etc/yum/pluginconf.d/fastestmirror.conf + regexp: "^enabled=.*" + line: "enabled=0" + state: present + when: fastestmirror.stat.exists diff --git a/roles/bootstrap-os/tasks/main.yml b/roles/bootstrap-os/tasks/main.yml index 5d084ec74..7f1355577 100644 --- a/roles/bootstrap-os/tasks/main.yml +++ b/roles/bootstrap-os/tasks/main.yml @@ -3,4 +3,9 @@ when: bootstrap_os == "ubuntu" - include: bootstrap-coreos.yml - when: bootstrap_os == "coreos" \ No newline at end of file + when: bootstrap_os == "coreos" + +- include: bootstrap-centos.yml + when: bootstrap_os == "centos" + +- include: setup-pipelining.yml \ No newline at end of file diff --git a/roles/bootstrap-os/tasks/setup-pipelining.yml b/roles/bootstrap-os/tasks/setup-pipelining.yml new file mode 100644 index 000000000..ca216cc3b --- /dev/null +++ b/roles/bootstrap-os/tasks/setup-pipelining.yml @@ -0,0 +1,6 @@ +--- +# Remove requiretty to make ssh pipelining work + +- name: Remove require tty + lineinfile: regexp="^\w+\s+requiretty" dest=/etc/sudoers state=absent + diff --git a/roles/kubernetes/preinstall/tasks/growpart-azure-centos-7.yml b/roles/kubernetes/preinstall/tasks/growpart-azure-centos-7.yml new file mode 100644 index 000000000..afd5ff229 --- /dev/null +++ b/roles/kubernetes/preinstall/tasks/growpart-azure-centos-7.yml @@ -0,0 +1,25 @@ +--- + +# 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 + +- name: check if growpart needs to be run + command: growpart -N /dev/sda 1 + failed_when: False + changed_when: "'NOCHANGE:' not in growpart_needed.stdout" + register: growpart_needed + +- name: check fs type + command: file -Ls /dev/sda1 + changed_when: False + register: fs_type + +- name: run growpart + command: growpart /dev/sda 1 + when: growpart_needed.changed + +- name: run xfs_growfs + command: xfs_growfs /dev/sda1 + when: growpart_needed.changed and 'XFS' in fs_type.stdout \ No newline at end of file diff --git a/roles/kubernetes/preinstall/tasks/main.yml b/roles/kubernetes/preinstall/tasks/main.yml index fd8a808a3..3c1e3692b 100644 --- a/roles/kubernetes/preinstall/tasks/main.yml +++ b/roles/kubernetes/preinstall/tasks/main.yml @@ -180,3 +180,15 @@ - include: resolvconf.yml tags: [bootstrap-os, resolvconf] + +- 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 +