From 63c2f5631756e7defb97d251db731433150ebc60 Mon Sep 17 00:00:00 2001 From: SamYaple Date: Fri, 25 Dec 2015 22:39:07 +0000 Subject: [PATCH] Convert mariadb to kolla_docker Change-Id: I804665386d5fb806449d2cfac981bc8e08109e0e Partially-Implements: blueprint kolla-docker-module --- ansible/roles/mariadb/tasks/bootstrap.yml | 44 ++++++++--------------- ansible/roles/mariadb/tasks/start.yml | 23 ++++-------- 2 files changed, 20 insertions(+), 47 deletions(-) diff --git a/ansible/roles/mariadb/tasks/bootstrap.yml b/ansible/roles/mariadb/tasks/bootstrap.yml index 625df10a08..469aadce8d 100644 --- a/ansible/roles/mariadb/tasks/bootstrap.yml +++ b/ansible/roles/mariadb/tasks/bootstrap.yml @@ -36,43 +36,27 @@ always_run: True run_once: True -- name: Starting MariaDB data container - docker: - tty: True - 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: mariadb_data +- name: Starting mariadb-data container + kolla_docker: + action: "start_container" + common_options: "{{ docker_common_options }}" image: "{{ mariadb_data_image_full }}" + name: "mariadb_data" volumes: "/var/lib/mysql/" - name: Starting MariaDB bootstrap container - docker: - tty: True - net: host - pull: "{{ docker_pull_policy }}" - restart_policy: "no" - 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: mariadb - image: "{{ mariadb_image_full }}" - volumes: "{{ node_config_directory }}/mariadb/:{{ container_config_directory }}/:ro" - volumes_from: - - "mariadb_data" - env: + kolla_docker: + action: "start_container" + common_options: "{{ docker_common_options }}" + environment: KOLLA_BOOTSTRAP: KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" DB_ROOT_PASSWORD: "{{ database_password }}" + image: "{{ mariadb_image_full }}" + name: "mariadb" + restart_policy: "never" + volumes: "{{ node_config_directory }}/mariadb/:{{ container_config_directory }}/:ro" + volumes_from: "mariadb_data" when: delegate_host == 'None' and inventory_hostname == groups['mariadb'][0] - name: Sleeping for 15 seconds while the cluster starts diff --git a/ansible/roles/mariadb/tasks/start.yml b/ansible/roles/mariadb/tasks/start.yml index 763f15a9b3..835e2cbf1b 100644 --- a/ansible/roles/mariadb/tasks/start.yml +++ b/ansible/roles/mariadb/tasks/start.yml @@ -1,23 +1,12 @@ --- -- name: Starting MariaDB container - docker: - tty: True - 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: mariadb +- name: Starting mariadb container + kolla_docker: + action: "start_container" + common_options: "{{ docker_common_options }}" image: "{{ mariadb_image_full }}" + name: "mariadb" volumes: "{{ node_config_directory }}/mariadb/:{{ container_config_directory }}/:ro" - volumes_from: - - "mariadb_data" - env: - KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" + volumes_from: "mariadb_data" when: delegate_host != 'None' or ( groups['mariadb'] | length ) == 1 or ( delegate_host == 'None' and inventory_hostname != groups['mariadb'][0] )