Merge pull request #705 from vwfs/centos7-azure

Better support for CentOS 7 on Azure
This commit is contained in:
Bogdan Dobrelya 2016-12-13 10:36:58 +01:00 committed by GitHub
commit 38f5f4a8e3
7 changed files with 68 additions and 2 deletions

View file

@ -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:

View file

@ -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

View file

@ -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

View file

@ -3,4 +3,9 @@
when: bootstrap_os == "ubuntu"
- include: bootstrap-coreos.yml
when: bootstrap_os == "coreos"
when: bootstrap_os == "coreos"
- include: bootstrap-centos.yml
when: bootstrap_os == "centos"
- include: setup-pipelining.yml

View file

@ -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

View file

@ -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

View file

@ -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