From b018c1c23f6c7b5f06c1b88f0620900dc973e717 Mon Sep 17 00:00:00 2001 From: SamYaple Date: Sat, 26 Dec 2015 01:58:57 +0000 Subject: [PATCH] Convert Ceph to kolla_docker Change-Id: Icb1e81dc8acabe51740edc5658957022ddd13cd7 Partially-Implements: blueprint kolla-docker-module --- ansible/roles/ceph/tasks/bootstrap_mons.yml | 18 ++-- ansible/roles/ceph/tasks/bootstrap_osds.yml | 84 +++++-------------- ansible/roles/ceph/tasks/generate_cluster.yml | 28 +++---- ansible/roles/ceph/tasks/start_mons.yml | 21 ++--- ansible/roles/ceph/tasks/start_osds.yml | 34 +++----- ansible/roles/ceph/tasks/start_rgws.yml | 18 +--- 6 files changed, 58 insertions(+), 145 deletions(-) diff --git a/ansible/roles/ceph/tasks/bootstrap_mons.yml b/ansible/roles/ceph/tasks/bootstrap_mons.yml index 5e0ff61fe8..b702ae945f 100644 --- a/ansible/roles/ceph/tasks/bootstrap_mons.yml +++ b/ansible/roles/ceph/tasks/bootstrap_mons.yml @@ -35,20 +35,12 @@ always_run: True run_once: True -- name: Starting Ceph Monitor 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: ceph_mon_data +- name: Starting ceph-mon-data container + kolla_docker: + action: "start_container" + common_options: "{{ docker_common_options }}" image: "{{ ceph_data_image_full }}" + name: "ceph_mon_data" volumes: - "/etc/ceph/" - "/var/lib/ceph/" diff --git a/ansible/roles/ceph/tasks/bootstrap_osds.yml b/ansible/roles/ceph/tasks/bootstrap_osds.yml index 8a0158d7de..20b5bdaacd 100644 --- a/ansible/roles/ceph/tasks/bootstrap_osds.yml +++ b/ansible/roles/ceph/tasks/bootstrap_osds.yml @@ -24,82 +24,40 @@ osds_cache_bootstrap: "{{ (osd_cache_lookup.stdout.split('localhost | SUCCESS => ')[1]|from_json).disks|from_json }}" - name: Bootstrapping Ceph OSDs - docker: - tty: True - 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 }}" - privileged: True - name: "bootstrap_osd_{{ item.0 }}" - image: "{{ ceph_osd_image_full }}" - volumes: - - "{{ node_config_directory }}/ceph-osd/:{{ container_config_directory }}/:ro" - - "/dev/:/dev/" - env: + kolla_docker: + action: "start_container" + common_options: "{{ docker_common_options }}" + detach: False + environment: KOLLA_BOOTSTRAP: KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" OSD_DEV: "{{ item.1.device }}" OSD_INITIAL_WEIGHT: "{{ osd_initial_weight }}" - with_indexed_items: osds_bootstrap|default([]) - -# https://github.com/ansible/ansible-modules-core/pull/1031 -- name: Waiting for bootstrap containers to exit - command: docker wait "bootstrap_osd_{{ item.0 }}" - register: bootstrap_result - run_once: True - failed_when: bootstrap_result.stdout != "0" - with_indexed_items: osds_bootstrap|default([]) - -- name: Cleaning up bootstrap containers - docker: - tty: True + image: "{{ ceph_osd_image_full }}" name: "bootstrap_osd_{{ item.0 }}" - image: "{{ ceph_osd_image_full }}" - state: absent - with_indexed_items: osds_bootstrap|default([]) - -- name: Bootstrapping Ceph Cache OSDs - docker: - tty: True - 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 }}" privileged: True - name: "bootstrap_osd_cache_{{ item.0 }}" - image: "{{ ceph_osd_image_full }}" + restart_policy: "never" volumes: - "{{ node_config_directory }}/ceph-osd/:{{ container_config_directory }}/:ro" - "/dev/:/dev/" - env: + with_indexed_items: osds_bootstrap|default([]) + +- name: Bootstrapping Ceph Cache OSDs + kolla_docker: + action: "start_container" + common_options: "{{ docker_common_options }}" + detach: False + environment: KOLLA_BOOTSTRAP: KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" CEPH_CACHE: OSD_DEV: "{{ item.1.device }}" OSD_INITIAL_WEIGHT: "{{ osd_initial_weight }}" - with_indexed_items: osds_cache_bootstrap|default([]) - -# https://github.com/ansible/ansible-modules-core/pull/1031 -- name: Waiting for bootstrap containers to exit - command: docker wait "bootstrap_osd_cache_{{ item.0 }}" - register: bootstrap_result - run_once: True - failed_when: bootstrap_result.stdout != "0" - with_indexed_items: osds_cache_bootstrap|default([]) - -- name: Cleaning up bootstrap containers - docker: - tty: True - name: "bootstrap_osd_cache_{{ item.0 }}" image: "{{ ceph_osd_image_full }}" - state: absent + name: "bootstrap_osd_cache_{{ item.0 }}" + privileged: True + restart_policy: "never" + volumes: + - "{{ node_config_directory }}/ceph-osd/:{{ container_config_directory }}/:ro" + - "/dev/:/dev/" with_indexed_items: osds_cache_bootstrap|default([]) diff --git a/ansible/roles/ceph/tasks/generate_cluster.yml b/ansible/roles/ceph/tasks/generate_cluster.yml index 7788935414..f53a709731 100644 --- a/ansible/roles/ceph/tasks/generate_cluster.yml +++ b/ansible/roles/ceph/tasks/generate_cluster.yml @@ -1,25 +1,17 @@ --- -- name: Generating Initial Ceph keyrings and monmap - docker: - tty: True - detach: False - 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: ceph_mon - image: "{{ ceph_mon_image_full }}" - volumes: "{{ node_config_directory }}/ceph-mon/:{{ container_config_directory }}/:ro" - volumes_from: - - "ceph_mon_data" - env: +- name: Generating initial Ceph keyrings and monmap + kolla_docker: + action: "start_container" + common_options: "{{ docker_common_options }}" + environment: KOLLA_BOOTSTRAP: KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" MON_IP: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" + image: "{{ ceph_mon_image_full }}" + name: "ceph_mon" + restart_policy: "never" + volumes: "{{ node_config_directory }}/ceph-mon/:{{ container_config_directory }}/:ro" + volumes_from: "ceph_mon_data" - name: Waiting for a few settings for cluster to generate keys command: sleep 3 diff --git a/ansible/roles/ceph/tasks/start_mons.yml b/ansible/roles/ceph/tasks/start_mons.yml index a9288ca873..9016e2ce65 100644 --- a/ansible/roles/ceph/tasks/start_mons.yml +++ b/ansible/roles/ceph/tasks/start_mons.yml @@ -1,21 +1,10 @@ --- - name: Starting ceph-mon 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: ceph_mon + kolla_docker: + action: "start_container" + common_options: "{{ docker_common_options }}" image: "{{ ceph_mon_image_full }}" + name: "ceph_mon" volumes: "{{ node_config_directory }}/ceph-mon/:{{ container_config_directory }}/:ro" - volumes_from: - - "ceph_mon_data" - env: - KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" + volumes_from: "ceph_mon_data" when: inventory_hostname in groups['ceph-mon'] diff --git a/ansible/roles/ceph/tasks/start_osds.yml b/ansible/roles/ceph/tasks/start_osds.yml index ab7bd35ddd..e91e90ea14 100644 --- a/ansible/roles/ceph/tasks/start_osds.yml +++ b/ansible/roles/ceph/tasks/start_osds.yml @@ -26,30 +26,22 @@ changed_when: False failed_when: id.rc != 0 -- name: Starting ceph-osds 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 }}" - pid: host - privileged: True - name: "ceph_osd_{{ item.0.stdout }}" - image: "{{ ceph_osd_image_full }}" - volumes: - - "/var/lib/ceph/osd/{{ item.1['fs_uuid'] }}:/var/lib/ceph/osd/ceph-{{ item.0.stdout }}" - - "{{ node_config_directory }}/ceph-osd/:{{ container_config_directory }}/:ro" - - "/dev/:/dev/" - env: +- name: Starting ceph-osd container + kolla_docker: + action: "start_container" + common_options: "{{ docker_common_options }}" + environment: KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" OSD_ID: "{{ item.0.stdout }}" OSD_DEV: "{{ item.1['device'] }}" + image: "{{ ceph_osd_image_full }}" + name: "ceph_osd_{{ item.0.stdout }}" + pid: "host" + privileged: True + volumes: + - "{{ node_config_directory }}/ceph-osd/:{{ container_config_directory }}/:ro" + - "/dev/:/dev/" + - "/var/lib/ceph/osd/{{ item.1['fs_uuid'] }}:/var/lib/ceph/osd/ceph-{{ item.0.stdout }}" with_together: - id.results - osds diff --git a/ansible/roles/ceph/tasks/start_rgws.yml b/ansible/roles/ceph/tasks/start_rgws.yml index 68d5516ba0..4de1e8afdc 100644 --- a/ansible/roles/ceph/tasks/start_rgws.yml +++ b/ansible/roles/ceph/tasks/start_rgws.yml @@ -1,19 +1,9 @@ --- - name: Starting ceph-rgw 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: ceph_rgw + kolla_docker: + action: "start_container" + common_options: "{{ docker_common_options }}" image: "{{ ceph_rgw_image_full }}" + name: "ceph_rgw" volumes: "{{ node_config_directory }}/ceph-rgw/:{{ container_config_directory }}/:ro" - env: - KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" when: inventory_hostname in groups['ceph-rgw']