ceph-ansible/roles/ceph-restapi/tasks/docker.yml

49 lines
1.3 KiB
YAML

---
- name: set config and keys paths
set_fact:
ceph_config_keys:
- /etc/ceph/ceph.client.admin.keyring
- /etc/ceph/ceph.conf
- name: install docker-py
pip: >
name=docker-py
version=1.1.0 # https://github.com/ansible/ansible-modules-core/issues/1227
- name: stat for Ceph config and keys
stat: >
path={{ item }}
with_items: ceph_config_keys
ignore_errors: true
register: statconfig
- name: try to fetch Ceph config and keys
copy: >
src=fetch/docker_mon_files/"{{ item }}"
dest=/etc/ceph/
owner=root
group=root
mode=600
with_together:
- ceph_config_keys
- statconfig.results
when: item.1.stat.exists == False
- name: run the Ceph REST API docker image
docker: >
image="{{ ceph_restapi_docker_username }}/{{ ceph_restapi_docker_imagename }}"
name={{ ansible_hostname }}-ceph-restapi
net=host
expose={{ ceph_restapi_port }}
state=running
env="RESTAPI_IP={{ hostvars[inventory_hostname]['ansible_' + ceph_restapi_docker_interface]['ipv4']['address'] }},CEPH_DAEMON=RESTAPI"
volumes="/etc/ceph:/etc/ceph"
- name: ensure Ceph REST API service is running
docker: >
image="{{ ceph_restapi_docker_username }}/{{ ceph_restapi_docker_imagename }}"
name="ceph-{{ ansible_hostname }}"
ports={{ ceph_restapi_port }}:{{ ceph_restapi_port }}
detach=yes
state=running