Unhardcode service user/group uid/gid values
Warn to not change cinder uid/gid values after user is created
Change-Id: Iff3e6491c14174c3aea12035878cc153b1621aef
diff --git a/README.rst b/README.rst
index 10c3c73..5bc4018 100644
--- a/README.rst
+++ b/README.rst
@@ -18,6 +18,8 @@
controller:
enabled: true
version: juno
+ cinder_uid: 304
+ cinder_gid: 304
default_volume_type: 7k2SaS
availability_zone_fallback: True
database:
@@ -61,6 +63,8 @@
volume:
enabled: true
version: juno
+ cinder_uid: 304
+ cinder_gid: 304
default_volume_type: 7k2SaS
database:
engine: mysql
diff --git a/cinder/controller.sls b/cinder/controller.sls
index 2d3ed9d..af5194d 100644
--- a/cinder/controller.sls
+++ b/cinder/controller.sls
@@ -1,8 +1,8 @@
{%- from "cinder/map.jinja" import controller with context %}
{%- if controller.get('enabled', False) %}
-include:
-- cinder.user
+{%- set user = controller %}
+{%- include "cinder/user.sls" %}
cinder_controller_packages:
pkg.installed:
diff --git a/cinder/map.jinja b/cinder/map.jinja
index fec426d..6808dae 100644
--- a/cinder/map.jinja
+++ b/cinder/map.jinja
@@ -9,6 +9,8 @@
'audit': {
'enabled': false
},
+ 'cinder_uid': 304,
+ 'cinder_gid': 304,
'backup': {
'pkgs': ['cinder-backup'],
'services': ['cinder-backup'],
@@ -24,6 +26,8 @@
'audit': {
'enabled': false
},
+ 'cinder_uid': 304,
+ 'cinder_gid': 304,
'backup': {
'pkgs': ['cinder-backup'],
'services': ['cinder-backup'],
@@ -42,6 +46,8 @@
'audit': {
'enabled': false
},
+ 'cinder_uid': 304,
+ 'cinder_gid': 304,
'backup': {
'pkgs': ['cinder-backup'],
'services': ['cinder-backup'],
@@ -57,6 +63,8 @@
'audit': {
'enabled': false
},
+ 'cinder_uid': 304,
+ 'cinder_gid': 304,
'backup': {
'pkgs': ['cinder-backup'],
'services': ['cinder-backup'],
diff --git a/cinder/user.sls b/cinder/user.sls
index 18f1cb5..cc93cbb 100644
--- a/cinder/user.sls
+++ b/cinder/user.sls
@@ -3,8 +3,9 @@
user.present:
- name: cinder
- home: /var/lib/cinder
- - uid: 304
- - gid: 304
+ {# note: cinder uid/gid values would not be evaluated after user is created. #}
+ - uid: {{ user.cinder_uid }}
+ - gid: {{ user.cinder_gid }}
- shell: /bin/false
- system: True
- require_in:
@@ -18,7 +19,8 @@
cinder_group:
group.present:
- name: cinder
- - gid: 304
+ {# note: cinder uid/gid values would not be evaluated after user is created. #}
+ - gid: {{ user.cinder_gid }}
- system: True
- require_in:
- user: cinder_user
diff --git a/cinder/volume.sls b/cinder/volume.sls
index d359a59..31b2af9 100644
--- a/cinder/volume.sls
+++ b/cinder/volume.sls
@@ -1,8 +1,10 @@
{%- from "cinder/map.jinja" import volume with context %}
{%- if volume.enabled %}
-include:
-- cinder.user
+{%- if pillar.cinder.controller is not defined %}
+{%- set user = volume %}
+{%- include "cinder/user.sls" %}
+{%- endif %}
cinder_volume_packages:
pkg.installed: