mirror of https://github.com/ceph/ceph-ansible.git
Fix multi-mon docker deployment
We can now deploy 3 mons on 3 different hosts. Signed-off-by: Sébastien Han <seb@redhat.com>pull/346/head
parent
1b4165d2bb
commit
69ae08b8d7
|
@ -6,59 +6,60 @@
|
||||||
- /etc/ceph/ceph.conf
|
- /etc/ceph/ceph.conf
|
||||||
- /etc/ceph/monmap
|
- /etc/ceph/monmap
|
||||||
- /etc/ceph/ceph.mon.keyring
|
- /etc/ceph/ceph.mon.keyring
|
||||||
|
- /var/lib/ceph/bootstrap-osd/ceph.keyring
|
||||||
|
- /var/lib/ceph/bootstrap-rgw/ceph.keyring
|
||||||
|
- /var/lib/ceph/bootstrap-mds/ceph.keyring
|
||||||
|
|
||||||
# NOTE (leseb): force version 1.1.0 because https://github.com/ansible/ansible-modules-core/issues/1227
|
- name: create bootstrap directories
|
||||||
|
file: >
|
||||||
|
path=/var/lib/ceph/bootstrap-{{ item }}
|
||||||
|
state=directory
|
||||||
|
with_items:
|
||||||
|
- osd
|
||||||
|
- mds
|
||||||
|
- rgw
|
||||||
|
|
||||||
|
# NOTE (leseb): for version 1.1.0 because https://github.com/ansible/ansible-modules-core/issues/1227
|
||||||
- name: install docker-py
|
- name: install docker-py
|
||||||
pip: >
|
pip: >
|
||||||
name=docker-py
|
name=docker-py
|
||||||
version=1.1.0
|
version=1.1.0
|
||||||
|
|
||||||
- name: stat for ceph config and keys
|
- name: stat for ceph config and keys
|
||||||
stat: >
|
local_action: stat path={{ item }}
|
||||||
path={{ item }}
|
|
||||||
with_items: ceph_config_keys
|
with_items: ceph_config_keys
|
||||||
|
changed_when: false
|
||||||
|
sudo: false
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: statconfig
|
register: statconfig
|
||||||
|
|
||||||
- name: try to fetch ceph config and keys
|
- name: try to fetch ceph config and keys
|
||||||
copy: >
|
copy: >
|
||||||
src=fetch/docker_mon_files/"{{ item }}"
|
src=fetch/docker_mon_files/{{ item.0 }}
|
||||||
dest=/etc/ceph/
|
dest={{ item.0 }}
|
||||||
owner=root
|
owner=root
|
||||||
group=root
|
group=root
|
||||||
mode=600
|
mode=644
|
||||||
with_together:
|
with_together:
|
||||||
- ceph_config_keys
|
- ceph_config_keys
|
||||||
- statconfig.results
|
- statconfig.results
|
||||||
when: item.1.stat.exists == true
|
when: item.1.stat.exists == true
|
||||||
|
|
||||||
- name: run the ceph Monitor docker image
|
- name: run the ceph monitor docker image
|
||||||
docker: >
|
docker: >
|
||||||
image="{{ ceph_mon_docker_username }}/{{ ceph_mon_docker_imagename }}"
|
image="{{ ceph_mon_docker_username }}/{{ ceph_mon_docker_imagename }}"
|
||||||
name=ceph-{{ ansible_hostname }}
|
name="{{ ansible_hostname }}"
|
||||||
net=host
|
net="host"
|
||||||
state=running
|
state="running"
|
||||||
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 }}"
|
env="MON_IP={{ hostvars[inventory_hostname]['ansible_' + ceph_mon_docker_interface]['ipv4']['address'] }},CEPH_DAEMON=MON,CEPH_PUBLIC_NETWORK={{ ceph_mon_docker_subnet }}"
|
||||||
volumes="/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph"
|
volumes="/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph"
|
||||||
|
|
||||||
- name: ensure ceph_mon service is running
|
- name: push ceph files to the ansible server
|
||||||
docker: >
|
|
||||||
image="{{ ceph_mon_docker_username }}/{{ ceph_mon_docker_imagename }}"
|
|
||||||
name="ceph-{{ ansible_hostname }}"
|
|
||||||
ports=6789:6789
|
|
||||||
detach=yes
|
|
||||||
state=running
|
|
||||||
|
|
||||||
- name: collect ceph files to the ansible server
|
|
||||||
fetch: >
|
fetch: >
|
||||||
src={{ item }}
|
src={{ item.0 }}
|
||||||
dest=fetch/docker_mon_files/{{ item }}
|
dest=fetch/docker_mon_files/{{ item.0 }}
|
||||||
flat=yes
|
flat=yes
|
||||||
with_items:
|
with_together:
|
||||||
- /etc/ceph/ceph.client.admin.keyring
|
- ceph_config_keys
|
||||||
- /etc/ceph/ceph.conf
|
- statconfig.results
|
||||||
- /etc/ceph/monmap
|
when: item.1.stat.exists == false
|
||||||
- /etc/ceph/ceph.mon.keyring
|
|
||||||
- /var/lib/ceph/bootstrap-osd/ceph.keyring
|
|
||||||
- /var/lib/ceph/bootstrap-rgw/ceph.keyring
|
|
||||||
- /var/lib/ceph/bootstrap-mds/ceph.keyring
|
|
||||||
|
|
Loading…
Reference in New Issue