Add growpart role to allow growing the root partition on CentOS
At least the OS images from Azure do not grow the root FS automatically.
This commit is contained in:
parent
41a87fe305
commit
eb2890d245
2 changed files with 29 additions and 0 deletions
23
roles/kubernetes/preinstall/tasks/growpart-centos-7.yml
Normal file
23
roles/kubernetes/preinstall/tasks/growpart-centos-7.yml
Normal file
|
@ -0,0 +1,23 @@
|
|||
---
|
||||
|
||||
- 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,9 @@
|
|||
|
||||
- include: resolvconf.yml
|
||||
tags: [bootstrap-os, resolvconf]
|
||||
|
||||
- include: growpart-centos-7.yml
|
||||
when: ansible_distribution in ["CentOS","RedHat"] and
|
||||
ansible_distribution_major_version >= 7
|
||||
tags: bootstrap-os
|
||||
|
||||
|
|
Loading…
Reference in a new issue