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

85 lines
2.8 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
- 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
# Only start tcmu-runner, so configure_iscsi.yml can create disks.
# We must start rbd-target-gw/api after configure_iscsi.yml to avoid
# races where they are both trying to setup the same object during
# a rolling update.
- name: start tcmu-runner
service:
name: tcmu-runner
state: started
enabled: yes
masked: no