2016-05-06 02:20:03 +08:00
|
|
|
---
|
2018-09-07 20:45:43 +08:00
|
|
|
- name: include red hat based system related tasks
|
|
|
|
include_tasks: pre_requisite_non_container_red_hat.yml
|
2019-04-01 23:46:15 +08:00
|
|
|
when: ansible_os_family == 'RedHat'
|
2017-10-10 03:34:17 +08:00
|
|
|
|
2018-09-07 20:45:43 +08:00
|
|
|
- name: include debian based system related tasks
|
|
|
|
include_tasks: pre_requisite_non_container_debian.yml
|
2019-04-01 23:46:15 +08:00
|
|
|
when: ansible_os_family == 'Debian'
|
2017-10-09 23:10:39 +08:00
|
|
|
|
2019-08-22 00:17:00 +08:00
|
|
|
- name: install nfs rgw/cephfs gateway - SUSE/openSUSE
|
2017-12-19 18:17:04 +08:00
|
|
|
zypper:
|
2018-03-22 20:19:22 +08:00
|
|
|
name: "{{ item.name }}"
|
2017-12-19 18:17:04 +08:00
|
|
|
disable_gpg_check: yes
|
2017-10-09 23:10:39 +08:00
|
|
|
with_items:
|
2018-03-22 20:19:22 +08:00
|
|
|
- { name: 'nfs-ganesha-rgw', install: "{{ nfs_obj_gw }}" }
|
|
|
|
- { name: 'radosgw', install: "{{ nfs_obj_gw }}" }
|
|
|
|
- { name: 'nfs-ganesha-ceph', install: "{{ nfs_file_gw }}" }
|
2017-10-09 23:10:39 +08:00
|
|
|
when:
|
|
|
|
- (ceph_origin == 'repository' or ceph_origin == 'distro')
|
|
|
|
- ceph_repository != 'rhcs'
|
2017-12-19 18:17:04 +08:00
|
|
|
- ansible_os_family == 'Suse'
|
2018-03-22 20:19:22 +08:00
|
|
|
- item.install | bool
|
2018-12-20 17:00:26 +08:00
|
|
|
register: result
|
|
|
|
until: result is succeeded
|
2017-12-19 18:17:04 +08:00
|
|
|
|
2017-09-27 05:16:43 +08:00
|
|
|
# NOTE (leseb): we use root:ceph for permissions since ganesha
|
|
|
|
# does not have the right selinux context to read ceph directories.
|
2017-09-19 22:19:14 +08:00
|
|
|
- name: create rados gateway and ganesha directories
|
2017-09-11 11:34:36 +08:00
|
|
|
file:
|
2018-03-11 03:27:10 +08:00
|
|
|
path: "{{ item.name }}"
|
2017-09-11 11:34:36 +08:00
|
|
|
state: directory
|
|
|
|
owner: "ceph"
|
|
|
|
group: "ceph"
|
|
|
|
mode: "0755"
|
|
|
|
with_items:
|
2018-03-11 03:27:10 +08:00
|
|
|
- { name: "/var/lib/ceph/bootstrap-rgw", create: "{{ nfs_obj_gw }}" }
|
|
|
|
- { name: "/var/lib/ceph/radosgw", create: "{{ nfs_obj_gw }}" }
|
|
|
|
- { name: "/var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ ansible_hostname }}", create: "{{ nfs_obj_gw }}" }
|
|
|
|
- { name: "{{ rbd_client_admin_socket_path }}", create: "{{ nfs_obj_gw }}" }
|
|
|
|
- { name: "/var/log/ceph", create: true }
|
|
|
|
- { name: "/var/run/ceph", create: true }
|
2019-05-22 16:02:42 +08:00
|
|
|
when: item.create | bool
|
2017-09-11 11:34:36 +08:00
|
|
|
|
2018-09-07 20:45:43 +08:00
|
|
|
- name: cephx related tasks
|
2019-05-20 21:58:10 +08:00
|
|
|
when:
|
2019-05-22 16:02:42 +08:00
|
|
|
- cephx | bool
|
2019-05-20 21:58:10 +08:00
|
|
|
- groups.get(mon_group_name, []) | length > 0
|
2018-09-07 20:45:43 +08:00
|
|
|
block:
|
|
|
|
- name: copy bootstrap cephx keys
|
|
|
|
copy:
|
2019-06-25 16:23:57 +08:00
|
|
|
src: "{{ fetch_directory }}/{{ fsid }}/{{ item.name }}"
|
2018-09-07 20:45:43 +08:00
|
|
|
dest: "{{ item.name }}"
|
|
|
|
owner: "ceph"
|
|
|
|
group: "ceph"
|
|
|
|
mode: "0600"
|
2019-05-12 19:10:30 +08:00
|
|
|
with_items:
|
|
|
|
- { name: "/var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring", copy_key: "{{ nfs_obj_gw }}" }
|
2019-06-25 16:23:57 +08:00
|
|
|
- { name: "/etc/ceph/{{ cluster }}.client.admin.keyring", copy_key: "{{ copy_admin_key }}" }
|
2019-05-22 16:02:42 +08:00
|
|
|
when: item.copy_key | bool
|
2018-09-07 20:45:43 +08:00
|
|
|
|
|
|
|
- name: nfs object gateway related tasks
|
2019-05-22 16:02:42 +08:00
|
|
|
when: nfs_obj_gw | bool
|
2018-09-07 20:45:43 +08:00
|
|
|
block:
|
|
|
|
- name: create rados gateway keyring
|
|
|
|
command: ceph --cluster {{ cluster }} --name client.bootstrap-rgw --keyring /var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring auth get-or-create client.rgw.{{ ansible_hostname }} osd 'allow rwx' mon 'allow rw' -o /var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ ansible_hostname }}/keyring
|
|
|
|
args:
|
|
|
|
creates: /var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ ansible_hostname }}/keyring
|
|
|
|
changed_when: false
|
|
|
|
|
|
|
|
- name: set rados gateway key permissions
|
|
|
|
file:
|
|
|
|
path: /var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ ansible_hostname }}/keyring
|
|
|
|
owner: "ceph"
|
|
|
|
group: "ceph"
|
|
|
|
mode: "0600"
|
2017-09-11 11:34:36 +08:00
|
|
|
|
2017-09-20 18:35:00 +08:00
|
|
|
- name: change ownership on /var/log/ganesha
|
|
|
|
file:
|
2017-09-27 05:16:43 +08:00
|
|
|
path: /var/log/ganesha
|
|
|
|
owner: "root"
|
|
|
|
group: "root"
|
|
|
|
mode: "0755"
|
2018-04-03 01:47:31 +08:00
|
|
|
|
|
|
|
- name: stop nfs server service
|
|
|
|
systemd:
|
|
|
|
name: "{%- if ansible_os_family == 'RedHat' 'nfs-server' %}{%- endif %}{%- if ansible_os_family == 'Suse' 'nfsserver' %}{%- endif %}{%- if ansible_os_family == 'Debian' 'nfs-kernel-server' %}{%- endif %}"
|
|
|
|
state: stopped
|
|
|
|
enabled: no
|
|
|
|
ignore_errors: true
|