<commit_before>---
# tasks file for cinder

- name: install cinder package
  yum: pkg=openstack-cinder state=present

- name: set db connection
  shell: openstack-config --set /etc/cinder/cinder.conf database connection mysql://cinder:{{ CINDER_DBPASS }}@controller/cinder

- name: create db
  shell: mysql -e "CREATE DATABASE cinder"
  ignore_errors: yes

- name: set grants
  shell: "{{ item }}"
  with_items:
   - mysql -e "GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost'  IDENTIFIED BY '{{ CINDER_DBPASS}}'"
   - mysql -e "GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%'  IDENTIFIED BY '{{ CINDER_DBPASS }}'"
   - mysql -e "GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'{{ CONTROLLER }}'   IDENTIFIED BY '{{ CINDER_DBPASS }}'"
   - mysql -e "FLUSH PRIVILEGES"

- name: check for cinder_setup confirmation file
  command: cat ~/.has_cinder_setup
  ignore_errors: yes
  register: cinder_setup_check

- name: cinder db sync
  shell: su -s /bin/sh -c "cinder-manage db sync" cinder
  when: cinder_setup_check|failed

- name: create keystone user and role
  shell: "{{ item }}"
  with_items:
   - keystone user-create --name=cinder --pass={{ <PASSWORD> }} --email={{ EMAIL }}
   - keystone user-role-add --user=cinder --tenant=service --role=admin
  environment: ENVIRONMENT
  when: cinder_setup_check|failed

- name: Edit the /etc/cinder/cinder.conf configuration file
  shell: "{{ item }}"
  with_items:
   - openstack-config --set /etc/cinder/cinder.conf DEFAULT  auth_strategy keystone
   - openstack-config --set /etc/cinder/cinder.conf keystone_authtoken  auth_uri http://{{ CONTROLLER }}:5000
   - openstack-config --set /etc/cinder/cinder.conf keystone_authtoken  auth_host {{ CONTROLLER }}
   - openstack-config --set /etc/cinder/cinder.conf keystone_authtoken  auth_protocol http
   - openstack-config --set /etc/cinder/cinder.conf keystone_authtoken  auth_port 35357
   - openstack-config --set /etc/cinder/cinder.conf keystone_authtoken  admin_user cinder
   - openstack-config --set /etc/cinder/cinder.conf keystone_authtoken  admin_tenant_name service
   - openstack-config --set /etc/cinder/cinder.conf keystone_authtoken  admin_password {{ CINDER_PASS }}
<commit_msg>removed extra spaces from tasks commands<commit_after>---
# tasks file for cinder

- name: install cinder package
  yum: pkg=openstack-cinder state=present

- name: set db connection
  shell: openstack-config --set /etc/cinder/cinder.conf database connection mysql://cinder:{{ CINDER_DBPASS }}@controller/cinder

- name: create db
  shell: mysql -e "CREATE DATABASE cinder"
  ignore_errors: yes

- name: set grants
  shell: "{{ item }}"
  with_items:
   - mysql -e "GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' IDENTIFIED BY '{{ CINDER_DBPASS}}'"
   - mysql -e "GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' IDENTIFIED BY '{{ CINDER_DBPASS }}'"
   - mysql -e "GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'{{ CONTROLLER }}' IDENTIFIED BY '{{ CINDER_DBPASS }}'"
   - mysql -e "FLUSH PRIVILEGES"

- name: check for cinder_setup confirmation file
  command: cat ~/.has_cinder_setup
  ignore_errors: yes
  register: cinder_setup_check

- name: cinder db sync
  shell: su -s /bin/sh -c "cinder-manage db sync" cinder
  when: cinder_setup_check|failed

- name: create keystone user and role
  shell: "{{ item }}"
  with_items:
   - keystone user-create --name=cinder --pass={{ <PASSWORD>_<PASSWORD> }} --email={{ EMAIL }}
   - keystone user-role-add --user=cinder --tenant=service --role=admin
  environment: ENVIRONMENT
  when: cinder_setup_check|failed

- name: Edit the /etc/cinder/cinder.conf configuration file
  shell: "{{ item }}"
  with_items:
   - openstack-config --set /etc/cinder/cinder.conf DEFAULT auth_strategy keystone
   - openstack-config --set /etc/cinder/cinder.conf keystone_authtoken auth_uri http://{{ CONTROLLER }}:5000
   - openstack-config --set /etc/cinder/cinder.conf keystone_authtoken auth_host {{ CONTROLLER }}
   - openstack-config --set /etc/cinder/cinder.conf keystone_authtoken auth_protocol http
   - openstack-config --set /etc/cinder/cinder.conf keystone_authtoken auth_port 35357
   - openstack-config --set /etc/cinder/cinder.conf keystone_authtoken admin_user cinder
   - openstack-config --set /etc/cinder/cinder.conf keystone_authtoken admin_tenant_name service
   - openstack-config --set /etc/cinder/cinder.conf keystone_authtoken admin_password {{ CINDER_PASS }}

{'fraction_non_alphanumeric': 0.12290249433106576, 'fraction_numerical': 0.004081632653061225, 'mean_word_length': 3.826039387308534, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '331090', 'n_tokens_mistral': 1600, 'n_tokens_neox': 1557, 'n_words': 395}