Volum Group resource

This commit is contained in:
Łukasz Oleś 2015-09-03 10:52:22 +00:00
parent 3115ffa4e8
commit 6989f9fd70
2 changed files with 47 additions and 0 deletions

View 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

View 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]