ceph-ansible/roles/ceph-iscsi-gw/tasks/non-container/prerequisites.yml

94 lines
2.6 KiB
YAML

---
- name: red hat based systems tasks
when: ansible_os_family == 'RedHat'
block:
- name: set_fact common pkgs and repos
set_fact:
common_pkgs:
- tcmu-runner
- targetcli
- python-rtslib
common_repos:
- tcmu-runner
- python-rtslib
- name: set_fact base iscsi pkgs if new style ceph-iscsi
set_fact:
iscsi_base:
- ceph-iscsi
when: use_new_ceph_iscsi | bool
- 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
- name: set_fact ceph_iscsi_repos
set_fact:
ceph_iscsi_repos: "{{ common_repos + iscsi_base }}"
- name: set_fact ceph_iscsi_pkgs
set_fact:
ceph_iscsi_pkgs: "{{ common_pkgs + iscsi_base }}"
- name: when ceph_iscsi_config_dev is true
when:
- ceph_origin == 'repository'
- ceph_repository == 'dev'
- ceph_iscsi_config_dev | bool
block:
- name: fetch ceph-iscsi 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 }}"
- 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 }}"
- name: install ceph iscsi package
package:
name: "{{ item }}"
state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}"
register: result
until: result is succeeded
with_items:
- "{{ ceph_iscsi_pkgs }}"
- python-requests
- 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:
- target.stat.exists
- not target.stat.islnk
- name: start tcmu-runner, rbd-target-api and rbd-target-gw
service:
name: "{{ item }}"
state: started
enabled: yes
masked: no
with_items:
- tcmu-runner
- rbd-target-gw
- rbd-target-api