mirror of https://github.com/ceph/ceph-ansible.git
nfs: fix container setup and re-arrange files
Signed-off-by: Sébastien Han <seb@redhat.com>pull/1939/head
parent
b4bec52442
commit
341c9e077b
|
@ -394,6 +394,10 @@ dummy:
|
||||||
#handler_health_rgw_check_retries: 5
|
#handler_health_rgw_check_retries: 5
|
||||||
#handler_health_rgw_check_delay: 10
|
#handler_health_rgw_check_delay: 10
|
||||||
|
|
||||||
|
# NFS handler checks
|
||||||
|
#handler_health_nfs_check_retries: 5
|
||||||
|
#handler_health_nfs_check_delay: 10
|
||||||
|
|
||||||
###############
|
###############
|
||||||
# NFS-GANESHA #
|
# NFS-GANESHA #
|
||||||
###############
|
###############
|
||||||
|
|
|
@ -394,6 +394,10 @@ ceph_repository: rhcs
|
||||||
#handler_health_rgw_check_retries: 5
|
#handler_health_rgw_check_retries: 5
|
||||||
#handler_health_rgw_check_delay: 10
|
#handler_health_rgw_check_delay: 10
|
||||||
|
|
||||||
|
# NFS handler checks
|
||||||
|
#handler_health_nfs_check_retries: 5
|
||||||
|
#handler_health_nfs_check_delay: 10
|
||||||
|
|
||||||
###############
|
###############
|
||||||
# NFS-GANESHA #
|
# NFS-GANESHA #
|
||||||
###############
|
###############
|
||||||
|
|
|
@ -386,6 +386,10 @@ handler_health_mds_check_delay: 10
|
||||||
handler_health_rgw_check_retries: 5
|
handler_health_rgw_check_retries: 5
|
||||||
handler_health_rgw_check_delay: 10
|
handler_health_rgw_check_delay: 10
|
||||||
|
|
||||||
|
# NFS handler checks
|
||||||
|
handler_health_nfs_check_retries: 5
|
||||||
|
handler_health_nfs_check_delay: 10
|
||||||
|
|
||||||
###############
|
###############
|
||||||
# NFS-GANESHA #
|
# NFS-GANESHA #
|
||||||
###############
|
###############
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
RETRIES="{{ handler_health_nfs_check_retries }}"
|
||||||
|
DELAY="{{ handler_health_nfs_check_delay }}"
|
||||||
|
NFS_NAME="{{ ansible_hostname }}"
|
||||||
|
PID=/var/run/ganesha.pid
|
||||||
|
|
||||||
|
# First, restart the daemon
|
||||||
|
{% if containerized_deployment -%}
|
||||||
|
systemctl restart ceph-nfs@${NFS_NAME}
|
||||||
|
COUNT=10
|
||||||
|
# Wait and ensure the pid exists after restarting the daemon
|
||||||
|
while [ $RETRIES -ne 0 ]; do
|
||||||
|
{{ docker_exec_cmd }} test -f $PID && exit 0
|
||||||
|
sleep $DELAY
|
||||||
|
let RETRIES=RETRIES-1
|
||||||
|
done
|
||||||
|
# If we reach this point, it means the pid is not present.
|
||||||
|
echo "PID file ${PID} could not be found, which means Ganesha is not running."
|
||||||
|
exit 1
|
||||||
|
{% else %}
|
||||||
|
systemctl restart nfs-ganesha
|
||||||
|
{% endif %}
|
|
@ -8,6 +8,7 @@
|
||||||
- name: create rgw nfs user
|
- name: create rgw nfs user
|
||||||
command: "{{ docker_exec_cmd_nfs | default('') }} radosgw-admin --cluster {{ cluster }} user create --uid={{ ceph_nfs_rgw_user }} --display-name='RGW NFS User'"
|
command: "{{ docker_exec_cmd_nfs | default('') }} radosgw-admin --cluster {{ cluster }} user create --uid={{ ceph_nfs_rgw_user }} --display-name='RGW NFS User'"
|
||||||
register: rgwuser
|
register: rgwuser
|
||||||
|
changed_when: false
|
||||||
delegate_to: "{{ groups[mon_group_name][0] }}"
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
||||||
when:
|
when:
|
||||||
- nfs_obj_gw
|
- nfs_obj_gw
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
---
|
|
||||||
- name: include start_docker_nfs.yml
|
|
||||||
include: start_docker_nfs.yml
|
|
|
@ -1,18 +0,0 @@
|
||||||
---
|
|
||||||
- name: generate systemd unit file
|
|
||||||
become: true
|
|
||||||
template:
|
|
||||||
src: "{{ role_path }}/templates/ceph-nfs.service.j2"
|
|
||||||
dest: /etc/systemd/system/ceph-nfs@.service
|
|
||||||
owner: "root"
|
|
||||||
group: "root"
|
|
||||||
mode: "0644"
|
|
||||||
|
|
||||||
- name: systemd start nfs container
|
|
||||||
systemd:
|
|
||||||
name: "ceph-nfs@{{ ansible_hostname }}.service"
|
|
||||||
state: started
|
|
||||||
enabled: yes
|
|
||||||
daemon_reload: yes
|
|
||||||
when:
|
|
||||||
- ceph_nfs_enable_service
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
---
|
||||||
|
- name: check if selinux is enabled
|
||||||
|
command: getenforce
|
||||||
|
register: selinuxstatus
|
||||||
|
changed_when: false
|
||||||
|
failed_when: false
|
||||||
|
always_run: true
|
||||||
|
|
||||||
|
- name: install policycoreutils-python to get semanage
|
||||||
|
package:
|
||||||
|
name: policycoreutils-python
|
||||||
|
state: present
|
||||||
|
when:
|
||||||
|
- selinuxstatus.stdout != 'Disabled'
|
||||||
|
|
||||||
|
- name: test if ganesha_t is already permissive
|
||||||
|
shell: |
|
||||||
|
semanage permissive -l | grep -soq ganesha_t
|
||||||
|
changed_when: false
|
||||||
|
failed_when: false
|
||||||
|
register: ganesha_t_permissive
|
||||||
|
|
||||||
|
- name: run semanage permissive -a ganesha_t
|
||||||
|
command: semanage permissive -a ganesha_t
|
||||||
|
changed_when: false
|
||||||
|
when:
|
||||||
|
- selinuxstatus.stdout != 'Disabled'
|
||||||
|
- ganesha_t_permissive.rc != 0
|
|
@ -1,18 +1,24 @@
|
||||||
---
|
---
|
||||||
- name: include pre_requisite.yml
|
- name: include pre_requisite_non_container.yml
|
||||||
include: pre_requisite.yml
|
include: pre_requisite_non_container.yml
|
||||||
when:
|
when:
|
||||||
- not containerized_deployment
|
- not containerized_deployment
|
||||||
|
|
||||||
|
- name: include pre_requisite_container.yml
|
||||||
|
include: pre_requisite_container.yml
|
||||||
|
when:
|
||||||
|
- containerized_deployment
|
||||||
|
|
||||||
- name: include create_rgw_nfs_user.yml
|
- name: include create_rgw_nfs_user.yml
|
||||||
include: create_rgw_nfs_user.yml
|
include: create_rgw_nfs_user.yml
|
||||||
|
|
||||||
- name: include start_nfs.yml
|
# NOTE (leseb): workaround for issues with ganesha and librgw
|
||||||
include: start_nfs.yml
|
- name: include ganesha_selinux_fix.yml
|
||||||
|
include: ganesha_selinux_fix.yml
|
||||||
when:
|
when:
|
||||||
- not containerized_deployment
|
- not containerized_deployment
|
||||||
|
- ansible_os_family == 'RedHat'
|
||||||
|
- ansible_distribution_version >= '7.4'
|
||||||
|
|
||||||
- name: include docker/main.yml
|
- name: include start_nfs.yml
|
||||||
include: docker/main.yml
|
include: start_nfs.yml
|
||||||
when:
|
|
||||||
- containerized_deployment
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
---
|
---
|
||||||
|
# NOTE (leseb): we use root:ceph for permissions since ganesha
|
||||||
|
# does not have the right selinux context to read ceph directories.
|
||||||
- name: create rados gateway and ganesha directories
|
- name: create rados gateway and ganesha directories
|
||||||
file:
|
file:
|
||||||
path: "{{ item }}"
|
path: "{{ item }}"
|
||||||
|
@ -11,8 +13,8 @@
|
||||||
- /var/lib/ceph/radosgw
|
- /var/lib/ceph/radosgw
|
||||||
- /var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ ansible_hostname }}
|
- /var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ ansible_hostname }}
|
||||||
- "{{ rbd_client_admin_socket_path }}"
|
- "{{ rbd_client_admin_socket_path }}"
|
||||||
- /var/lib/nfs/ganesha
|
- /var/log/ceph
|
||||||
- /var/run/ganesha
|
- /var/run/ceph/
|
||||||
when:
|
when:
|
||||||
- nfs_obj_gw
|
- nfs_obj_gw
|
||||||
|
|
||||||
|
@ -51,7 +53,7 @@
|
||||||
|
|
||||||
- name: change ownership on /var/log/ganesha
|
- name: change ownership on /var/log/ganesha
|
||||||
file:
|
file:
|
||||||
path: '/var/log/ganesha'
|
path: /var/log/ganesha
|
||||||
owner: 'root'
|
owner: "root"
|
||||||
group: 'root'
|
group: "root"
|
||||||
mode: '0755'
|
mode: "0755"
|
|
@ -1,4 +1,12 @@
|
||||||
---
|
---
|
||||||
|
- name: create /etc/ganesha
|
||||||
|
file:
|
||||||
|
path: /etc/ganesha
|
||||||
|
state: directory
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: "0755"
|
||||||
|
|
||||||
- name: generate ganesha configuration file
|
- name: generate ganesha configuration file
|
||||||
action: config_template
|
action: config_template
|
||||||
args:
|
args:
|
||||||
|
@ -11,6 +19,27 @@
|
||||||
notify:
|
notify:
|
||||||
- restart ceph nfss
|
- restart ceph nfss
|
||||||
|
|
||||||
|
- name: generate systemd unit file
|
||||||
|
become: true
|
||||||
|
template:
|
||||||
|
src: "{{ role_path }}/templates/ceph-nfs.service.j2"
|
||||||
|
dest: /etc/systemd/system/ceph-nfs@.service
|
||||||
|
owner: "root"
|
||||||
|
group: "root"
|
||||||
|
mode: "0644"
|
||||||
|
when:
|
||||||
|
- containerized_deployment
|
||||||
|
|
||||||
|
- name: systemd start nfs container
|
||||||
|
systemd:
|
||||||
|
name: "ceph-nfs@{{ ansible_hostname }}.service"
|
||||||
|
state: started
|
||||||
|
enabled: yes
|
||||||
|
daemon_reload: yes
|
||||||
|
when:
|
||||||
|
- ceph_nfs_enable_service
|
||||||
|
- containerized_deployment
|
||||||
|
|
||||||
- name: start nfs gateway service
|
- name: start nfs gateway service
|
||||||
service:
|
service:
|
||||||
name: nfs-ganesha
|
name: nfs-ganesha
|
||||||
|
@ -18,3 +47,4 @@
|
||||||
enabled: yes
|
enabled: yes
|
||||||
when:
|
when:
|
||||||
- ceph_nfs_enable_service
|
- ceph_nfs_enable_service
|
||||||
|
- not containerized_deployment
|
||||||
|
|
|
@ -8,20 +8,22 @@ EnvironmentFile=-/etc/environment
|
||||||
ExecStartPre=-/usr/bin/docker rm ceph-nfs-%i
|
ExecStartPre=-/usr/bin/docker rm ceph-nfs-%i
|
||||||
ExecStartPre=/usr/bin/mkdir -p /etc/ceph /etc/ganesha /var/lib/nfs/ganesha
|
ExecStartPre=/usr/bin/mkdir -p /etc/ceph /etc/ganesha /var/lib/nfs/ganesha
|
||||||
ExecStart=/usr/bin/docker run --rm --net=host \
|
ExecStart=/usr/bin/docker run --rm --net=host \
|
||||||
{% if not containerized_deployment_with_kv -%}
|
{% if not containerized_deployment_with_kv -%}
|
||||||
-v /etc/ceph:/etc/ceph \
|
-v /var/lib/ceph:/var/lib/ceph \
|
||||||
-v /etc/ganesha:/etc/ganesha \
|
-v /etc/ceph:/etc/ceph \
|
||||||
{% else -%}
|
-v /var/lib/ganesha:/var/lib/ganesha \
|
||||||
-e KV_TYPE={{kv_type}} \
|
-v /etc/ganesha:/etc/ganesha \
|
||||||
-e KV_IP={{kv_endpoint}}\
|
{% else -%}
|
||||||
-e KV_PORT={{kv_port}} \
|
-e KV_TYPE={{kv_type}} \
|
||||||
{% endif -%}
|
-e KV_IP={{kv_endpoint}}\
|
||||||
-v /etc/localtime:/etc/localtime:ro \
|
-e KV_PORT={{kv_port}} \
|
||||||
--privileged \
|
{% endif -%}
|
||||||
-e CEPH_DAEMON=NFS \
|
-v /etc/localtime:/etc/localtime:ro \
|
||||||
{{ ceph_nfs_docker_extra_env }} \
|
-e CLUSTER={{ cluster }} \
|
||||||
--name=ceph-nfs-{{ ansible_hostname }} \
|
-e CEPH_DAEMON=NFS \
|
||||||
{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
|
{{ ceph_nfs_docker_extra_env }} \
|
||||||
|
--name=ceph-nfs-{{ ansible_hostname }} \
|
||||||
|
{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
|
||||||
ExecStopPost=-/usr/bin/docker stop ceph-nfs-%i
|
ExecStopPost=-/usr/bin/docker stop ceph-nfs-%i
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=10s
|
RestartSec=10s
|
||||||
|
|
Loading…
Reference in New Issue