Merge pull request #705 from vwfs/centos7-azure
Better support for CentOS 7 on Azure
This commit is contained in:
commit
45135ad3e4
7 changed files with 68 additions and 2 deletions
|
@ -2,6 +2,10 @@
|
||||||
- hosts: all
|
- hosts: all
|
||||||
any_errors_fatal: true
|
any_errors_fatal: true
|
||||||
gather_facts: false
|
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:
|
roles:
|
||||||
- bootstrap-os
|
- bootstrap-os
|
||||||
tags:
|
tags:
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Valid bootstrap options (required): ubuntu, coreos, none
|
# Valid bootstrap options (required): ubuntu, coreos, centos, none
|
||||||
bootstrap_os: none
|
bootstrap_os: none
|
||||||
|
|
||||||
# Directory where the binaries will be installed
|
# Directory where the binaries will be installed
|
||||||
|
|
14
roles/bootstrap-os/tasks/bootstrap-centos.yml
Normal file
14
roles/bootstrap-os/tasks/bootstrap-centos.yml
Normal 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
|
|
@ -4,3 +4,8 @@
|
||||||
|
|
||||||
- include: bootstrap-coreos.yml
|
- include: bootstrap-coreos.yml
|
||||||
when: bootstrap_os == "coreos"
|
when: bootstrap_os == "coreos"
|
||||||
|
|
||||||
|
- include: bootstrap-centos.yml
|
||||||
|
when: bootstrap_os == "centos"
|
||||||
|
|
||||||
|
- include: setup-pipelining.yml
|
6
roles/bootstrap-os/tasks/setup-pipelining.yml
Normal file
6
roles/bootstrap-os/tasks/setup-pipelining.yml
Normal 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
|
||||||
|
|
|
@ -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
|
|
@ -180,3 +180,15 @@
|
||||||
|
|
||||||
- include: resolvconf.yml
|
- include: resolvconf.yml
|
||||||
tags: [bootstrap-os, resolvconf]
|
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
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue