Merge "Remove Ansible abstraction for Nova"

This commit is contained in:
Jenkins 2015-08-18 20:25:32 +00:00 committed by Gerrit Code Review
commit 718db54fa8
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_user: "nova"
nova_database_address: "{{ kolla_internal_address }}" 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
#################### ####################
docker_nova_registry: "{{ docker_registry ~ '/' if docker_registry else '' }}" nova_libvirt_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-nova-libvirt"
docker_nova_namespace: "{{ docker_namespace }}" nova_libvirt_tag: "{{ openstack_release }}"
kolla_nova_base_distro: "{{ kolla_base_distro }}" nova_libvirt_image_full: "{{ nova_libvirt_image }}:{{ nova_libvirt_tag }}"
kolla_nova_install_type: "{{ kolla_install_type }}"
kolla_nova_libvirt_container_name: "nova-libvirt" nova_conductor_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-nova-conductor"
docker_nova_libvirt_image: "{{ docker_nova_registry }}{{ docker_nova_namespace }}/{{ kolla_nova_base_distro }}-{{ kolla_nova_install_type }}-{{ kolla_nova_libvirt_container_name }}" nova_conductor_tag: "{{ openstack_release }}"
docker_nova_libvirt_tag: "{{ openstack_release }}" nova_conductor_image_full: "{{ nova_conductor_image }}:{{ nova_conductor_tag }}"
docker_nova_libvirt_image_full: "{{ docker_nova_libvirt_image }}:{{ docker_nova_libvirt_tag }}"
kolla_nova_api_container_name: "nova-api" nova_consoleauth_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-nova-consoleauth"
docker_nova_api_image: "{{ docker_nova_registry }}{{ docker_nova_namespace }}/{{ kolla_nova_base_distro }}-{{ kolla_nova_install_type }}-{{ kolla_nova_api_container_name }}" nova_consoleauth_tag: "{{ openstack_release }}"
docker_nova_api_tag: "{{ openstack_release }}" nova_consoleauth_image_full: "{{ nova_consoleauth_image }}:{{ nova_consoleauth_tag }}"
docker_nova_api_image_full: "{{ docker_nova_api_image }}:{{ docker_nova_api_tag }}"
kolla_nova_conductor_container_name: "nova-conductor" nova_novncproxy_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-nova-novncproxy"
docker_nova_conductor_image: "{{ docker_nova_registry }}{{ docker_nova_namespace }}/{{ kolla_nova_base_distro }}-{{ kolla_nova_install_type }}-{{ kolla_nova_conductor_container_name }}" nova_novncproxy_tag: "{{ openstack_release }}"
docker_nova_conductor_tag: "{{ openstack_release }}" nova_novncproxy_image_full: "{{ nova_novncproxy_image }}:{{ nova_novncproxy_tag }}"
docker_nova_conductor_image_full: "{{ docker_nova_conductor_image }}:{{ docker_nova_conductor_tag }}"
kolla_nova_consoleauth_container_name: "nova-consoleauth" nova_scheduler_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-nova-scheduler"
docker_nova_consoleauth_image: "{{ docker_nova_registry }}{{ docker_nova_namespace }}/{{ kolla_nova_base_distro }}-{{ kolla_nova_install_type }}-{{ kolla_nova_consoleauth_container_name }}" nova_scheduler_tag: "{{ openstack_release }}"
docker_nova_consoleauth_tag: "{{ openstack_release }}" nova_scheduler_image_full: "{{ nova_scheduler_image }}:{{ nova_scheduler_tag }}"
docker_nova_consoleauth_image_full: "{{ docker_nova_consoleauth_image }}:{{ docker_nova_consoleauth_tag }}"
kolla_nova_novncproxy_container_name: "nova-novncproxy" nova_compute_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-nova-compute"
docker_nova_novncproxy_image: "{{ docker_nova_registry }}{{ docker_nova_namespace }}/{{ kolla_nova_base_distro }}-{{ kolla_nova_install_type }}-{{ kolla_nova_novncproxy_container_name }}" nova_compute_tag: "{{ openstack_release }}"
docker_nova_novncproxy_tag: "{{ openstack_release }}" nova_compute_image_full: "{{ nova_compute_image }}:{{ nova_compute_tag }}"
docker_nova_novncproxy_image_full: "{{ docker_nova_novncproxy_image }}:{{ docker_nova_novncproxy_tag }}"
kolla_nova_scheduler_container_name: "nova-scheduler" nova_api_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-nova-api"
docker_nova_scheduler_image: "{{ docker_nova_registry }}{{ docker_nova_namespace }}/{{ kolla_nova_base_distro }}-{{ kolla_nova_install_type }}-{{ kolla_nova_scheduler_container_name }}" nova_api_tag: "{{ openstack_release }}"
docker_nova_scheduler_tag: "{{ openstack_release }}" nova_api_image_full: "{{ nova_api_image }}:{{ nova_api_tag }}"
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 }}"
#################### ####################

