Remove Ansible abstraction for Nova

Co-Authored-By: Sam Yaple <sam@yaple.net>
Change-Id: Iad9fd7010eaf112f169feb54d9a0e97fd693e5f1
Partially-Implements: blueprint remove-abstraction-ansible
This commit is contained in:
Swapnil Kulkarni 2015-08-11 07:03:47 +00:00 committed by Sam Yaple
parent b11321cedc
commit b3ef443cd3
3 changed files with 201 additions and 111 deletions

View File

@ -8,54 +8,37 @@ nova_database_name: "nova"
nova_database_user: "nova"
nova_database_address: "{{ kolla_internal_address }}"
# Do not override "service_*" variables
service_database_name: "{{ nova_database_name }}"
service_database_user: "{{ nova_database_user }}"
service_database_password: "{{ nova_database_password }}"
####################
# Docker
####################
docker_nova_registry: "{{ docker_registry ~ '/' if docker_registry else '' }}"
docker_nova_namespace: "{{ docker_namespace }}"
kolla_nova_base_distro: "{{ kolla_base_distro }}"
kolla_nova_install_type: "{{ kolla_install_type }}"
nova_libvirt_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-nova-libvirt"
nova_libvirt_tag: "{{ openstack_release }}"
nova_libvirt_image_full: "{{ nova_libvirt_image }}:{{ nova_libvirt_tag }}"
kolla_nova_libvirt_container_name: "nova-libvirt"
docker_nova_libvirt_image: "{{ docker_nova_registry }}{{ docker_nova_namespace }}/{{ kolla_nova_base_distro }}-{{ kolla_nova_install_type }}-{{ kolla_nova_libvirt_container_name }}"
docker_nova_libvirt_tag: "{{ openstack_release }}"
docker_nova_libvirt_image_full: "{{ docker_nova_libvirt_image }}:{{ docker_nova_libvirt_tag }}"
nova_conductor_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-nova-conductor"
nova_conductor_tag: "{{ openstack_release }}"
nova_conductor_image_full: "{{ nova_conductor_image }}:{{ nova_conductor_tag }}"
kolla_nova_api_container_name: "nova-api"
docker_nova_api_image: "{{ docker_nova_registry }}{{ docker_nova_namespace }}/{{ kolla_nova_base_distro }}-{{ kolla_nova_install_type }}-{{ kolla_nova_api_container_name }}"
docker_nova_api_tag: "{{ openstack_release }}"
docker_nova_api_image_full: "{{ docker_nova_api_image }}:{{ docker_nova_api_tag }}"
nova_consoleauth_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-nova-consoleauth"
nova_consoleauth_tag: "{{ openstack_release }}"
nova_consoleauth_image_full: "{{ nova_consoleauth_image }}:{{ nova_consoleauth_tag }}"
kolla_nova_conductor_container_name: "nova-conductor"
docker_nova_conductor_image: "{{ docker_nova_registry }}{{ docker_nova_namespace }}/{{ kolla_nova_base_distro }}-{{ kolla_nova_install_type }}-{{ kolla_nova_conductor_container_name }}"
docker_nova_conductor_tag: "{{ openstack_release }}"
docker_nova_conductor_image_full: "{{ docker_nova_conductor_image }}:{{ docker_nova_conductor_tag }}"
nova_novncproxy_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-nova-novncproxy"
nova_novncproxy_tag: "{{ openstack_release }}"
nova_novncproxy_image_full: "{{ nova_novncproxy_image }}:{{ nova_novncproxy_tag }}"
kolla_nova_consoleauth_container_name: "nova-consoleauth"
docker_nova_consoleauth_image: "{{ docker_nova_registry }}{{ docker_nova_namespace }}/{{ kolla_nova_base_distro }}-{{ kolla_nova_install_type }}-{{ kolla_nova_consoleauth_container_name }}"
docker_nova_consoleauth_tag: "{{ openstack_release }}"
docker_nova_consoleauth_image_full: "{{ docker_nova_consoleauth_image }}:{{ docker_nova_consoleauth_tag }}"
nova_scheduler_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-nova-scheduler"
nova_scheduler_tag: "{{ openstack_release }}"
nova_scheduler_image_full: "{{ nova_scheduler_image }}:{{ nova_scheduler_tag }}"
kolla_nova_novncproxy_container_name: "nova-novncproxy"
docker_nova_novncproxy_image: "{{ docker_nova_registry }}{{ docker_nova_namespace }}/{{ kolla_nova_base_distro }}-{{ kolla_nova_install_type }}-{{ kolla_nova_novncproxy_container_name }}"
docker_nova_novncproxy_tag: "{{ openstack_release }}"
docker_nova_novncproxy_image_full: "{{ docker_nova_novncproxy_image }}:{{ docker_nova_novncproxy_tag }}"
nova_compute_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-nova-compute"
nova_compute_tag: "{{ openstack_release }}"
nova_compute_image_full: "{{ nova_compute_image }}:{{ nova_compute_tag }}"
kolla_nova_scheduler_container_name: "nova-scheduler"
docker_nova_scheduler_image: "{{ docker_nova_registry }}{{ docker_nova_namespace }}/{{ kolla_nova_base_distro }}-{{ kolla_nova_install_type }}-{{ kolla_nova_scheduler_container_name }}"
docker_nova_scheduler_tag: "{{ openstack_release }}"
docker_nova_scheduler_image_full: "{{ docker_nova_scheduler_image }}:{{ docker_nova_scheduler_tag }}"
kolla_nova_compute_container_name: "nova-compute"
docker_nova_compute_image: "{{ docker_nova_registry }}{{ docker_nova_namespace }}/{{ kolla_nova_base_distro }}-{{ kolla_nova_install_type }}-{{ kolla_nova_compute_container_name }}"
docker_nova_compute_tag: "{{ openstack_release }}"
docker_nova_compute_image_full: "{{ docker_nova_compute_image }}:{{ docker_nova_compute_tag }}"
nova_api_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-nova-api"
nova_api_tag: "{{ openstack_release }}"
nova_api_image_full: "{{ nova_api_image }}:{{ nova_api_tag }}"
####################

