2016-09-14 23:53:30 +08:00
|
|
|
---
|
|
|
|
# This playbook switches from non-containerized to containerized Ceph daemons
|
|
|
|
|
|
|
|
- name: confirm whether user really meant to switch from non-containerized to containerized ceph daemons
|
|
|
|
|
|
|
|
hosts:
|
|
|
|
- localhost
|
|
|
|
|
|
|
|
gather_facts: false
|
|
|
|
|
|
|
|
vars_prompt:
|
|
|
|
- name: ireallymeanit
|
|
|
|
prompt: Are you sure you want to switch from non-containerized to containerized ceph daemons?
|
|
|
|
default: 'no'
|
|
|
|
private: no
|
|
|
|
|
|
|
|
tasks:
|
|
|
|
- name: exit playbook, if user did not mean to switch from non-containerized to containerized daemons?
|
|
|
|
fail:
|
|
|
|
msg: >
|
|
|
|
"Exiting switch-from-non-containerized-to-containerized-ceph-daemons.yml playbook,
|
|
|
|
cluster did not switch from non-containerized to containerized ceph daemons.
|
|
|
|
To switch from non-containerized to containerized ceph daemons, either say 'yes' on the prompt or
|
|
|
|
or use `-e ireallymeanit=yes` on the command line when
|
|
|
|
invoking the playbook"
|
|
|
|
when: ireallymeanit != 'yes'
|
|
|
|
|
|
|
|
|
|
|
|
- name: make sure docker is present and started
|
|
|
|
|
|
|
|
hosts:
|
2017-03-08 03:32:57 +08:00
|
|
|
- "{{ mon_group_name|default('mons') }}"
|
|
|
|
- "{{ osd_group_name|default('osds') }}"
|
|
|
|
- "{{ mds_group_name|default('mdss') }}"
|
|
|
|
- "{{ rgw_group_name|default('rgws') }}"
|
|
|
|
- "{{ rbdmirror_group_name|default('rbdmirrors') }}"
|
|
|
|
- "{{ nfs_group_name|default('nfss') }}"
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
become: true
|
|
|
|
|
|
|
|
tasks:
|
|
|
|
|
2016-11-01 20:29:21 +08:00
|
|
|
- name: install docker and dependencies for the docker module
|
2016-09-14 23:53:30 +08:00
|
|
|
package:
|
|
|
|
name: "{{ item }}"
|
|
|
|
state: present
|
|
|
|
with_items:
|
|
|
|
- python-docker-py
|
|
|
|
- python-urllib3
|
|
|
|
- docker
|
|
|
|
when: ansible_os_family == 'RedHat'
|
|
|
|
|
|
|
|
- name: install docker-py for the docker module
|
|
|
|
package:
|
|
|
|
name: "{{ item }}"
|
|
|
|
state: present
|
|
|
|
with_items:
|
|
|
|
- docker-py
|
|
|
|
- python-urllib3
|
|
|
|
- docker
|
|
|
|
when: ansible_os_family == 'Debian'
|
|
|
|
|
|
|
|
- name: start docker service
|
|
|
|
service:
|
|
|
|
name: docker
|
|
|
|
state: started
|
|
|
|
enabled: yes
|
|
|
|
|
|
|
|
- name: check if selinux is enabled
|
|
|
|
command: getenforce
|
|
|
|
register: sestatus
|
|
|
|
changed_when: false
|
|
|
|
when: ansible_os_family == 'RedHat'
|
|
|
|
|
|
|
|
- name: set selinux permissions
|
|
|
|
command: chcon -Rt svirt_sandbox_file_t "{{ item }}"
|
|
|
|
with_items:
|
|
|
|
- /etc/ceph
|
|
|
|
- /var/lib/ceph
|
|
|
|
changed_when: false
|
|
|
|
when:
|
|
|
|
- sestatus.stdout != 'Disabled'
|
|
|
|
- ansible_os_family == 'RedHat'
|
|
|
|
|
|
|
|
- name: switching from non-containerized to containerized ceph mon
|
|
|
|
|
|
|
|
vars:
|
2016-11-03 17:16:33 +08:00
|
|
|
mon_group_name: mons
|
2016-11-01 19:39:21 +08:00
|
|
|
restapi_group_name: restapis
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
hosts:
|
2017-03-08 03:32:57 +08:00
|
|
|
- "{{ mon_group_name|default('mons') }}"
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
serial: 1
|
|
|
|
become: true
|
|
|
|
|
|
|
|
tasks:
|
|
|
|
|
|
|
|
- name: select a running monitor
|
|
|
|
set_fact: mon_host={{ item }}
|
2017-03-24 14:40:15 +08:00
|
|
|
with_items: "{{ groups[mon_group_name] }}"
|
2016-09-14 23:53:30 +08:00
|
|
|
when: item != inventory_hostname
|
|
|
|
|
|
|
|
- name: get current ceph fsid
|
|
|
|
command: ceph fsid
|
|
|
|
register: ceph_fsid
|
|
|
|
changed_when: false
|
|
|
|
delegate_to: "{{ mon_host }}"
|
|
|
|
|
|
|
|
- name: stop ceph mon bare metal service
|
|
|
|
service:
|
|
|
|
name: "ceph-mon@{{ ansible_hostname }}"
|
|
|
|
state: stopped
|
|
|
|
enabled: no
|
|
|
|
|
|
|
|
# NOTE(leseb): should we also create systemd files
|
2016-11-01 20:29:21 +08:00
|
|
|
# instead of running raw docker commands?
|
2016-09-14 23:53:30 +08:00
|
|
|
# It is probably more elegant but will require a template file...
|
|
|
|
# which would make this single file playbook more complex
|
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
ceph_uid: 64045
|
2017-02-09 22:16:39 +08:00
|
|
|
when: ceph_docker_image_tag | match("latest")
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
ceph_uid: 64045
|
2017-02-09 22:16:39 +08:00
|
|
|
when: ceph_docker_image_tag | search("ubuntu")
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
ceph_uid: 167
|
2017-08-22 00:32:08 +08:00
|
|
|
when: ceph_docker_image_tag | search("centos") or ceph_docker_image | search("rhceph")
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
ceph_uid: 167
|
2017-02-09 22:16:39 +08:00
|
|
|
when: ceph_docker_image_tag | search("fedora")
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
- name: set proper ownership on ceph directories
|
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
owner: "{{ ceph_uid }}"
|
|
|
|
recurse: yes
|
|
|
|
with_items:
|
|
|
|
- /var/lib/ceph
|
|
|
|
- /etc/ceph
|
|
|
|
|
|
|
|
- name: start ceph mon container image
|
|
|
|
docker:
|
2017-08-22 19:03:55 +08:00
|
|
|
image: "{{ ceph_docker_registry|default('docker.io') }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}"
|
2017-02-20 17:03:49 +08:00
|
|
|
name: "ceph-mon-{{ ansible_hostname }}"
|
2016-09-14 23:53:30 +08:00
|
|
|
net: "host"
|
|
|
|
state: "running"
|
2017-08-22 19:01:03 +08:00
|
|
|
privileged: "{{ mon_docker_privileged|default(false) }}"
|
2017-08-22 00:32:40 +08:00
|
|
|
env: "MON_IP={{ hostvars[inventory_hostname]['ansible_' + monitor_interface]['ipv4']['address'] }},CEPH_DAEMON=MON,CEPH_PUBLIC_NETWORK={{ public_network }},CEPH_FSID={{ ceph_fsid.stdout }},{{ ceph_mon_docker_extra_env|default('') }}"
|
2016-09-14 23:53:30 +08:00
|
|
|
volumes: "/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph,/etc/localtime:/etc/localtime:ro"
|
|
|
|
|
|
|
|
- name: waiting for the monitor to join the quorum...
|
|
|
|
shell: |
|
2017-08-22 19:06:01 +08:00
|
|
|
ceph -s --cluster {{ cluster|default('ceph') }} | grep monmap | sed 's/.*quorum//' | egrep -sq {{ ansible_hostname }}
|
2016-09-14 23:53:30 +08:00
|
|
|
register: result
|
|
|
|
until: result.rc == 0
|
|
|
|
retries: 5
|
|
|
|
delay: 10
|
|
|
|
changed_when: false
|
|
|
|
delegate_to: "{{ mon_host }}"
|
|
|
|
|
|
|
|
|
|
|
|
- name: switching from non-containerized to containerized ceph osd
|
|
|
|
|
|
|
|
vars:
|
|
|
|
osd_group_name: osds
|
|
|
|
|
|
|
|
hosts:
|
2017-03-08 03:32:57 +08:00
|
|
|
- "{{ osd_group_name|default('osds') }}"
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
serial: 1
|
|
|
|
become: true
|
|
|
|
|
|
|
|
tasks:
|
|
|
|
|
|
|
|
- name: collect osd ids
|
|
|
|
shell: |
|
2017-03-30 17:51:38 +08:00
|
|
|
if [ -d /var/lib/ceph/osd ] ; then ls /var/lib/ceph/osd | sed 's/.*-//' ; fi
|
2016-09-14 23:53:30 +08:00
|
|
|
register: osd_ids
|
|
|
|
changed_when: false
|
|
|
|
|
|
|
|
- name: collect osd devices
|
|
|
|
shell: |
|
|
|
|
blkid | awk '/ceph data/ { sub ("1:", "", $1); print $1 }'
|
|
|
|
register: ceph_osd_docker_devices
|
|
|
|
changed_when: false
|
|
|
|
|
|
|
|
- name: stop ceph osd service
|
|
|
|
service:
|
|
|
|
name: "ceph-osd@{{ item }}"
|
|
|
|
state: stopped
|
|
|
|
enabled: no
|
|
|
|
with_items: "{{ osd_ids.stdout_lines }}"
|
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
ceph_uid: 64045
|
2017-02-09 22:16:39 +08:00
|
|
|
when: ceph_docker_image_tag | match("latest")
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
ceph_uid: 64045
|
2017-02-09 22:16:39 +08:00
|
|
|
when: ceph_docker_image_tag | search("ubuntu")
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
ceph_uid: 167
|
2017-08-22 00:32:08 +08:00
|
|
|
when: ceph_docker_image_tag | search("centos") or ceph_docker_image | search("rhceph")
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
ceph_uid: 167
|
2017-02-09 22:16:39 +08:00
|
|
|
when: ceph_docker_image_tag | search("fedora")
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
- name: set proper ownership on ceph directories
|
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
owner: "{{ ceph_uid }}"
|
|
|
|
recurse: yes
|
|
|
|
with_items:
|
|
|
|
- /var/lib/ceph
|
|
|
|
- /etc/ceph
|
|
|
|
|
|
|
|
- name: check if containerized osds are already running
|
|
|
|
shell: |
|
|
|
|
docker ps | grep -sq {{ item | regex_replace('/', '') }}
|
|
|
|
changed_when: false
|
|
|
|
with_items: "{{ ceph_osd_docker_devices.stdout_lines }}"
|
|
|
|
register: osd_running
|
|
|
|
|
|
|
|
- name: unmount all the osd directories
|
|
|
|
mount:
|
|
|
|
name: "/var/lib/ceph/osd/{{ cluster }}-{{ item.0 }}"
|
|
|
|
state: unmounted
|
|
|
|
src: "{{ item.1 }}"
|
|
|
|
fstype: xfs
|
|
|
|
with_together:
|
|
|
|
- "{{ osd_ids.stdout_lines }}"
|
|
|
|
- "{{ ceph_osd_docker_devices.stdout_lines }}"
|
|
|
|
- "{{ osd_running.results }}"
|
|
|
|
when: item.2.rc != 0
|
|
|
|
|
|
|
|
- name: start ceph osd container image(s)
|
|
|
|
docker:
|
2017-08-22 19:03:55 +08:00
|
|
|
image: "{{ ceph_docker_registry|default('docker.io') }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}"
|
2017-02-20 17:03:49 +08:00
|
|
|
name: "ceph-osd-{{ ansible_hostname }}-dev{{ item | regex_replace('/', '') }}"
|
2016-09-14 23:53:30 +08:00
|
|
|
net: host
|
|
|
|
pid: host
|
|
|
|
state: started
|
|
|
|
privileged: yes
|
|
|
|
env: "OSD_DEVICE={{ item }},{{ ceph_osd_docker_extra_env }}"
|
|
|
|
volumes: "/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph,/etc/localtime:/etc/localtime:ro,/dev:/dev,/run:/run"
|
|
|
|
with_items: "{{ ceph_osd_docker_devices.stdout_lines }}"
|
|
|
|
|
|
|
|
- name: waiting for clean pgs...
|
|
|
|
shell: |
|
2017-06-22 23:42:03 +08:00
|
|
|
test "[""$(ceph --cluster {{ cluster }} -s -f json | python -c 'import sys, json; print(json.load(sys.stdin)["pgmap"]["num_pgs"])')""]" = "$(ceph --cluster {{ cluster }} -s -f json | python -c 'import sys, json; print [ i["count"] for i in json.load(sys.stdin)["pgmap"]["pgs_by_state"] if i["state_name"] == "active+clean"]')"
|
2016-09-14 23:53:30 +08:00
|
|
|
register: result
|
|
|
|
until: result.rc == 0
|
|
|
|
retries: 10
|
|
|
|
delay: 10
|
|
|
|
changed_when: false
|
2017-03-24 14:40:15 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
|
|
|
|
- name: switching from non-containerized to containerized ceph mds
|
|
|
|
|
|
|
|
hosts:
|
2017-03-08 03:32:57 +08:00
|
|
|
- "{{ mds_group_name|default('mdss') }}"
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
serial: 1
|
|
|
|
become: true
|
|
|
|
|
|
|
|
tasks:
|
|
|
|
|
|
|
|
- name: stop ceph mds service
|
|
|
|
service:
|
|
|
|
name: "ceph-mds@{{ ansible_hostname }}"
|
|
|
|
state: stopped
|
|
|
|
enabled: no
|
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
ceph_uid: 64045
|
2017-02-09 22:16:39 +08:00
|
|
|
when: ceph_docker_image_tag | match("latest")
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
ceph_uid: 64045
|
2017-02-09 22:16:39 +08:00
|
|
|
when: ceph_docker_image_tag | search("ubuntu")
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
ceph_uid: 167
|
2017-08-22 00:32:08 +08:00
|
|
|
when: ceph_docker_image_tag | search("centos") or ceph_docker_image | search("rhceph")
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
ceph_uid: 167
|
2017-02-09 22:16:39 +08:00
|
|
|
when: ceph_docker_image_tag | search("fedora")
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
- name: set proper ownership on ceph directories
|
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
owner: "{{ ceph_uid }}"
|
|
|
|
recurse: yes
|
|
|
|
with_items:
|
|
|
|
- /var/lib/ceph
|
|
|
|
- /etc/ceph
|
|
|
|
|
|
|
|
- name: start ceph metadata container image
|
|
|
|
docker:
|
2017-08-22 19:03:55 +08:00
|
|
|
image: "{{ ceph_docker_registry|default('docker.io') }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}"
|
2017-02-20 17:03:49 +08:00
|
|
|
name: ceph-mds-{{ ansible_hostname }}
|
2016-09-14 23:53:30 +08:00
|
|
|
net: host
|
|
|
|
state: running
|
|
|
|
env: "CEPH_DAEMON=MDS,CEPHFS_CREATE=1,{{ ceph_mds_docker_extra_env }}"
|
|
|
|
volumes: "/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph,/etc/localtime:/etc/localtime:ro"
|
|
|
|
|
|
|
|
|
|
|
|
- name: switching from non-containerized to containerized ceph rgw
|
|
|
|
|
|
|
|
hosts:
|
2017-03-08 03:32:57 +08:00
|
|
|
- "{{ rgw_group_name|default('rgws') }}"
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
serial: 1
|
|
|
|
become: true
|
|
|
|
|
|
|
|
tasks:
|
|
|
|
|
|
|
|
- name: stop ceph rgw service
|
|
|
|
service:
|
|
|
|
name: "ceph-rgw@{{ ansible_hostname }}"
|
|
|
|
state: stopped
|
|
|
|
enabled: no
|
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
ceph_uid: 64045
|
2017-02-09 22:16:39 +08:00
|
|
|
when: ceph_docker_image_tag | match("latest")
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
ceph_uid: 64045
|
2017-02-09 22:16:39 +08:00
|
|
|
when: ceph_docker_image_tag | search("ubuntu")
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
ceph_uid: 167
|
2017-08-22 00:32:08 +08:00
|
|
|
when: ceph_docker_image_tag | search("centos") or ceph_docker_image | search("rhceph")
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
ceph_uid: 167
|
2017-02-09 22:16:39 +08:00
|
|
|
when: ceph_docker_image_tag | search("fedora")
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
- name: set proper ownership on ceph directories
|
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
owner: "{{ ceph_uid }}"
|
|
|
|
recurse: yes
|
|
|
|
with_items:
|
|
|
|
- /var/lib/ceph
|
|
|
|
- /etc/ceph
|
|
|
|
|
|
|
|
- name: start ceph rados gateway container image
|
|
|
|
docker:
|
2017-08-22 19:03:55 +08:00
|
|
|
image: "{{ ceph_docker_registry|default('docker.io') }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}"
|
2017-02-20 17:03:49 +08:00
|
|
|
name: ceph-rgw-{{ ansible_hostname }}
|
2016-09-14 23:53:30 +08:00
|
|
|
expose: "{{ ceph_rgw_civetweb_port }}"
|
|
|
|
ports: "{{ ceph_rgw_civetweb_port }}:{{ ceph_rgw_civetweb_port }}"
|
|
|
|
state: running
|
|
|
|
env: "CEPH_DAEMON=RGW,{{ ceph_rgw_docker_extra_env }}"
|
|
|
|
volumes: "/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph,/etc/localtime:/etc/localtime:ro"
|
|
|
|
|
|
|
|
|
|
|
|
- name: switching from non-containerized to containerized ceph rbd-mirror
|
|
|
|
|
|
|
|
hosts:
|
2017-03-08 03:32:57 +08:00
|
|
|
- "{{ rbdmirror_group_name|default('rbdmirrors') }}"
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
serial: 1
|
|
|
|
become: true
|
|
|
|
|
|
|
|
tasks:
|
|
|
|
|
|
|
|
- name: stop ceph rbd mirror service
|
|
|
|
service:
|
|
|
|
name: "ceph-rbd-mirror@{{ ansible_hostname }}"
|
|
|
|
state: stopped
|
|
|
|
enabled: no
|
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
ceph_uid: 64045
|
2017-02-09 22:16:39 +08:00
|
|
|
when: ceph_docker_image_tag | match("latest")
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
ceph_uid: 64045
|
2017-02-09 22:16:39 +08:00
|
|
|
when: ceph_docker_image_tag | search("ubuntu")
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
ceph_uid: 167
|
2017-08-22 00:32:08 +08:00
|
|
|
when: ceph_docker_image_tag | search("centos") or ceph_docker_image | search("rhceph")
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
ceph_uid: 167
|
2017-02-09 22:16:39 +08:00
|
|
|
when: ceph_docker_image_tag | search("fedora")
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
- name: set proper ownership on ceph directories
|
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
owner: "{{ ceph_uid }}"
|
|
|
|
recurse: yes
|
|
|
|
with_items:
|
|
|
|
- /var/lib/ceph
|
|
|
|
- /etc/ceph
|
|
|
|
|
|
|
|
- name: start ceph rbd mirror container image
|
|
|
|
docker:
|
2017-08-22 19:03:55 +08:00
|
|
|
image: "{{ ceph_docker_registry|default('docker.io') }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}"
|
2017-02-20 17:03:49 +08:00
|
|
|
name: "ceph-rbd-mirror-{{ ansible_hostname }}"
|
2016-09-14 23:53:30 +08:00
|
|
|
net: host
|
|
|
|
state: running
|
|
|
|
volumes: "/etc/ceph:/etc/ceph,/etc/localtime:/etc/localtime:ro"
|
|
|
|
|
|
|
|
|
|
|
|
- name: switching from non-containerized to containerized ceph nfs
|
|
|
|
|
|
|
|
hosts:
|
2017-03-08 03:32:57 +08:00
|
|
|
- "{{ nfs_group_name|default('nfss') }}"
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
serial: 1
|
|
|
|
become: true
|
|
|
|
|
|
|
|
tasks:
|
|
|
|
|
|
|
|
- name: stop ceph nfs service
|
|
|
|
service:
|
|
|
|
name: "ceph-nfs@{{ ansible_hostname }}"
|
|
|
|
state: stopped
|
|
|
|
enabled: no
|
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
ceph_uid: 64045
|
2017-02-09 22:16:39 +08:00
|
|
|
when: ceph_docker_image_tag | match("latest")
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
ceph_uid: 64045
|
2017-02-09 22:16:39 +08:00
|
|
|
when: ceph_docker_image_tag | search("ubuntu")
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
ceph_uid: 167
|
2017-08-22 00:32:08 +08:00
|
|
|
when: ceph_docker_image_tag | search("centos") or ceph_docker_image | search("rhceph")
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
ceph_uid: 167
|
2017-02-09 22:16:39 +08:00
|
|
|
when: ceph_docker_image_tag | search("fedora")
|
2016-09-14 23:53:30 +08:00
|
|
|
|
|
|
|
- name: set proper ownership on ceph directories
|
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
owner: "{{ ceph_uid }}"
|
|
|
|
recurse: yes
|
|
|
|
with_items:
|
|
|
|
- /var/lib/ceph
|
|
|
|
- /etc/ceph
|
|
|
|
|
|
|
|
- name: start ceph nfs container image
|
|
|
|
docker:
|
2017-08-22 19:03:55 +08:00
|
|
|
image: "{{ ceph_docker_registry|default('docker.io') }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}"
|
2017-02-20 17:03:49 +08:00
|
|
|
name: "ceph-nfs-{{ ansible_hostname }}"
|
2016-09-14 23:53:30 +08:00
|
|
|
net: "host"
|
|
|
|
state: "running"
|
|
|
|
privileged: true
|
|
|
|
ports: "{{ ceph_nfs_port }}:{{ ceph_nfs_port }},111:111"
|
2017-01-27 07:57:34 +08:00
|
|
|
env: "CEPH_DAEMON=NFS,CEPH_PUBLIC_NETWORK={{ ceph_nfs_docker_subnet }},{{ ceph_nfs_docker_extra_env }}"
|
2016-09-14 23:53:30 +08:00
|
|
|
volumes: "/etc/ceph:/etc/ceph,/etc/ganesha:/etc/ganesha,/etc/localtime:/etc/localtime:ro"
|