containerized mon

pull/648/head
Huamin Chen 2016-01-13 19:15:35 +00:00 committed by Sébastien Han
parent c691638c3e
commit 0647cad7be
7 changed files with 107 additions and 7 deletions

View File

@ -337,4 +337,3 @@ dummy:
##########
#docker: false

View File

@ -3,7 +3,6 @@
set_fact:
ceph_config_keys:
- /etc/ceph/ceph.client.admin.keyring
- /etc/ceph/ceph.conf
- /etc/ceph/monmap
- /etc/ceph/ceph.mon.keyring
- /var/lib/ceph/bootstrap-osd/ceph.keyring
@ -20,7 +19,7 @@
- name: try to fetch ceph config and keys
copy:
src: "{{ fetch_directory }}/docker_mon_files/{{ item.0 }}"
src: "{{ playbook_dir }}/{{ fetch_directory }}/{{ fsid }}/{{ item.0 }}"
dest: "{{ item.0 }}"
owner: root
group: root

View File

@ -19,6 +19,8 @@
- docker
- docker.io
when: ansible_distribution == 'Ubuntu'
tags:
with_pkg
- name: install pip and docker on debian
apt:
@ -29,6 +31,8 @@
- python-pip
- docker-engine
when: ansible_distribution == 'Debian'
tags:
with_pkg
- name: install pip and docker on redhat
yum:
@ -40,6 +44,8 @@
when:
ansible_os_family == 'RedHat' and
ansible_pkg_mgr == "yum"
tags:
with_pkg
- name: install pip and docker on redhat
dnf:
@ -51,9 +57,44 @@
when:
ansible_os_family == 'RedHat' and
ansible_pkg_mgr == "dnf"
tags:
with_pkg
- name: install epel-release on redhat
yum:
name: epel-release
state: present
when: ansible_os_family == 'RedHat'
tags:
with_pkg
# NOTE (jimcurtis): need at least version 1.9.0 of six or we get:
# re:NameError: global name 'DEFAULT_DOCKER_API_VERSION' is not defined
- name: install six
pip:
name: six
version: 1.9.0
tags:
with_pkg
- name: pause after docker install before starting (on openstack vms)
pause: seconds=5
when: ceph_docker_on_openstack
tags:
with_pkg
- name: start docker service
service:
name: docker
state: started
enabled: yes
tags:
with_pkg
# NOTE (leseb): for version 1.1.0 because https://github.com/ansible/ansible-modules-core/issues/1227
- name: install docker-py
pip:
name: docker-py
version: 1.1.0
tags:
with_pkg

View File

@ -1,4 +1,7 @@
---
- name: pull ceph daemon image
shell: "docker pull {{ ceph_mon_docker_username }}/{{ ceph_mon_docker_imagename }}"
- name: run the ceph Monitor docker image
docker:
image: "{{ ceph_mon_docker_username }}/{{ ceph_mon_docker_imagename }}"
@ -7,3 +10,10 @@
state: "running"
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 }}"
volumes: "/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph"
- name: fetch ceph.conf from mon
fetch:
dest: "{{ playbook_dir }}/{{ fetch_directory }}/{{ fsid}}/etc/ceph/ceph.conf"
src: /etc/ceph/ceph.conf
flat: yes

View File

@ -5,6 +5,14 @@
- /etc/ceph/ceph.conf
- /var/lib/ceph/bootstrap-osd/ceph.keyring
- name: wait for ceph.conf and keys
local_action: >
wait_for
path="{{ playbook_dir }}/{{ fetch_directory }}/docker_mon_files/{{ item.0 }}"
become: false
with_together:
- ceph_config_keys
- name: stat for ceph config and keys
local_action: stat path={{ fetch_directory }}/docker_mon_files/{{ item }}
with_items: ceph_config_keys
@ -13,9 +21,9 @@
failed_when: false
register: statconfig
- name: try to fetch ceph config and keys
- name: try to copy ceph config and keys
copy:
src: "{{ fetch_directory }}/docker_mon_files/{{ item.0 }}"
src: "{{ playbook_dir }}/{{ fetch_directory }}/docker_mon_files/{{ item.0 }}"
dest: "{{ item.0 }}"
owner: root
group: root
@ -23,5 +31,3 @@
changed_when: false
with_together:
- ceph_config_keys
- statconfig.results
when: item.1.stat.exists == true

View File

@ -17,6 +17,8 @@
- docker
- docker.io
when: ansible_distribution == 'Ubuntu'
tags:
with_pkg
- name: install pip and docker on debian
apt:
@ -27,6 +29,8 @@
- python-pip
- docker-engine
when: ansible_distribution == 'Debian'
tags:
with_pkg
- name: install pip and docker on redhat
yum:
@ -38,6 +42,8 @@
when:
ansible_os_family == 'RedHat' and
ansible_pkg_mgr == "yum"
tags:
with_pkg
- name: install pip and docker on redhat
dnf:
@ -49,9 +55,44 @@
when:
ansible_os_family == 'RedHat' and
ansible_pkg_mgr == "dnf"
tags:
with_pkg
- name: install epel-release on redhat
yum:
name: epel-release
state: present
when: ansible_os_family == 'RedHat'
tags:
with_pkg
# NOTE (jimcurtis): need at least version 1.9.0 of six or we get:
# re:NameError: global name 'DEFAULT_DOCKER_API_VERSION' is not defined
- name: install six
pip:
name: six
version: 1.9.0
tags:
with_pkg
- name: pause after docker install before starting (on openstack vms)
pause: seconds=5
when: ceph_docker_on_openstack
tags:
with_pkg
- name: start docker service
service:
name: docker
state: started
enabled: yes
tags:
with_pkg
# NOTE (leseb): for version 1.1.0 because https://github.com/ansible/ansible-modules-core/issues/1227
- name: install docker-py
pip:
name: docker-py
version: 1.1.0
tags:
with_pkg

View File

@ -1,4 +1,8 @@
---
# (rootfs) for reasons I haven't figured out, docker pull and run will fail.
- name: pull ceph daemon image
shell: "docker pull {{ ceph_mon_docker_username }}/{{ ceph_mon_docker_imagename }}"
- name: run the ceph osd docker image
docker:
image: "{{ ceph_osd_docker_username }}/{{ ceph_osd_docker_imagename }}"