View File

@ -1,20 +1,61 @@
---
- include: ../../start.yml
vars:
container_command: "/bin/sleep infinity"
container_image: "{{ docker_nova_api_image_full }}"
container_name: "nova_data"
container_volumes:
- "/var/lib/nova/"
- name: Creating Nova database
command: docker exec -t kolla_ansible /usr/bin/ansible localhost
-m mysql_db
-a "login_host='{{ database_address }}'
login_user='{{ database_user }}'
login_password='{{ database_password }}'
name='{{ nova_database_name }}'"
register: database
changed_when: "{{ database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}"
failed_when: database.stdout.split()[2] != 'SUCCESS'
run_once: True
- include: ../../bootstrap.yml
vars:
container_detach: False
container_environment:
- name: Creating Nova database user and setting permissions
command: docker exec -t kolla_ansible /usr/bin/ansible localhost
-m mysql_user
-a "login_host='{{ database_address }}'
login_user='{{ database_user }}'
login_password='{{ database_password }}'
name='{{ nova_database_name }}'
password='{{ nova_database_password }}'
host='%'
priv='{{ nova_database_name }}.*:ALL'
append_privs='yes'"
register: database_user
changed_when: "{{ database.stdout.find('localhost | SUCCESS => ') != -1 and (database_user.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}"
failed_when: database_user.stdout.split()[2] != 'SUCCESS'
run_once: True
- name: Starting Nova bootstrap container
docker:
detach: False
docker_api_version: "{{ docker_api_version }}"
net: host
pull: "{{ docker_pull_policy }}"
restart_policy: "no"
state: reloaded
registry: "{{ docker_registry }}"
username: "{{ docker_registry_username }}"
password: "{{ docker_registry_password }}"
insecure_registry: "{{ docker_insecure_registry }}"
name: bootstrap_nova
image: "{{ nova_api_image_full }}"
volumes: "{{ node_config_directory }}/nova-api/:/opt/kolla/nova-api/:ro"
env:
KOLLA_BOOTSTRAP:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
container_image: "{{ docker_nova_api_image_full }}"
container_name: "bootstrap_nova"
container_restart_policy: "no"
container_volumes:
- "{{ node_config_directory }}/nova-api/:/opt/kolla/nova-api/:ro"
run_once: True
when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed
# https://github.com/ansible/ansible-modules-core/pull/1031
- name: Waiting for bootstrap container to exit
command: docker wait bootstrap_nova
when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed
- name: Cleaning up Nova boostrap container
docker:
name: bootstrap_nova
image: "{{ nova_api_image_full }}"
state: absent
when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed

