<commit_before>{% set openstack = pillar['openstack'] -%}
{% set keystone = openstack['keystone'] -%}
{% set auth = openstack['auth'] -%}
{% set endpoint = auth.get('proto','http') + "://"+ auth['server']+":35357/v2.0/" -%}
{% set token = keystone['service']['password'] -%}
keystone-service:
  service.running:
    - name: keystone

admin-role:
  keystone.role_present:
    - name: admin
    - connection_endpoint: {{endpoint}}
    - connection_token: {{token}}
    - require:
      - service: keystone-service

service-tenant:
  keystone.tenant_present:
    - name: service
    - description: Service Tenant
    - connection_endpoint: {{endpoint}}
    - connection_token: {{token}}
    - require:
      - keystone: admin-role

{% for service_tenant in ['nova','quantum','cinder','glance'] %}
{% set user = openstack[service_tenant]['service'] %}

{{service_tenant}}-keystone-user:
  keystone.user_present:
    - name: {{user['username']}}
    - email: {{user['username']}}
    - password: {{<PASSWORD>['password']}}
    - role: admin
    - connection_token: {{token}}
    - connection_endpoint: {{endpoint}}
    - require:
      - keystone: admin-role
{% endfor %}<commit_msg>Add services to be added to keystone catalog.<commit_after>{% set openstack = pillar['openstack'] -%}
{% set endpoints = openstack.get('endpoints',{}) -%}
{% set keystone = openstack['keystone'] -%}
{% set auth = openstack['auth'] -%}
{% set endpoint = auth.get('proto','http') + "://"+ auth['server']+":35357/v2.0/" -%}
{% set token = keystone['service']['password'] -%}
keystone-service:
  service.running:
    - name: keystone

admin-role:
  keystone.role_present:
    - name: admin
    - connection_endpoint: {{endpoint}}
    - connection_token: {{token}}
    - require:
      - service: keystone-service

service-tenant:
  keystone.tenant_present:
    - name: service
    - description: Service Tenant
    - connection_endpoint: {{endpoint}}
    - connection_token: {{token}}
    - require:
      - keystone: admin-role

{% for service_tenant in ['nova','quantum','cinder','glance'] %}
{% set user = openstack[service_tenant]['service'] %}

{{service_tenant}}-keystone-user:
  keystone.user_present:
    - name: {{user['username']}}
    - email: {{user['username']}}
    - password: {{user['password']}}
    - role: admin
    - connection_token: {{token}}
    - connection_endpoint: {{endpoint}}
    - require:
      - keystone: admin-role
{% endfor %}

# Add the service types to the catalog

{% set services = {'network': 'quantum', 'compute': 'nova', 'identity': 'keystone',
                   'volume': 'volume', 'ec2': 'ec2', 'object-store': 'swift',
                   'image': 'glance'} %}

{% for service_type, service_name in services.items() %}
{{service_type}}-catalog-service:
  keystone.service_present:
    - name: {{service_name}}
    - service_type: {{service_type}}
    - connection_token: {{token}}
    - connection_endpoint: {{endpoint}}
{% endfor %}
{'fraction_non_alphanumeric': 0.18902439024390244, 'fraction_numerical': 0.005420054200542005, 'mean_word_length': 3.5854037267080745, 'pattern_counts': {'":': 4, '<': 4, '<?xml version=': 0, '>': 4, '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': '6161708', 'n_tokens_mistral': 994, 'n_tokens_neox': 931, 'n_words': 191}