View File

@ -1,20 +1,61 @@
--- ---
- include: ../../start.yml - name: Creating Nova database
vars: command: docker exec -t kolla_ansible /usr/bin/ansible localhost
container_command: "/bin/sleep infinity" -m mysql_db
container_image: "{{ docker_nova_api_image_full }}" -a "login_host='{{ database_address }}'
container_name: "nova_data" login_user='{{ database_user }}'
container_volumes: login_password='{{ database_password }}'
- "/var/lib/nova/" 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 - name: Creating Nova database user and setting permissions
vars: command: docker exec -t kolla_ansible /usr/bin/ansible localhost
container_detach: False -m mysql_user
container_environment: -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_BOOTSTRAP:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
container_image: "{{ docker_nova_api_image_full }}" run_once: True
container_name: "bootstrap_nova" when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed
container_restart_policy: "no"
container_volumes: # https://github.com/ansible/ansible-modules-core/pull/1031
- "{{ node_config_directory }}/nova-api/:/opt/kolla/nova-api/:ro" - 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 - name: Starting Nova-libvirt container
vars: docker:
container_environment: docker_api_version: "{{ docker_api_version }}"
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" net: host
container_image: "{{ docker_nova_libvirt_image_full }}" pull: "{{ docker_pull_policy }}"
container_name: "nova_libvirt" restart_policy: "{{ docker_restart_policy }}"
container_privileged: "True" restart_policy_retry: "{{ docker_restart_policy_retry }}"
container_pid: "True" state: reloaded
container_volumes: 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" - "/run:/run"
- "/lib/modules:/lib/modules:ro"
- "/var/lib/nova/instances" - "/var/lib/nova/instances"
env:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
when: inventory_hostname in groups['compute'] when: inventory_hostname in groups['compute']
- include: ../../start.yml - name: Starting Nova-api container
vars: docker:
container_environment: docker_api_version: "{{ docker_api_version }}"
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" net: host
container_image: "{{ docker_nova_api_image_full }}" pull: "{{ docker_pull_policy }}"
container_name: "nova_api" restart_policy: "{{ docker_restart_policy }}"
container_privileged: "True" restart_policy_retry: "{{ docker_restart_policy_retry }}"
container_volumes: 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" - "{{ node_config_directory }}/nova-api/:/opt/kolla/nova-api/:ro"
- "/lib/modules:/lib/modules:ro" - "/lib/modules:/lib/modules:ro"
env:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
when: inventory_hostname in groups['nova-api'] when: inventory_hostname in groups['nova-api']
- include: ../../start.yml - name: Starting Nova-conductor container
vars: docker:
container_environment: 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 }}" 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'] when: inventory_hostname in groups['nova-conductor']
- include: ../../start.yml - name: Starting Nova-consoleauth container
vars: docker:
container_environment: 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 }}" 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'] when: inventory_hostname in groups['nova-consoleauth']
- include: ../../start.yml - name: Starting Nova-novncproxy container
vars: docker:
container_environment: 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 }}" 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'] when: inventory_hostname in groups['nova-novncproxy']
- include: ../../start.yml - name: Starting Nova-scheduler container
vars: docker:
container_environment: 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 }}" 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'] when: inventory_hostname in groups['nova-scheduler']
- include: ../../start.yml - name: Starting Nova-compute container
vars: docker:
container_environment: docker_api_version: "{{ docker_api_version }}"
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" net: host
container_image: "{{ docker_nova_compute_image_full }}" pull: "{{ docker_pull_policy }}"
container_name: "nova_compute" restart_policy: "{{ docker_restart_policy }}"
container_privileged: "True" restart_policy_retry: "{{ docker_restart_policy_retry }}"
container_volumes: 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" - "{{ node_config_directory }}/nova-compute/:/opt/kolla/nova-compute/:ro"
- "/run:/run"
- "/lib/modules:/lib/modules:ro" - "/lib/modules:/lib/modules:ro"
container_volumes_from: - "/run:/run"
- "nova_libvirt" volumes_from:
- nova_libvirt
env:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
when: inventory_hostname in groups['compute'] when: inventory_hostname in groups['compute']