devstack: try to emulate `sp-openstack groups cinder,nova,glance`
Change-Id: I3065dcff5f40e9fcbffd4e2984b1890911bd870a
diff --git a/playbooks/tempest-and-cinderlib-run.yaml b/playbooks/tempest-and-cinderlib-run.yaml
index 7135acb..abbd2ed 100644
--- a/playbooks/tempest-and-cinderlib-run.yaml
+++ b/playbooks/tempest-and-cinderlib-run.yaml
@@ -1,5 +1,6 @@
- hosts: all
roles:
+ - sp-openstack-integration-groups
- orchestrate-devstack
# We run tests only on one node, regardless how many nodes are in the system
diff --git a/roles/sp-openstack-integration-groups/README.rst b/roles/sp-openstack-integration-groups/README.rst
new file mode 100644
index 0000000..0561f3d
--- /dev/null
+++ b/roles/sp-openstack-integration-groups/README.rst
@@ -0,0 +1,2 @@
+Add the `spopenstack` group and add the (still non-existent)
+`cinder`, `nova`, and `glance` user accounts to it.
diff --git a/roles/sp-openstack-integration-groups/tasks/main.yaml b/roles/sp-openstack-integration-groups/tasks/main.yaml
new file mode 100644
index 0000000..551cbb7
--- /dev/null
+++ b/roles/sp-openstack-integration-groups/tasks/main.yaml
@@ -0,0 +1,36 @@
+---
+- name: "Create the spopenstack group"
+ become: true
+ ansible.builtin.group:
+ name: spopenstack
+ system: true
+
+- name: "Add the 'cinder', 'nova', and 'glance' accounts to that group"
+ become: true
+ ansible.builtin.lineinfile:
+ backrefs: true
+ line: "\\g<1>:cinder,nova,glance"
+ path: /etc/group
+ regexp: "^(spopenstack:[^:]*:[^:]*):$"
+
+- name: "Let's see what we did there..."
+ shell: getent group spopenstack
+
+- name: "Create the /var/spool/openstack-storpool directory"
+ become: true
+ ansible.builtin.file:
+ path: /var/spool/openstack-storpool
+ state: directory
+ owner: root
+ group: spopenstack
+ mode: 0770
+
+- name: "Create the /var/spool/openstack-storpool/openstack-attach.json file"
+ become: true
+ ansible.builtin.copy:
+ dest: /var/spool/openstack-storpool/openstack-attach.json
+ owner: root
+ group: spopenstack
+ mode: 0660
+ content: |
+ {}