2016-12-09 20:27:50 +08:00
|
|
|
---
|
|
|
|
|
2016-12-12 21:14:22 +08:00
|
|
|
# Running growpart seems to be only required on Azure, as other Cloud Providers do this at boot time
|
|
|
|
|
2016-12-09 20:27:50 +08:00
|
|
|
- name: install growpart
|
2017-02-18 05:22:34 +08:00
|
|
|
package:
|
|
|
|
name: cloud-utils-growpart
|
|
|
|
state: latest
|
2016-12-09 20:27:50 +08:00
|
|
|
|
|
|
|
- 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
|
2018-07-31 06:52:56 +08:00
|
|
|
environment:
|
|
|
|
LC_ALL: C
|
2016-12-09 20:27:50 +08:00
|
|
|
|
|
|
|
- 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
|
2018-07-31 06:56:09 +08:00
|
|
|
environment:
|
|
|
|
LC_ALL: C
|
2016-12-09 20:27:50 +08:00
|
|
|
|
|
|
|
- name: run xfs_growfs
|
|
|
|
command: xfs_growfs /dev/sda1
|
2018-07-31 06:52:56 +08:00
|
|
|
when: growpart_needed.changed and 'XFS' in fs_type.stdout
|