fuel-ccp-nova/service/nova-api.yaml

179 lines
6.7 KiB
YAML

dsl_version: 0.4.0
service:
name: nova-api
ports:
- {{ nova.api_port }}
- {{ nova.metadata.port }}
annotations:
service:
prometheus.io/probe: "true"
containers:
- name: nova-api
image: nova-api
privileged: true
pre:
- name: nova-db-create
type: single
command: mysql -v -u root -p{{ db.root_password }} -h {{ address("database") }} -e 'create database `{{ nova.db.name }}`;
create database `{{ nova.db.api_name }}`;
{% if nova.cells_v2.enabled %} create database `nova_{{ nova.cells_v2.cell_name }}`; {% endif -%}
create user "{{ nova.db.username }}"@"%" identified by "{{ nova.db.password }}"
{% if db.tls.enabled %} require ssl {% endif %};
grant all privileges on `{{ nova.db.name }}`.* to "{{ nova.db.username }}"@"%" identified by "{{ nova.db.password }}"
{% if db.tls.enabled %} require ssl {% endif %};
grant all privileges on `{{ nova.db.api_name }}`.* to "{{ nova.db.username }}"@"%" identified by "{{ nova.db.password }}"
{% if db.tls.enabled %} require ssl {% endif %};
{% if nova.cells_v2.enabled %} grant all privileges on `nova_{{ nova.cells_v2.cell_name }}`.* to "{{ nova.db.username }}"@"%" identified by "{{ nova.db.password }}"
{% if db.tls.enabled %} require ssl {% endif %}; {% endif %}'
dependencies:
- database
files:
- nova.conf
- name: nova-db-sync
type: single
command: nova-manage db sync
dependencies:
- nova-db-create
files:
- nova.conf
- name: nova-api-db-sync
type: single
command: nova-manage api_db sync
dependencies:
- nova-db-create
files:
- nova.conf
- name: nova-db-migrations
type: single
command: nova-manage db online_data_migrations
dependencies:
- nova-api-db-sync
files:
- nova.conf
# {% if nova.cells_v2.enabled %}
- name: nova-cell-create
type: single
dependencies:
- nova-api-db-sync
- nova-db-sync
command: nova-manage cell_v2 create_cell --name {{ nova.cells_v2.cell_name }}
files:
- nova.conf
# {% endif %}
- name: nova-user-create
type: single
command: openstack user create --domain {{ service_account.domain }} --password {{ nova.password }} {{ nova.username }}
dependencies:
- keystone-create-domain
- name: nova-role-add
dependencies:
- nova-user-create
type: single
command: openstack role add --project {{ service_account.project }} --user {{ nova.username }} admin
- name: nova-service-legacy-create
dependencies:
- keystone
type: single
command: openstack service create --name nova_legacy --description "Nova Compute Service (Legacy 2.0)" compute_legacy
- name: nova-public-legacy-endpoint-create
dependencies:
- nova-service-legacy-create
type: single
command: openstack endpoint create --region RegionOne compute_legacy public {{ address('nova-api', nova.api_port, external=True, with_scheme=True) }}/v2/$\(project_id\)s
- name: nova-internal-legacy-endpoint-create
dependencies:
- nova-service-legacy-create
type: single
command: openstack endpoint create --region RegionOne compute_legacy internal {{ address('nova-api', nova.api_port, with_scheme=True) }}/v2/$\(project_id\)s
- name: nova-admin-legacy-endpoint-create
dependencies:
- nova-service-legacy-create
type: single
command: openstack endpoint create --region RegionOne compute_legacy admin {{ address('nova-api', nova.api_port, with_scheme=True) }}/v2/$\(project_id\)s
- name: nova-service-create
dependencies:
- keystone
type: single
command: openstack service create --name nova --description "Nova Compute Service" compute
- name: nova-public-endpoint-create
dependencies:
- nova-service-create
type: single
command: openstack endpoint create --region RegionOne compute public {{ address('nova-api', nova.api_port, external=True, with_scheme=True) }}/v2.1
- name: nova-internal-endpoint-create
dependencies:
- nova-service-create
type: single
command: openstack endpoint create --region RegionOne compute internal {{ address('nova-api', nova.api_port, with_scheme=True) }}/v2.1
- name: nova-admin-endpoint-create
dependencies:
- nova-service-create
type: single
command: openstack endpoint create --region RegionOne compute admin {{ address('nova-api', nova.api_port, with_scheme=True) }}/v2.1
daemon:
command: nova-api --config-file /etc/nova/nova.conf
files:
- nova.conf
# {% if nova.tls.enabled %}
- ca-cert
# {% endif %}
# {% if nova.bootstrap.enable %}
post:
# {% for flavor in nova.bootstrap.flavors %}
- name: nova-bootstrap-flavor-{{ flavor.id }}
type: single
command: /opt/ccp/bin/create-flavor.sh {{ flavor.name }} {{ flavor.id }} {{ flavor.ram }} {{ flavor.disk }} {{ flavor.vcpus }}
files:
- create-flavor.sh
# {% if nova.tls.enabled %}
- ca-cert
# {% endif %}
# {% endfor %}
# {% endif %}
# {% if nova.tls.enabled %}
- name: nginx-nova-api
image: nginx
daemon:
files:
- upstreams
- servers
- server-cert
- server-key
command: nginx
# {% endif %}
files:
nova.conf:
path: /etc/nova/nova.conf
content: nova.conf.j2
perm: "0600"
create-flavor.sh:
path: /opt/ccp/bin/create-flavor.sh
content: create-flavor.sh.j2
perm: "0700"
# {% if nova.tls.enabled %}
servers:
path: /etc/nginx/conf.d/servers.conf
content: nginx-nova-api.conf.j2
perm: "0400"
upstreams:
path: /etc/nginx/conf.d/upstreams.conf
content: upstreams.conf.j2
perm: "0400"
server-cert:
path: /opt/ccp/etc/tls/server-cert.pem
content: server-cert.pem.j2
perm: "0400"
server-key:
path: /opt/ccp/etc/tls/server-key.pem
content: server-key.pem.j2
perm: "0400"
ca-cert:
path: /opt/ccp/etc/tls/ca.pem
content: ca-cert.pem.j2
perm: "0400"
# {% endif %}