2015-07-28 21:44:52 +08:00
|
|
|
---
|
2016-03-21 16:42:46 +08:00
|
|
|
- name: populate kv_store with default ceph.conf
|
|
|
|
docker:
|
|
|
|
name: populate-kv-store
|
|
|
|
image: ceph/daemon
|
|
|
|
command: populate_kvstore
|
|
|
|
net: host
|
|
|
|
env:
|
|
|
|
KV_TYPE: "{{kv_type}}"
|
|
|
|
KV_IP: "{{kv_endpoint}}"
|
|
|
|
KV_PORT: "{{kv_port}}"
|
|
|
|
run_once: true
|
2016-03-22 23:58:20 +08:00
|
|
|
when:
|
2016-05-09 22:08:33 +08:00
|
|
|
- inventory_hostname == groups.mons[0]
|
|
|
|
- mon_containerized_deployment_with_kv
|
|
|
|
- mon_containerized_default_ceph_conf_with_kv
|
2016-03-21 16:42:46 +08:00
|
|
|
|
|
|
|
- name: populate kv_store with custom ceph.conf
|
2016-03-16 00:32:17 +08:00
|
|
|
docker:
|
|
|
|
name: populate-kv-store
|
|
|
|
image: ceph/daemon
|
|
|
|
command: populate_kvstore
|
|
|
|
net: host
|
|
|
|
env:
|
|
|
|
KV_TYPE: "{{kv_type}}"
|
|
|
|
KV_IP: "{{kv_endpoint}}"
|
|
|
|
KV_PORT: "{{kv_port}}"
|
|
|
|
volumes:
|
|
|
|
- /etc/ceph/ceph.conf:/etc/ceph/ceph.defaults
|
|
|
|
run_once: true
|
2016-03-22 23:58:20 +08:00
|
|
|
when:
|
2016-05-09 22:08:33 +08:00
|
|
|
- inventory_hostname == groups.mons[0]
|
|
|
|
- mon_containerized_deployment_with_kv
|
|
|
|
- not mon_containerized_default_ceph_conf_with_kv
|
2016-03-16 00:32:17 +08:00
|
|
|
|
|
|
|
- name: delete populate-kv-store docker
|
|
|
|
docker:
|
|
|
|
name: populate-kv-store
|
|
|
|
state: absent
|
|
|
|
image: ceph/daemon
|
2016-03-31 22:39:02 +08:00
|
|
|
when: mon_containerized_deployment_with_kv
|
2016-03-16 00:32:17 +08:00
|
|
|
|
|
|
|
# Use systemd to manage container on Atomic host and CoreOS
|
2016-01-28 03:50:05 +08:00
|
|
|
- name: generate systemd unit file
|
2016-03-22 23:58:20 +08:00
|
|
|
become: true
|
2016-02-10 03:49:22 +08:00
|
|
|
template:
|
2016-06-02 16:52:23 +08:00
|
|
|
src: "{{ role_path }}/templates/ceph-mon.service.j2"
|
2016-01-28 03:50:05 +08:00
|
|
|
dest: /var/lib/ceph/ceph-mon@.service
|
|
|
|
owner: "root"
|
|
|
|
group: "root"
|
|
|
|
mode: "0644"
|
2016-06-03 23:24:00 +08:00
|
|
|
when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS'
|
2016-03-16 00:32:17 +08:00
|
|
|
|
2016-01-28 03:50:05 +08:00
|
|
|
- name: link systemd unit file for mon instance
|
|
|
|
file:
|
|
|
|
src: /var/lib/ceph/ceph-mon@.service
|
|
|
|
dest: /etc/systemd/system/multi-user.target.wants/ceph-mon@{{ ansible_hostname }}.service
|
|
|
|
state: link
|
2016-06-03 23:24:00 +08:00
|
|
|
when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS'
|
2016-01-28 03:50:05 +08:00
|
|
|
|
|
|
|
- name: enable systemd unit file for mon instance
|
|
|
|
shell: systemctl enable /etc/systemd/system/multi-user.target.wants/ceph-mon@{{ ansible_hostname }}.service
|
|
|
|
failed_when: false
|
|
|
|
changed_when: false
|
2016-06-03 23:24:00 +08:00
|
|
|
when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS'
|
2016-01-28 03:50:05 +08:00
|
|
|
|
|
|
|
- name: reload systemd unit files
|
|
|
|
shell: systemctl daemon-reload
|
2016-04-01 17:18:40 +08:00
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
2016-06-03 23:24:00 +08:00
|
|
|
when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS'
|
2016-01-28 03:50:05 +08:00
|
|
|
|
|
|
|
- name: systemd start mon container
|
|
|
|
service:
|
|
|
|
name: ceph-mon@{{ ansible_hostname }}
|
|
|
|
state: started
|
|
|
|
enabled: yes
|
|
|
|
changed_when: false
|
2016-06-03 23:24:00 +08:00
|
|
|
when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS'
|
2016-01-28 03:50:05 +08:00
|
|
|
|
|
|
|
- name: wait for ceph.conf exists
|
|
|
|
wait_for:
|
|
|
|
path: /etc/ceph/ceph.conf
|
2016-06-03 23:24:00 +08:00
|
|
|
when: ansible_os_family == 'RedHat'
|
2016-01-28 03:50:05 +08:00
|
|
|
|
2016-03-22 23:58:20 +08:00
|
|
|
- name: run the ceph monitor docker image
|
2015-10-17 07:55:31 +08:00
|
|
|
docker:
|
|
|
|
image: "{{ ceph_mon_docker_username }}/{{ ceph_mon_docker_imagename }}"
|
|
|
|
name: "{{ ansible_hostname }}"
|
|
|
|
net: "host"
|
|
|
|
state: "running"
|
2016-01-27 04:01:03 +08:00
|
|
|
privileged: "{{ mon_docker_privileged }}"
|
2016-03-24 21:21:07 +08:00
|
|
|
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 }}"
|
2015-10-17 07:55:31 +08:00
|
|
|
volumes: "/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph"
|
2016-03-22 23:58:20 +08:00
|
|
|
when:
|
2016-06-03 23:24:00 +08:00
|
|
|
- ansible_os_family != 'RedHat'
|
2016-05-09 22:08:33 +08:00
|
|
|
- ansible_os_family != 'CoreOS'
|
|
|
|
- not mon_containerized_deployment_with_kv
|
2016-03-30 18:28:38 +08:00
|
|
|
|
|
|
|
- name: run the ceph monitor docker image with kv
|
|
|
|
docker:
|
|
|
|
image: "{{ ceph_mon_docker_username }}/{{ ceph_mon_docker_imagename }}"
|
|
|
|
name: "{{ ansible_hostname }}"
|
|
|
|
net: "host"
|
|
|
|
state: "running"
|
|
|
|
privileged: "{{ mon_docker_privileged }}"
|
|
|
|
env: "KV_TYPE={{kv_type}},KV_IP={{kv_endpoint}},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 }}"
|
|
|
|
when:
|
2016-06-03 23:24:00 +08:00
|
|
|
- ansible_os_family != 'RedHat'
|
2016-05-09 22:08:33 +08:00
|
|
|
- ansible_os_family != 'CoreOS'
|
|
|
|
- mon_containerized_deployment_with_kv
|