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

86 lines
2.7 KiB
YAML
Raw Normal View History

---
- 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
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: when ceph_iscsi_config_dev is true
when:
- ceph_origin == 'repository'
- ceph_repository in ['dev', 'community']
- ceph_iscsi_config_dev | bool
block:
- name: ceph-iscsi dependency repositories
get_url:
url: 'https://shaman.ceph.com/api/repos/{{ item }}/{{ ceph_dev_branch }}/{{ ceph_dev_sha1 }}/{{ ansible_distribution | lower }}/{{ ansible_distribution_major_version }}/repo'
dest: '/etc/yum.repos.d/{{ item }}-dev.repo'
force: true
with_items: "{{ common_repos }}"
- name: ceph-iscsi development repository
get_url:
url: 'https://shaman.ceph.com/api/repos/{{ item }}/{{ ceph_dev_branch }}/{{ ceph_dev_sha1 }}/{{ ansible_distribution | lower }}/{{ ansible_distribution_major_version }}/repo'
dest: '/etc/yum.repos.d/{{ item }}-dev.repo'
force: true
with_items: '{{ iscsi_base }}'
when: ceph_repository == 'dev'
- name: ceph-iscsi stable repository
get_url:
url: 'https://download.ceph.com/ceph-iscsi/{{ "3" if use_new_ceph_iscsi | bool else "2" }}/rpm/el{{ ansible_distribution_major_version }}/ceph-iscsi.repo'
dest: /etc/yum.repos.d/ceph-iscsi.repo
force: true
when: ceph_repository == 'community'
- name: install ceph iscsi package
package:
name: "{{ common_pkgs + iscsi_base }}"
state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}"
register: result
until: result is succeeded
- 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