summaryrefslogtreecommitdiff
path: root/openstack/usr/share
diff options
context:
space:
mode:
Diffstat (limited to 'openstack/usr/share')
-rw-r--r--openstack/usr/share/openstack/cinder-config.yml37
-rw-r--r--openstack/usr/share/openstack/cinder-db.yml60
-rw-r--r--openstack/usr/share/openstack/cinder-iscsi.yml15
-rw-r--r--openstack/usr/share/openstack/cinder-lvs.yml21
-rw-r--r--openstack/usr/share/openstack/cinder.yml153
5 files changed, 133 insertions, 153 deletions
diff --git a/openstack/usr/share/openstack/cinder-config.yml b/openstack/usr/share/openstack/cinder-config.yml
new file mode 100644
index 00000000..7ca6ff32
--- /dev/null
+++ b/openstack/usr/share/openstack/cinder-config.yml
@@ -0,0 +1,37 @@
+---
+- hosts: localhost
+ vars_files:
+ - "/etc/openstack/cinder.conf"
+ tasks:
+# Configure cinder
+ - name: Create the cinder user.
+ user:
+ name: cinder
+ comment: Openstack Cinder Daemons
+ shell: /sbin/nologin
+ home: /var/lib/cinder
+
+ - name: Create the /var folders for cinder
+ file:
+ path: "{{ item }}"
+ state: directory
+ owner: cinder
+ group: cinder
+ with_items:
+ - /var/run/cinder
+ - /var/lock/cinder
+ - /var/log/cinder
+ - /var/lib/cinder
+ - /var/lib/cinder/volumer
+
+ - name: Create /etc/cinder directory
+ file:
+ path: /etc/cinder
+ state: directory
+
+ - name: Add the configuration needed for cinder in /etc/cinder using templates
+ template:
+ src: /usr/share/openstack/cinder/{{ item }}
+ dest: /etc/cinder/{{ item }}
+ with_lines:
+ - cd /usr/share/openstack/cinder && find -type f
diff --git a/openstack/usr/share/openstack/cinder-db.yml b/openstack/usr/share/openstack/cinder-db.yml
new file mode 100644
index 00000000..2a211720
--- /dev/null
+++ b/openstack/usr/share/openstack/cinder-db.yml
@@ -0,0 +1,60 @@
+---
+- hosts: localhost
+ vars_files:
+ - "/etc/openstack/cinder.conf"
+ tasks:
+ - name: Create cinder service user in service tenant
+ keystone_user:
+ user: "{{ CINDER_SERVICE_USER }}"
+ password: "{{ CINDER_SERVICE_PASSWORD }}"
+ tenant: service
+ token: "{{ KEYSTONE_TEMPORARY_ADMIN_TOKEN }}"
+
+ - name: Assign admin role to cinder service user in the service tenant
+ keystone_user:
+ role: admin
+ user: "{{ CINDER_SERVICE_USER }}"
+ tenant: service
+ token: "{{ KEYSTONE_TEMPORARY_ADMIN_TOKEN }}"
+
+ - name: Add cinder endpoint
+ keystone_service:
+ name: cinder
+ type: volume
+ description: Openstack Block Storage
+ publicurl: 'http://{{ CONTROLLER_HOST_ADDRESS }}:8776/v1/%(tenant_id)s'
+ internalurl: 'http://{{ CONTROLLER_HOST_ADDRESS }}:8776/v1/%(tenant_id)s'
+ adminurl: 'http://{{ CONTROLLER_HOST_ADDRESS }}:8776/v1/%(tenant_id)s'
+ region: regionOne
+ token: "{{ KEYSTONE_TEMPORARY_ADMIN_TOKEN }}"
+
+ - name: Add cinderv2 endpoint
+ keystone_service:
+ name: cinderv2
+ type: volumev2
+ description: Openstack Block Storage
+ publicurl: 'http://{{ CONTROLLER_HOST_ADDRESS }}:8776/v2/%(tenant_id)s'
+ internalurl: 'http://{{ CONTROLLER_HOST_ADDRESS }}:8776/v2/%(tenant_id)s'
+ adminurl: 'http://{{ CONTROLLER_HOST_ADDRESS }}:8776/v2/%(tenant_id)s'
+ region: regionOne
+ token: "{{ KEYSTONE_TEMPORARY_ADMIN_TOKEN }}"
+
+ - name: Create postgresql user for cinder
+ postgresql_user:
+ name: "{{ CINDER_DB_USER }}"
+ password: "{{ CINDER_DB_PASSWORD }}"
+ sudo: yes
+ sudo_user: cinder
+
+ - name: Create database for cinder services
+ postgresql_db:
+ name: cinder
+ owner: "{{ CINDER_DB_USER }}"
+ sudo: yes
+ sudo_user: cinder
+
+ - name: Initiate cinder database
+ cinder_manage:
+ action: dbsync
+ sudo: yes
+ sudo_user: cinder
diff --git a/openstack/usr/share/openstack/cinder-iscsi.yml b/openstack/usr/share/openstack/cinder-iscsi.yml
new file mode 100644
index 00000000..b80377ae
--- /dev/null
+++ b/openstack/usr/share/openstack/cinder-iscsi.yml
@@ -0,0 +1,15 @@
+---
+- hosts: localhost
+ tasks:
+ - name: Update kernel module dependencies
+ command: depmod -a
+
+ - name: generate InitiatorName for iscsi
+ shell: iscsi-iname
+ register: initiator_name
+
+ - lineinfile:
+ dest: /etc/iscsi/initiatorname.iscsi
+ regexp: '^InitiatorName=$'
+ line: 'InitiatorName={{ initiator_name.stdout }}'
+ backrefs: yes
diff --git a/openstack/usr/share/openstack/cinder-lvs.yml b/openstack/usr/share/openstack/cinder-lvs.yml
new file mode 100644
index 00000000..7a91a306
--- /dev/null
+++ b/openstack/usr/share/openstack/cinder-lvs.yml
@@ -0,0 +1,21 @@
+---
+- hosts: localhost
+ vars_files:
+ - "/etc/openstack/cinder.conf"
+ tasks:
+ - name: Check that CINDER_DEVICE exists
+ stat:
+ path: "{{ CINDER_DEVICE }}"
+ register: cinder_device_stats
+ failed_when: cinder_device_stats.stat.exists == false
+
+ - name: Configure LVM group for cinder
+ lvg:
+ vg: cinder-volumes
+ pvs: "{{ CINDER_DEVICE }}"
+
+ - lineinfile:
+ dest: /etc/lvm/lvm.conf
+ regexp: '# filter = \[ \"a\/\.\*/\" \]'
+ line: ' filter = [ "a|{{ CINDER_DEVICE }}|", "r/.*/" ]'
+ backrefs: yes
diff --git a/openstack/usr/share/openstack/cinder.yml b/openstack/usr/share/openstack/cinder.yml
deleted file mode 100644
index 29490843..00000000
--- a/openstack/usr/share/openstack/cinder.yml
+++ /dev/null
@@ -1,153 +0,0 @@
----
-- hosts: localhost
- vars_files:
- - "/etc/openstack/cinder.conf"
- tasks:
-
-# Configure iscsid, this can go in a separate script
- - name: Update kernel module dependencies
- command: depmod -a
-
- - name: generate InitiatorName for iscsi
- shell: iscsi-iname
- register: initiator_name
-
- - lineinfile:
- dest: /etc/iscsi/initiatorname.iscsi
- regexp: '^InitiatorName=$'
- line: 'InitiatorName={{ initiator_name.stdout }}'
- backrefs: yes
-
- - name: Enable and start iscsid
- service:
- name: "{{ item }}"
- enabled: yes
- state: started
- with_items:
- - iscsid
-
-# Configure LVM and target for Cinder
- - name: Check that CINDER_DEVICE exists
- stat:
- path: "{{ CINDER_DEVICE }}"
- register: cinder_device_stats
- failed_when: cinder_device_stats.stat.exists == false
-
- - name: Configure LVM group for cinder
- lvg:
- vg: cinder-volumes
- pvs: "{{ CINDER_DEVICE }}"
-
- - lineinfile:
- dest: /etc/lvm/lvm.conf
- regexp: '# filter = \[ \"a\/\.\*/\" \]'
- line: ' filter = [ "a|{{ CINDER_DEVICE }}|", "r/.*/" ]'
- backrefs: yes
-
- - name: Enable and start lvm2-lvmetad and target services
- service:
- name: "{{ item }}"
- enabled: yes
- state: started
- with_items:
- - lvm2-lvmetad
- - target
-
-# Configure cinder
- - name: Create the cinder user.
- user:
- name: cinder
- comment: Openstack Cinder Daemons
- shell: /sbin/nologin
- home: /var/lib/cinder
-
- - name: Create the /var folders for cinder
- file:
- path: "{{ item }}"
- state: directory
- owner: cinder
- group: cinder
- with_items:
- - /var/run/cinder
- - /var/lock/cinder
- - /var/log/cinder
- - /var/lib/cinder
- - /var/lib/cinder/volumer
-
- - name: Create /etc/cinder directory
- file:
- path: /etc/cinder
- state: directory
-
- - name: Add the configuration needed for cinder in /etc/cinder using templates
- template:
- src: /usr/share/openstack/cinder/{{ item }}
- dest: /etc/cinder/{{ item }}
- with_lines:
- - cd /usr/share/openstack/cinder && find -type f
-
- - name: Create cinder service user in service tenant
- keystone_user:
- user: "{{ CINDER_SERVICE_USER }}"
- password: "{{ CINDER_SERVICE_PASSWORD }}"
- tenant: service
- token: "{{ KEYSTONE_TEMPORARY_ADMIN_TOKEN }}"
-
- - name: Assign admin role to cinder service user in the service tenant
- keystone_user:
- role: admin
- user: "{{ CINDER_SERVICE_USER }}"
- tenant: service
- token: "{{ KEYSTONE_TEMPORARY_ADMIN_TOKEN }}"
-
- - name: Add cinder endpoint
- keystone_service:
- name: cinder
- type: volume
- description: Openstack Block Storage
- publicurl: 'http://{{ CONTROLLER_HOST_ADDRESS }}:8776/v1/%(tenant_id)s'
- internalurl: 'http://{{ CONTROLLER_HOST_ADDRESS }}:8776/v1/%(tenant_id)s'
- adminurl: 'http://{{ CONTROLLER_HOST_ADDRESS }}:8776/v1/%(tenant_id)s'
- region: regionOne
- token: "{{ KEYSTONE_TEMPORARY_ADMIN_TOKEN }}"
-
- - name: Add cinderv2 endpoint
- keystone_service:
- name: cinderv2
- type: volumev2
- description: Openstack Block Storage
- publicurl: 'http://{{ CONTROLLER_HOST_ADDRESS }}:8776/v2/%(tenant_id)s'
- internalurl: 'http://{{ CONTROLLER_HOST_ADDRESS }}:8776/v2/%(tenant_id)s'
- adminurl: 'http://{{ CONTROLLER_HOST_ADDRESS }}:8776/v2/%(tenant_id)s'
- region: regionOne
- token: "{{ KEYSTONE_TEMPORARY_ADMIN_TOKEN }}"
-
- - name: Create postgresql user for cinder
- postgresql_user:
- name: "{{ CINDER_DB_USER }}"
- sudo: yes
- sudo_user: cinder
-
- - name: Create database for cinder services
- postgresql_db:
- name: cinder
- owner: "{{ CINDER_DB_USER }}"
- sudo: yes
- sudo_user: cinder
-
- - name: Initiate cinder database
- cinder_manage:
- action: dbsync
- sudo: yes
- sudo_user: cinder
-
- - name: Enable and start openstack-cinder services
- service:
- name: "{{ item }}"
- enabled: yes
- state: started
- with_items:
- - openstack-cinder-api
- - openstack-cinder-scheduler
- - openstack-cinder-volume
- - openstack-cinder-backup