2017-08-05 02:18:11 +08:00
|
|
|
---
|
2017-10-10 16:39:02 +08:00
|
|
|
- name: set_fact ceph_iscsi_repos
|
|
|
|
set_fact:
|
|
|
|
ceph_iscsi_repos:
|
|
|
|
- ceph-iscsi-config
|
|
|
|
- tcmu-runner
|
2018-05-14 15:21:48 +08:00
|
|
|
- python-rtslib
|
2017-10-10 16:39:02 +08:00
|
|
|
when:
|
|
|
|
- ansible_os_family == 'RedHat'
|
|
|
|
- ceph_origin == 'repository'
|
|
|
|
- ceph_repository == 'dev'
|
|
|
|
- ceph_iscsi_config_dev
|
|
|
|
|
|
|
|
- name: fetch ceph-iscsi-config red hat development repository
|
|
|
|
uri:
|
|
|
|
url: https://shaman.ceph.com/api/repos/{{ item }}/{{ ceph_dev_branch }}/{{ ceph_dev_sha1 }}/{{ ansible_distribution | lower }}/{{ ansible_distribution_major_version }}/repo
|
|
|
|
return_content: yes
|
|
|
|
register: ceph_iscsi_config_dev_yum_repo
|
|
|
|
with_items: "{{ ceph_iscsi_repos }}"
|
|
|
|
when:
|
|
|
|
- ansible_os_family == 'RedHat'
|
|
|
|
- ceph_origin == 'repository'
|
|
|
|
- ceph_repository == 'dev'
|
|
|
|
- ceph_iscsi_config_dev
|
|
|
|
|
|
|
|
- name: configure ceph-iscsi-config red hat development repository
|
|
|
|
copy:
|
|
|
|
content: "{{ item.0.content }}"
|
|
|
|
dest: "/etc/yum.repos.d/{{ item.1 }}-dev.repo"
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
backup: yes
|
|
|
|
with_together:
|
|
|
|
- "{{ ceph_iscsi_config_dev_yum_repo.results }}"
|
|
|
|
- "{{ ceph_iscsi_repos }}"
|
|
|
|
when:
|
|
|
|
- ansible_os_family == 'RedHat'
|
|
|
|
- ceph_origin == 'repository'
|
|
|
|
- ceph_repository == 'dev'
|
|
|
|
- ceph_iscsi_config_dev
|
|
|
|
|
2017-10-09 21:30:54 +08:00
|
|
|
- name: install redhat ceph iscsi package
|
|
|
|
package:
|
|
|
|
name: "{{ item }}"
|
|
|
|
state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}"
|
|
|
|
with_items:
|
|
|
|
- tcmu-runner
|
|
|
|
- ceph-iscsi-config
|
|
|
|
- targetcli
|
2018-05-14 15:21:48 +08:00
|
|
|
- python-rtslib
|
2017-10-09 21:30:54 +08:00
|
|
|
when:
|
|
|
|
- ansible_os_family == 'RedHat'
|
|
|
|
|
2017-08-05 02:18:11 +08:00
|
|
|
- name: check the status of the target.service override
|
|
|
|
stat:
|
|
|
|
path: /etc/systemd/system/target.service
|
|
|
|
register: target
|
|
|
|
|
|
|
|
- name: mask the target service - preventing manual start
|
|
|
|
systemd:
|
|
|
|
name: target
|
|
|
|
masked: yes
|
|
|
|
enabled: no
|
|
|
|
when:
|
2018-05-14 23:39:25 +08:00
|
|
|
- target.stat.exists
|
|
|
|
- target.stat.islnk == False
|
2017-08-05 02:18:11 +08:00
|
|
|
|
|
|
|
- name: enable the rbd-target-gw service and make sure it is running
|
|
|
|
service:
|
|
|
|
name: rbd-target-gw
|
|
|
|
enabled: yes
|
|
|
|
state: started
|
|
|
|
|
|
|
|
- name: copy admin key
|
|
|
|
copy:
|
|
|
|
src: "{{ fetch_directory }}/{{ fsid }}/etc/ceph/{{ cluster }}.client.admin.keyring"
|
|
|
|
dest: "/etc/ceph/{{ cluster }}.client.admin.keyring"
|
2017-09-21 16:07:37 +08:00
|
|
|
owner: "root"
|
|
|
|
group: "root"
|
2017-08-05 02:18:11 +08:00
|
|
|
mode: "0600"
|
|
|
|
when:
|
|
|
|
- cephx
|
|
|
|
|
|
|
|
- name: deploy gateway settings, used by the ceph_iscsi_config modules
|
|
|
|
template:
|
|
|
|
src: "{{ role_path }}/templates/iscsi-gateway.cfg.j2"
|
|
|
|
dest: /etc/ceph/iscsi-gateway.cfg
|