---

- name: create database
  mysql_db: name=glance state=present

- name: create glance user
  mysql_user: name=glance host={{ item }} password={{ GLANCE_DBPASS }} priv=glance.*:ALL state=present
  with_items:
    - localhost
    - "%"

- name: create glance service entry and endpoint
  script: create_glance_service_entity_and_api_endpoint.sh {{ GLANCE_PASS }} {{ api_host }}
  environment: admin_openrc
  sudo: no

- name: install glance packages
  apt: pkg=glance update_cache=yes cache_valid_time=3600

- name: edit glance-api conf file
  template: src=glance-api.conf.j2 dest=/etc/glance/glance-api.conf

- name: edit glance-registry conf file
  template: src=glance-registry.conf.j2 dest=/etc/glance/glance-registry.conf

- name: Populate the Image service database
  script: glance_db_sync.sh

- name: Restart the Image service services
  service: name={{ item }} state=restarted
  with_items:
    - glance-registry
    - glance-api

---

- name: create database
  mysql_db: name=glance state=present

- name: create glance user
  mysql_user: name=glance host={{ item }} password={{ GLANCE_DBPASS }} priv=glance.*:ALL state=present
  with_items:
    - localhost
    - "%"

- name: create glance service entry and endpoint
  script: create_glance_service_entity_and_api_endpoint.sh {{ GLANCE_PASS }} {{ api_host }}
  environment: "{{ admin_openrc }}"
  sudo: no

- name: install glance packages
  apt: pkg=glance update_cache=yes cache_valid_time=3600

- name: edit glance-api conf file
  template: src=glance-api.conf.j2 dest=/etc/glance/glance-api.conf

- name: edit glance-registry conf file
  template: src=glance-registry.conf.j2 dest=/etc/glance/glance-registry.conf

- name: Populate the Image service database
  script: glance_db_sync.sh

- name: Restart the Image service services
  service: name={{ item }} state=restarted
  with_items:
    - glance-registry
    - glance-api

Fix environment setting in glance role
Fix environment setting in glance role