View File

@ -1,81 +1,147 @@
---
- include: ../../start.yml
vars:
container_environment:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
container_image: "{{ docker_nova_libvirt_image_full }}"
container_name: "nova_libvirt"
container_privileged: "True"
container_pid: "True"
container_volumes:
- name: Starting Nova-libvirt container
docker:
docker_api_version: "{{ docker_api_version }}"
net: host
pull: "{{ docker_pull_policy }}"
restart_policy: "{{ docker_restart_policy }}"
restart_policy_retry: "{{ docker_restart_policy_retry }}"
state: reloaded
registry: "{{ docker_registry }}"
username: "{{ docker_registry_username }}"
password: "{{ docker_registry_password }}"
insecure_registry: "{{ docker_insecure_registry }}"
privileged: True
pid: host
name: nova_libvirt
image: "{{ nova_libvirt_image_full }}"
volumes:
- "{{ node_config_directory }}/nova-libvirt/:/opt/kolla/nova-libvirt/:ro"
- "/run:/run"
- "/lib/modules:/lib/modules:ro"
- "/var/lib/nova/instances"
env:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
when: inventory_hostname in groups['compute']
- include: ../../start.yml
vars:
container_environment:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
container_image: "{{ docker_nova_api_image_full }}"
container_name: "nova_api"
container_privileged: "True"
container_volumes:
- name: Starting Nova-api container
docker:
docker_api_version: "{{ docker_api_version }}"
net: host
pull: "{{ docker_pull_policy }}"
restart_policy: "{{ docker_restart_policy }}"
restart_policy_retry: "{{ docker_restart_policy_retry }}"
state: reloaded
registry: "{{ docker_registry }}"
username: "{{ docker_registry_username }}"
password: "{{ docker_registry_password }}"
insecure_registry: "{{ docker_insecure_registry }}"
privileged: True
name: nova_api
image: "{{ nova_api_image_full }}"
volumes:
- "{{ node_config_directory }}/nova-api/:/opt/kolla/nova-api/:ro"
- "/lib/modules:/lib/modules:ro"
env:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
when: inventory_hostname in groups['nova-api']
- include: ../../start.yml
vars:
container_environment:
- name: Starting Nova-conductor container
docker:
docker_api_version: "{{ docker_api_version }}"
net: host
pull: "{{ docker_pull_policy }}"
restart_policy: "{{ docker_restart_policy }}"
restart_policy_retry: "{{ docker_restart_policy_retry }}"
state: reloaded
registry: "{{ docker_registry }}"
username: "{{ docker_registry_username }}"
password: "{{ docker_registry_password }}"
insecure_registry: "{{ docker_insecure_registry }}"
name: nova_conductor
image: "{{ nova_conductor_image_full }}"
volumes: "{{ node_config_directory }}/nova-conductor/:/opt/kolla/nova-conductor/:ro"
env:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
container_image: "{{ docker_nova_conductor_image_full }}"
container_name: "nova_conductor"
container_volumes:
- "{{ node_config_directory }}/nova-conductor/:/opt/kolla/nova-conductor/:ro"
when: inventory_hostname in groups['nova-conductor']
- include: ../../start.yml
vars:
container_environment:
- name: Starting Nova-consoleauth container
docker:
docker_api_version: "{{ docker_api_version }}"
net: host
pull: "{{ docker_pull_policy }}"
restart_policy: "{{ docker_restart_policy }}"
restart_policy_retry: "{{ docker_restart_policy_retry }}"
state: reloaded
registry: "{{ docker_registry }}"
username: "{{ docker_registry_username }}"
password: "{{ docker_registry_password }}"
insecure_registry: "{{ docker_insecure_registry }}"
name: nova_consoleauth
image: "{{ nova_consoleauth_image_full }}"
volumes: "{{ node_config_directory }}/nova-consoleauth/:/opt/kolla/nova-consoleauth/:ro"
env:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
container_image: "{{ docker_nova_consoleauth_image_full }}"
container_name: "nova_consoleauth"
container_volumes:
- "{{ node_config_directory }}/nova-consoleauth/:/opt/kolla/nova-consoleauth/:ro"
when: inventory_hostname in groups['nova-consoleauth']
- include: ../../start.yml
vars:
container_environment:
- name: Starting Nova-novncproxy container
docker:
docker_api_version: "{{ docker_api_version }}"
net: host
pull: "{{ docker_pull_policy }}"
restart_policy: "{{ docker_restart_policy }}"
restart_policy_retry: "{{ docker_restart_policy_retry }}"
state: reloaded
registry: "{{ docker_registry }}"
username: "{{ docker_registry_username }}"
password: "{{ docker_registry_password }}"
insecure_registry: "{{ docker_insecure_registry }}"
name: nova_novncproxy
image: "{{ nova_novncproxy_image_full }}"
volumes: "{{ node_config_directory }}/nova-novncproxy/:/opt/kolla/nova-novncproxy/:ro"
env:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
container_image: "{{ docker_nova_novncproxy_image_full }}"
container_name: "nova_novncproxy"
container_volumes:
- "{{ node_config_directory }}/nova-novncproxy/:/opt/kolla/nova-novncproxy/:ro"
when: inventory_hostname in groups['nova-novncproxy']
- include: ../../start.yml
vars:
container_environment:
- name: Starting Nova-scheduler container
docker:
docker_api_version: "{{ docker_api_version }}"
net: host
pull: "{{ docker_pull_policy }}"
restart_policy: "{{ docker_restart_policy }}"
restart_policy_retry: "{{ docker_restart_policy_retry }}"
state: reloaded
registry: "{{ docker_registry }}"
username: "{{ docker_registry_username }}"
password: "{{ docker_registry_password }}"
insecure_registry: "{{ docker_insecure_registry }}"
name: nova_scheduler
image: "{{ nova_scheduler_image_full }}"
volumes: "{{ node_config_directory }}/nova-scheduler/:/opt/kolla/nova-scheduler/:ro"
env:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
container_image: "{{ docker_nova_scheduler_image_full }}"
container_name: "nova_scheduler"
container_volumes:
- "{{ node_config_directory }}/nova-scheduler/:/opt/kolla/nova-scheduler/:ro"
when: inventory_hostname in groups['nova-scheduler']
- include: ../../start.yml
vars:
container_environment:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
container_image: "{{ docker_nova_compute_image_full }}"
container_name: "nova_compute"
container_privileged: "True"
container_volumes:
- name: Starting Nova-compute container
docker:
docker_api_version: "{{ docker_api_version }}"
net: host
pull: "{{ docker_pull_policy }}"
restart_policy: "{{ docker_restart_policy }}"
restart_policy_retry: "{{ docker_restart_policy_retry }}"
state: reloaded
registry: "{{ docker_registry }}"
username: "{{ docker_registry_username }}"
password: "{{ docker_registry_password }}"
insecure_registry: "{{ docker_insecure_registry }}"
privileged: True
name: nova_compute
image: "{{ nova_compute_image_full }}"
volumes:
- "{{ node_config_directory }}/nova-compute/:/opt/kolla/nova-compute/:ro"
- "/run:/run"
- "/lib/modules:/lib/modules:ro"
container_volumes_from:
- "nova_libvirt"
- "/run:/run"
volumes_from:
- nova_libvirt
env:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
when: inventory_hostname in groups['compute']