2015-01-21 01:43:47 +08:00
|
|
|
---
|
2015-06-24 21:51:54 +08:00
|
|
|
- name: set config and keys paths
|
|
|
|
set_fact:
|
|
|
|
ceph_config_keys:
|
|
|
|
- /etc/ceph/ceph.client.admin.keyring
|
|
|
|
- /etc/ceph/ceph.conf
|
|
|
|
- /etc/ceph/monmap
|
|
|
|
- /etc/ceph/ceph.mon.keyring
|
|
|
|
|
|
|
|
- name: install docker-py
|
2015-06-26 06:26:03 +08:00
|
|
|
pip: >
|
|
|
|
name=docker-py
|
|
|
|
version=1.1.0 # https://github.com/ansible/ansible-modules-core/issues/1227
|
2015-06-24 21:51:54 +08:00
|
|
|
|
|
|
|
- name: stat for Ceph config and keys
|
|
|
|
stat: >
|
|
|
|
path={{ item }}
|
|
|
|
with_items: ceph_config_keys
|
2015-06-26 06:26:03 +08:00
|
|
|
ignore_errors: true
|
2015-06-24 21:51:54 +08:00
|
|
|
register: statconfig
|
|
|
|
|
2015-05-16 00:27:41 +08:00
|
|
|
- name: try to fetch Ceph config and keys
|
2015-01-21 01:43:47 +08:00
|
|
|
copy: >
|
2015-06-24 21:51:54 +08:00
|
|
|
src=fetch/docker_mon_files/"{{ item }}"
|
2015-01-21 01:43:47 +08:00
|
|
|
dest=/etc/ceph/
|
|
|
|
owner=root
|
|
|
|
group=root
|
|
|
|
mode=600
|
2015-06-24 21:51:54 +08:00
|
|
|
with_together:
|
|
|
|
- ceph_config_keys
|
|
|
|
- statconfig.results
|
|
|
|
when: item.1.stat.exists == False
|
2015-01-21 01:43:47 +08:00
|
|
|
|
2015-05-16 00:27:41 +08:00
|
|
|
- name: run the Ceph Monitor docker image
|
2015-01-21 01:43:47 +08:00
|
|
|
docker: >
|
|
|
|
image="{{ ceph_mon_docker_username }}/{{ ceph_mon_docker_imagename }}"
|
|
|
|
name=ceph-{{ ansible_hostname }}
|
|
|
|
net=host
|
|
|
|
state=running
|
2015-06-24 21:51:54 +08:00
|
|
|
env="MON_NAME=ceph-{{ ansible_hostname }},MON_IP={{ hostvars[inventory_hostname]['ansible_' + ceph_mon_docker_interface]['ipv4']['address'] }},CEPH_DAEMON=MON, CEPH_PUBLIC_NETWORK={{ ceph_mon_docker_subnet }}"
|
2015-01-21 01:43:47 +08:00
|
|
|
volumes="/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph"
|
|
|
|
|
2015-05-16 00:27:41 +08:00
|
|
|
- name: ensure ceph_mon service is running
|
2015-01-21 01:43:47 +08:00
|
|
|
docker: >
|
|
|
|
image="{{ ceph_mon_docker_username }}/{{ ceph_mon_docker_imagename }}"
|
|
|
|
name="ceph-{{ ansible_hostname }}"
|
|
|
|
ports=6789:6789
|
|
|
|
detach=yes
|
|
|
|
state=running
|
|
|
|
|
2015-05-16 00:27:41 +08:00
|
|
|
- name: collect Ceph files to the Ansible server
|
2015-01-21 01:43:47 +08:00
|
|
|
fetch: >
|
|
|
|
src={{ item }}
|
|
|
|
dest=fetch/docker_mon_files/{{ item }}
|
|
|
|
flat=yes
|
|
|
|
with_items:
|
|
|
|
- /etc/ceph/ceph.client.admin.keyring
|
|
|
|
- /etc/ceph/ceph.conf
|
|
|
|
- /etc/ceph/monmap
|
|
|
|
- /etc/ceph/ceph.mon.keyring
|
2015-06-24 21:51:54 +08:00
|
|
|
- /var/lib/ceph/bootstrap-osd/ceph.keyring
|
|
|
|
- /var/lib/ceph/bootstrap-rgw/ceph.keyring
|
|
|
|
- /var/lib/ceph/bootstrap-mds/ceph.keyring
|