Merge pull request #804 from dang/docker-dev

Allow running on local dev docker images
pull/846/head
Leseb 2016-06-06 11:12:43 +02:00
commit 58f9a6cfe0
12 changed files with 56 additions and 22 deletions

View File

@ -1,6 +1,11 @@
---
dummy:
##########
# GLOBAL #
##########
#ceph_docker_dev_image: false
#######
# MON #
#######

View File

@ -0,0 +1,27 @@
---
# Normal case - pull image from registry
- name: pull ceph daemon image
command: "docker pull {{ ceph_docker_username }}/{{ ceph_docker_imagename }}"
changed_when: false
failed_when: false
when: ceph_docker_dev_image is undefined or not ceph_docker_dev_image
# Dev case - export local dev image and send it across
- name: export local ceph dev image
local_action: command docker save -o "/tmp/{{ ceph_docker_username }}-{{ ceph_docker_imagename }}.tar" "{{ ceph_docker_username }}/{{ ceph_docker_imagename }}"
when: ceph_docker_dev_image is defined and ceph_docker_dev_image
run_once: true
- name: copy ceph dev image file
copy:
src: "/tmp/{{ ceph_docker_username }}-{{ ceph_docker_imagename }}.tar"
dest: "/tmp/{{ ceph_docker_username }}-{{ ceph_docker_imagename }}.tar"
when: ceph_docker_dev_image is defined and ceph_docker_dev_image
- name: load ceph dev image
command: "docker load -i /tmp/{{ ceph_docker_username }}-{{ ceph_docker_imagename }}.tar"
when: ceph_docker_dev_image is defined and ceph_docker_dev_image
- name: remove tmp ceph dev image file
command: "rm /tmp/{{ ceph_docker_username }}-{{ ceph_docker_imagename }}.tar"
when: ceph_docker_dev_image is defined and ceph_docker_dev_image

View File

@ -1,9 +1,4 @@
---
- name: pull ceph daemon image
shell: "docker pull {{ ceph_mds_docker_username }}/{{ ceph_mds_docker_imagename }}"
changed_when: false
failed_when: false
# NOTE (leseb): we can not use docker inspect with 'format filed' because of
# https://github.com/ansible/ansible/issues/10156
- name: inspect ceph version

View File

@ -9,6 +9,10 @@
when: ceph_health.rc != 0
- include: pre_requisite.yml
- include: "{{ playbook_dir }}/roles/ceph-common/tasks/docker/fetch_image.yml"
vars:
ceph_docker_username: '{{ ceph_mds_docker_username}}'
ceph_docker_imagename: '{{ ceph_mds_docker_imagename}}'
- include: dirs_permissions.yml
- include: fetch_configs.yml

View File

@ -1,9 +1,4 @@
---
- name: pull ceph daemon image
shell: "docker pull {{ ceph_mon_docker_username }}/{{ ceph_mon_docker_imagename }}"
changed_when: false
failed_when: false
# NOTE (leseb): we can not use docker inspect with 'format filed' because of
# https://github.com/ansible/ansible/issues/10156
- name: inspect ceph version

View File

@ -1,6 +1,6 @@
---
- name: check if a cluster is already running
shell: "docker ps | grep -sq 'ceph/daemon'"
shell: "docker ps | grep -sq '{{ceph_mon_docker_username}}/{{ceph_mon_docker_imagename}}'"
register: ceph_health
changed_when: false
failed_when: false
@ -20,6 +20,11 @@
- include: pre_requisite.yml
- include: "{{ playbook_dir }}/roles/ceph-common/tasks/docker/fetch_image.yml"
vars:
ceph_docker_username: '{{ ceph_mon_docker_username}}'
ceph_docker_imagename: '{{ ceph_mon_docker_imagename}}'
- include: dirs_permissions.yml
# let the first mon create configs and keyrings

View File

@ -90,7 +90,7 @@
net: "host"
state: "running"
privileged: "{{ mon_docker_privileged }}"
env: "MON_IP={{ hostvars[inventory_hostname]['ansible_' + ceph_mon_docker_interface]['ipv4']['address'] }},CEPH_DAEMON=MON,CEPH_PUBLIC_NETWORK={{ ceph_mon_docker_subnet }},{{ ceph_mon_extra_envs }}"
env: "MON_IP={{ hostvars[inventory_hostname]['ansible_' + ceph_mon_docker_interface]['ipv4']['address'] }},CEPH_DAEMON=MON,CEPH_PUBLIC_NETWORK={{ ceph_mon_docker_subnet }},CEPH_FSID={{ fsid }},{{ ceph_mon_extra_envs }}"
volumes: "/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph"
when:
- not is_atomic

View File

@ -1,9 +1,4 @@
---
- name: pull ceph daemon image
shell: "docker pull {{ ceph_osd_docker_username }}/{{ ceph_osd_docker_imagename }}"
changed_when: false
failed_when: false
# NOTE (leseb): we can not use docker inspect with 'format filed' because of
# https://github.com/ansible/ansible/issues/10156
- name: inspect ceph version

View File

@ -20,6 +20,11 @@
- include: pre_requisite.yml
- include: "{{ playbook_dir }}/roles/ceph-common/tasks/docker/fetch_image.yml"
vars:
ceph_docker_username: '{{ ceph_osd_docker_username}}'
ceph_docker_imagename: '{{ ceph_osd_docker_imagename}}'
# NOTE (jimcurtis): dirs_permissions.yml must precede fetch_configs.yml
# because it creates the directories needed by the latter.
- include: dirs_permissions.yml

View File

@ -1,5 +1,9 @@
---
- include: pre_requisite.yml
- include: "{{ playbook_dir }}/roles/ceph-common/tasks/docker/fetch_image.yml"
vars:
ceph_docker_username: '{{ ceph_restapi_docker_username}}'
ceph_docker_imagename: '{{ ceph_restapi_docker_imagename}}'
- include: dirs_permissions.yml
- include: fetch_configs.yml
- include: start_docker_restapi.yml

View File

@ -1,9 +1,4 @@
---
- name: pull ceph daemon image
shell: "docker pull {{ ceph_rgw_docker_username }}/{{ ceph_rgw_docker_imagename }}"
changed_when: false
failed_when: false
# NOTE (leseb): we can not use docker inspect with 'format filed' because of
# https://github.com/ansible/ansible/issues/10156
- name: inspect ceph version

View File

@ -17,6 +17,10 @@
when: ceph_health.rc != 0
- include: pre_requisite.yml
- include: "{{ playbook_dir }}/roles/ceph-common/tasks/docker/fetch_image.yml"
vars:
ceph_docker_username: '{{ ceph_rgw_docker_username}}'
ceph_docker_imagename: '{{ ceph_rgw_docker_imagename}}'
- include: dirs_permissions.yml
# NOTE (jimcurtis): dirs_permissions.yml must precede fetch_configs.yml
# because it creates the directories needed by the latter.