---
- name: keystone user
  user: name=keystone shell=/bin/false

- name: get keystone source repo
  git: |
    repo={{ openstack.git_mirror }}/keystone.git dest=/opt/stack/keystone version={{ keystone.rev }}
  notify:
    - pip install keystone

- name: /etc/keystone
  file: dest=/etc/keystone state=directory

- name: keystone.conf
  template: src=etc/keystone/keystone.conf dest=/etc/keystone/keystone.conf mode=0644
  notify:
    - restart keystone

- name: policy.json
  template: src=etc/keystone/policy.json dest=/etc/keystone/policy.json mode=0644
  notify:
    - restart keystone

- name: keystone start script
  template: src=etc/init/keystone.conf dest=/etc/init/keystone.conf mode=0644
  notify:
    - restart keystone

# TODO: generate only once and distribute.
- meta: flush_handlers # ensure keystone-manage is pip-installed.
- name: keystone pki
  command: keystone-manage pki_setup --keystone-user keystone --keystone-group keystone

- name: keystone is running
  service: name=keystone state=started

- sensu_process_check: service=keystone-all

---
- name: keystone user
  user: name=keystone shell=/bin/false

- name: WORKAROUND - keystone doesn't include babel in dependencies
  pip: name=babel

- name: get keystone source repo
  git: |
    repo={{ openstack.git_mirror }}/keystone.git dest=/opt/stack/keystone version={{ keystone.rev }}
  notify:
    - pip install keystone

- name: /etc/keystone
  file: dest=/etc/keystone state=directory

- name: keystone.conf
  template: src=etc/keystone/keystone.conf dest=/etc/keystone/keystone.conf mode=0644
  notify:
    - restart keystone

- name: policy.json
  template: src=etc/keystone/policy.json dest=/etc/keystone/policy.json mode=0644
  notify:
    - restart keystone

- name: keystone start script
  template: src=etc/init/keystone.conf dest=/etc/init/keystone.conf mode=0644
  notify:
    - restart keystone

# TODO: generate only once and distribute.
- meta: flush_handlers # ensure keystone-manage is pip-installed.
- name: keystone pki
  command: keystone-manage pki_setup --keystone-user keystone --keystone-group keystone

- name: keystone is running
  service: name=keystone state=started

- sensu_process_check: service=keystone-all

Install babel python package as workaround for keystone.
Install babel python package as workaround for keystone.
