commit
a127a561fa
@ -8,5 +8,4 @@
|
||||
- include: tasks/puppet.yml
|
||||
- include: tasks/docker.yml
|
||||
#- include: celery.yml tags=['master'] celery_dir=/var/run/celery
|
||||
- include: tasks/cinder.yml
|
||||
- include: tasks/cloud_archive.yml
|
||||
|
@ -1,15 +0,0 @@
|
||||
---
|
||||
|
||||
- apt: name=lvm2 state=present
|
||||
- command: sudo truncate -s 10G /root/cinder.img creates=/root/cinder.img
|
||||
- shell: sudo losetup -a|grep cinder
|
||||
register: loop_created
|
||||
ignore_errors: True
|
||||
- command: sudo losetup /dev/loop0 /root/cinder.img
|
||||
when: loop_created|failed
|
||||
# retries: 5
|
||||
# delay: 1
|
||||
- lvg: vg=cinder-volumes pvs=/dev/loop0
|
||||
when: loop_created|failed
|
||||
# retries: 5
|
||||
# delay: 1
|
14
resources/volume_group/actions/remove.yaml
Normal file
14
resources/volume_group/actions/remove.yaml
Normal file
@ -0,0 +1,14 @@
|
||||
- hosts: [{{ ip }}]
|
||||
sudo: yes
|
||||
tasks:
|
||||
- name: remove VG
|
||||
lvg: vg={{name}} state=absent force=yes
|
||||
- name: find loop device
|
||||
shell: losetup -a|grep "/root/cinder.img"|awk -F':' '{print $1}'
|
||||
register: loop_device
|
||||
- name: if loop device exists, delete it
|
||||
command: sudo losetup -d {% raw %}{{item}}{% endraw %}
|
||||
when: loop_device|success
|
||||
with_items: loop_device.stdout_lines
|
||||
|
||||
|
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:
|
||||
- name: install dependencies
|
||||
apt: name=lvm2 state=present
|
||||
- name: preapara file
|
||||
command: truncate -s 10G {{path}} creates={{path}}
|
||||
- name: check if loop for file is already created
|
||||
shell: losetup -a|grep {{path}}
|
||||
register: loop_created
|
||||
ignore_errors: True
|
||||
- name: if loop is not created, create it
|
||||
command: losetup -f {{path}}
|
||||
when: loop_created|failed
|
||||
- name: find loop device
|
||||
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]
|
@ -1,14 +0,0 @@
|
||||
---
|
||||
|
||||
- hosts: all
|
||||
sudo: yes
|
||||
tasks:
|
||||
- apt: name=lvm2 state=present
|
||||
- command: sudo truncate -s 10G /root/cinder.img creates=/root/cinder.img
|
||||
- shell: sudo losetup -a|grep cinder
|
||||
register: loop_created
|
||||
ignore_errors: True
|
||||
- command: sudo losetup /dev/loop0 /root/cinder.img
|
||||
when: loop_created|failed
|
||||
- lvg: vg=cinder-volumes pvs=/dev/loop0
|
||||
when: loop_created|failed
|
Loading…
x
Reference in New Issue
Block a user