2017-08-05 02:18:11 +08:00
|
|
|
---
|
2018-09-07 20:45:43 +08:00
|
|
|
- name: red hat based systems tasks
|
2019-04-01 23:46:15 +08:00
|
|
|
when: ansible_os_family == 'RedHat'
|
2018-09-07 20:45:43 +08:00
|
|
|
block:
|
2019-05-31 00:28:34 +08:00
|
|
|
- name: set_fact common pkgs and repos
|
|
|
|
set_fact:
|
|
|
|
common_pkgs:
|
|
|
|
- tcmu-runner
|
|
|
|
- targetcli
|
|
|
|
- python-rtslib
|
|
|
|
common_repos:
|
|
|
|
- tcmu-runner
|
|
|
|
- python-rtslib
|
2019-07-02 21:30:12 +08:00
|
|
|
|
2019-05-31 00:28:34 +08:00
|
|
|
- name: set_fact base iscsi pkgs if new style ceph-iscsi
|
|
|
|
set_fact:
|
|
|
|
iscsi_base:
|
|
|
|
- ceph-iscsi
|
|
|
|
when: use_new_ceph_iscsi | bool
|
2019-07-02 21:30:12 +08:00
|
|
|
|
2019-05-31 00:28:34 +08:00
|
|
|
- name: set_fact base iscsi pkgs if using older ceph-iscsi-config
|
|
|
|
set_fact:
|
|
|
|
iscsi_base:
|
|
|
|
- ceph-iscsi-cli
|
|
|
|
- ceph-iscsi-config
|
|
|
|
when: not use_new_ceph_iscsi | bool
|
2019-07-02 21:30:12 +08:00
|
|
|
|
2019-05-31 00:28:34 +08:00
|
|
|
- name: set_fact ceph_iscsi_repos
|
|
|
|
set_fact:
|
|
|
|
ceph_iscsi_repos: "{{ common_repos + iscsi_base }}"
|
2019-07-02 21:30:12 +08:00
|
|
|
|
2019-05-31 00:28:34 +08:00
|
|
|
- name: set_fact ceph_iscsi_pkgs
|
|
|
|
set_fact:
|
|
|
|
ceph_iscsi_pkgs: "{{ common_pkgs + iscsi_base }}"
|
2019-07-02 21:30:12 +08:00
|
|
|
|
2018-09-07 20:45:43 +08:00
|
|
|
- name: when ceph_iscsi_config_dev is true
|
2019-03-28 16:13:30 +08:00
|
|
|
when:
|
|
|
|
- ceph_origin == 'repository'
|
|
|
|
- ceph_repository == 'dev'
|
2019-05-22 16:02:42 +08:00
|
|
|
- ceph_iscsi_config_dev | bool
|
2018-09-07 20:45:43 +08:00
|
|
|
block:
|
2019-05-31 00:28:34 +08:00
|
|
|
- name: fetch ceph-iscsi development repository
|
2018-09-07 20:45:43 +08:00
|
|
|
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 }}"
|
2017-10-10 16:39:02 +08:00
|
|
|
|
2018-09-07 20:45:43 +08:00
|
|
|
- name: configure ceph-iscsi-config 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 }}"
|
2017-10-10 16:39:02 +08:00
|
|
|
|
2018-09-07 20:45:43 +08:00
|
|
|
- name: install ceph iscsi package
|
|
|
|
package:
|
|
|
|
name: "{{ item }}"
|
|
|
|
state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}"
|
2018-12-19 21:55:01 +08:00
|
|
|
register: result
|
|
|
|
until: result is succeeded
|
2019-09-25 20:20:48 +08:00
|
|
|
with_items:
|
|
|
|
- "{{ ceph_iscsi_pkgs }}"
|
|
|
|
- python-requests
|
2017-10-09 21:30:54 +08:00
|
|
|
|
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
|
2018-11-01 21:02:55 +08:00
|
|
|
- not target.stat.islnk
|
2017-08-05 02:18:11 +08:00
|
|
|
|
2019-04-23 22:08:30 +08:00
|
|
|
- name: start tcmu-runner, rbd-target-api and rbd-target-gw
|
2017-08-05 02:18:11 +08:00
|
|
|
service:
|
2019-04-23 22:08:30 +08:00
|
|
|
name: "{{ item }}"
|
2017-08-05 02:18:11 +08:00
|
|
|
state: started
|
2018-08-09 00:14:09 +08:00
|
|
|
enabled: yes
|
2019-03-20 18:35:36 +08:00
|
|
|
masked: no
|
2019-04-23 22:08:30 +08:00
|
|
|
with_items:
|
|
|
|
- tcmu-runner
|
|
|
|
- rbd-target-gw
|
|
|
|
- rbd-target-api
|