Volum Group resource
This commit is contained in:
parent
3115ffa4e8
commit
6989f9fd70
20
resources/volume_group/actions/run.yaml
Normal file
20
resources/volume_group/actions/run.yaml
Normal file
@ -0,0 +1,20 @@
|
||||
- hosts: [{{ ip }}]
|
||||
sudo: yes
|
||||
tasks:
|
||||
# install dependencies
|
||||
- apt: name=lvm2 state=present
|
||||
# preapara file
|
||||
- command: truncate -s 10G {{path}} creates={{path}}
|
||||
# check if loop for file is already created
|
||||
- shell: losetup -a|grep {{path}}
|
||||
register: loop_created
|
||||
ignore_errors: True
|
||||
# if loop is not created, create it
|
||||
- command: losetup -f {{path}}
|
||||
when: loop_created|failed
|
||||
# get loop, for example /dev/loop0
|
||||
- shell: losetup -a|grep '{{path}}'|awk -F':' '{print $1}'
|
||||
register: loop_device
|
||||
- name: create Volume Group on loop device
|
||||
lvg: vg={{volume_name}} pvs={% raw %}{{item}}{% endraw %} state=present
|
||||
with_items: loop_device.stdout_lines
|
27
resources/volume_group/meta.yaml
Normal file
27
resources/volume_group/meta.yaml
Normal file
@ -0,0 +1,27 @@
|
||||
id: volume_group
|
||||
handler: ansible
|
||||
version: 1.0.0
|
||||
input:
|
||||
volume_name:
|
||||
schema: str!
|
||||
value:
|
||||
path:
|
||||
schema: str!
|
||||
value:
|
||||
|
||||
# not used, for now all VGs are file based
|
||||
type:
|
||||
schema: str!
|
||||
value: 'file'
|
||||
|
||||
ip:
|
||||
schema: str!
|
||||
value:
|
||||
ssh_key:
|
||||
schema: str!
|
||||
value:
|
||||
ssh_user:
|
||||
schema: str!
|
||||
value:
|
||||
|
||||
tags: [resource/volume_group]
|
Loading…
x
Reference in New Issue
Block a user