2016-05-06 02:20:03 +08:00
|
|
|
---
|
|
|
|
# Use systemd to manage container on Atomic host and CoreOS
|
|
|
|
- name: generate systemd unit file
|
|
|
|
become: true
|
|
|
|
template:
|
|
|
|
src: "{{ playbook_dir }}/roles/ceph-nfs/templates/ceph-nfs.service.j2"
|
|
|
|
dest: /var/lib/nfs/ganesha/ceph-nfs@.service
|
|
|
|
owner: "root"
|
|
|
|
group: "root"
|
|
|
|
mode: "0644"
|
|
|
|
when:
|
|
|
|
is_atomic or
|
|
|
|
ansible_os_family == 'CoreOS'
|
|
|
|
|
|
|
|
- name: link systemd unit file for NFS instance
|
|
|
|
file:
|
|
|
|
src: /var/lib/nfs/ganesha/ceph-nfs@.service
|
|
|
|
dest: /etc/systemd/system/multi-user.target.wants/ceph-nfs@{{ ansible_hostname }}.service
|
|
|
|
state: link
|
|
|
|
when:
|
|
|
|
is_atomic or
|
|
|
|
ansible_os_family == 'CoreOS'
|
|
|
|
|
|
|
|
- name: enable systemd unit file for NFS instance
|
|
|
|
shell: systemctl enable /etc/systemd/system/multi-user.target.wants/ceph-nfs@{{ ansible_hostname }}.service
|
|
|
|
failed_when: false
|
|
|
|
changed_when: false
|
|
|
|
when:
|
|
|
|
is_atomic or
|
|
|
|
ansible_os_family == 'CoreOS'
|
|
|
|
|
|
|
|
- name: reload systemd unit files
|
|
|
|
shell: systemctl daemon-reload
|
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
|
|
|
when:
|
|
|
|
is_atomic or
|
|
|
|
ansible_os_family == 'CoreOS'
|
|
|
|
|
|
|
|
- name: systemd start NFS container
|
|
|
|
service:
|
|
|
|
name: ceph-nfs@{{ ansible_hostname }}
|
|
|
|
state: started
|
|
|
|
enabled: yes
|
|
|
|
changed_when: false
|
|
|
|
when:
|
|
|
|
is_atomic or
|
|
|
|
ansible_os_family == 'CoreOS'
|
|
|
|
|
|
|
|
- name: wait for ceph.conf exists
|
|
|
|
wait_for:
|
2016-08-23 18:03:05 +08:00
|
|
|
path: "/etc/ceph/{{ cluster }}.conf"
|
2016-05-06 02:20:03 +08:00
|
|
|
when: is_atomic
|
|
|
|
|
|
|
|
- name: run the ceph NFS docker image
|
|
|
|
docker:
|
2016-07-09 09:38:13 +08:00
|
|
|
image: "{{ ceph_nfs_docker_username }}/{{ ceph_nfs_docker_imagename }}:{{ ceph_nfs_docker_image_tag }}"
|
2016-05-06 02:20:03 +08:00
|
|
|
name: "{{ ansible_hostname }}"
|
|
|
|
net: "host"
|
|
|
|
state: "running"
|
|
|
|
privileged: true
|
|
|
|
ports: "{{ ceph_nfs_port }}:{{ ceph_nfs_port }},111:111"
|
|
|
|
env: "CEPH_DAEMON=NFS,CEPH_PUBLIC_NETWORK={{ ceph_nfs_docker_subnet }},{{ ceph_nfs_extra_envs }}"
|
2016-07-28 22:42:19 +08:00
|
|
|
volumes: "/etc/ceph:/etc/ceph,/etc/ganesha:/etc/ganesha,/etc/localtime:/etc/localtime:ro"
|
2016-05-06 02:20:03 +08:00
|
|
|
when:
|
|
|
|
not is_atomic and
|
|
|
|
ansible_os_family != 'CoreOS' and
|
|
|
|
not mon_containerized_deployment_with_kv
|
|
|
|
|
|
|
|
- name: run the ceph NFS docker image with kv
|
|
|
|
docker:
|
2016-07-09 09:38:13 +08:00
|
|
|
image: "{{ ceph_nfs_docker_username }}/{{ ceph_nfs_docker_imagename }}:{{ ceph_nfs_docker_image_tag }}"
|
2016-05-06 02:20:03 +08:00
|
|
|
name: "{{ ansible_hostname }}"
|
|
|
|
net: "host"
|
|
|
|
state: "running"
|
|
|
|
privileged: true
|
|
|
|
env: "CEPH_DAEMON=NFS,CEPH_PUBLIC_NETWORK={{ ceph_nfs_docker_subnet }},{{ ceph_nfs_extra_envs }}"
|
2016-07-28 22:42:19 +08:00
|
|
|
volumes: "/etc/ganesha:/etc/ganesha,/etc/localtime:/etc/localtime:ro"
|
2016-05-06 02:20:03 +08:00
|
|
|
when:
|
|
|
|
not is_atomic and
|
|
|
|
ansible_os_family != 'CoreOS' and
|
|
|
|
mon_containerized_deployment_with_kv
|