Skip to content

Instantly share code, notes, and snippets.

@clcollins
Last active September 16, 2016 16:30
Show Gist options
  • Save clcollins/feaf8fae273dff1085f68c72a5df8cdc to your computer and use it in GitHub Desktop.
Save clcollins/feaf8fae273dff1085f68c72a5df8cdc to your computer and use it in GitHub Desktop.
Snippet of Ansible Playbook for auto-expanding a volume group based on disks on the server
---
## Snippet of Ansible Playbook for auto-expanding a volume group based on disks on the server
### Format Partitions ###
- name: Format | find disks
command: find /dev -regex "/dev/sd[b-z]" -exec echo "{}," \;
register: extra_pvs
- name: Format | expand vg if extra_pvs exist
# defaultpv comes last, because extra_pvs are formatted to have a comma on the end
lvg: vg='{{ volumegroup }}' pvs='{{ extra_pvs.stdout }}{{ defaultpv }}'
when: extra_pvs.stdout != ''
- name: Format | expand vg if extra_pvs do not exist
lvg: vg='{{ volumegroup }}' pvs='{{ defaultpv }}'
when: extra_pvs.stdout == ''
---
## Snippet of Ansible Playbook for auto-expanding a volume group based on disks on the server
volumegroup: 'ubuntuos'
defaultpv: '/dev/sda5'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment