- hosts: all
remote_user: root
accelerate: true
- roles: [] # just test
- # - storage
+ roles:
+ - storage
- hosts: compute
remote_user: root
+++ /dev/null
-if [ ! -f /var/cinder.img ]; then
- dd if=/dev/zero of=/var/cinder.img bs=1 count=0 seek=$1
-fi
+++ /dev/null
-size=`df /var | awk '$3 ~ /[0-9]+/ { print $4 }'`;
-if [ $size -gt 2000000000 ]; then
- echo -n 2000000000000;
-else
- echo -n $((size * 1000 / 512 * 512));
-fi
+++ /dev/null
-physical_device: /dev/loop0
+++ /dev/null
-loop_dev=`losetup -a |grep "/var/cinder.img"|awk -F':' '{print $1}'`
-if [ -z $loop_dev ]; then
- losetup -f --show /var/cinder.img
-else
- echo $loop_dev
-fi
-
+++ /dev/null
----
-- include_vars: "{{ ansible_os_family }}.yml"
-
-- name: get available /var partition size
- script: get_var_size.sh
- register: part_size
-
-- name: create cinder file if not exitst
- script: create_img.sh {{ part_size.stdout }}
-
-- name: do a losetup on /mnt/cinder-volumes
- script: losetup.sh
- register: loop_device
-
-- name: debug loop device
- debug: msg={{ loop_device.stdout }}
-
-- name: create physical and group volumes
- lvg: vg=cinder-volumes pvs={{ loop_device.stdout }}
- vg_options=--force
lineinfile: dest=/opt/service create=yes line='{{ item }}'
with_items: services | union(services_noarch)
-- name: check if physical device exists
- stat: path={{ physical_device }}
- register: status
-
-- name: load loop.yml
- include: loop.yml
- when: status.stat.exists == False or status.stat.isblk == False
-
-- name: load real.yml
- include: real.yml
- when: status.stat.exists == True and status.stat.isblk == True
-
- name: upload cinder-volume configuration
template: src=cinder.conf dest=/etc/cinder/cinder.conf
backup=yes
+++ /dev/null
----
-- include_vars: "{{ ansible_os_family }}.yml"
-
-- name: destroy GPT lable
- shell: dd if=/dev/urandom of={{ physical_device }} bs=4M count=1
- ignore_errors: True
-
-- name: create physical and group volumes
- lvg: vg=cinder-volumes pvs={{ physical_device }}
- vg_options=--force
api_paste_confg = /etc/cinder/api-paste.ini
iscsi_helper = tgtadm
volume_name_template = volume-%s
-volume_group = cinder-volumes
+volume_group = storage-volumes
verbose = True
auth_strategy = keystone
state_path = /var/lib/cinder