2017-08-05 02:18:11 +08:00
|
|
|
---
|
2018-09-07 20:45:43 +08:00
|
|
|
- name: red hat based systems tasks
|
2021-03-03 22:43:50 +08:00
|
|
|
when: ansible_facts['os_family'] == 'RedHat'
|
2018-09-07 20:45:43 +08:00
|
|
|
block:
|
2021-03-23 18:25:51 +08:00
|
|
|
- name: set_fact common_pkgs
|
2019-05-31 00:28:34 +08:00
|
|
|
set_fact:
|
|
|
|
common_pkgs:
|
|
|
|
- tcmu-runner
|
|
|
|
- targetcli
|
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
|
|
|
|
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'
|
2019-10-21 22:32:55 +08:00
|
|
|
- ceph_repository in ['dev', 'community']
|
2019-05-22 16:02:42 +08:00
|
|
|
- ceph_iscsi_config_dev | bool
|
2018-09-07 20:45:43 +08:00
|
|
|
block:
|
2021-03-23 18:25:51 +08:00
|
|
|
- name: get latest available build for tcmu-runner
|
|
|
|
uri:
|
|
|
|
url: "https://shaman.ceph.com/api/search/?status=ready&project=tcmu-runner&flavor=default&distros=centos/{{ ansible_facts['distribution_major_version'] }}/{{ ansible_facts['architecture'] }}&ref={{ ceph_dev_branch }}&sha1={{ ceph_dev_sha1 }}"
|
|
|
|
return_content: yes
|
|
|
|
run_once: true
|
|
|
|
register: latest_build_tcmu_runner
|
|
|
|
|
|
|
|
- name: fetch ceph red hat development repository for tcmu-runner
|
|
|
|
uri:
|
|
|
|
# Use the centos repo since we don't currently have a dedicated red hat repo
|
|
|
|
url: "{{ (latest_build_tcmu_runner.content | from_json)[0]['chacra_url'] }}repo"
|
|
|
|
return_content: yes
|
|
|
|
register: ceph_dev_yum_repo_tcmu_runner
|
|
|
|
|
|
|
|
- name: configure ceph red hat development repository for tcmu-runner
|
|
|
|
copy:
|
|
|
|
content: "{{ ceph_dev_yum_repo_tcmu_runner.content }}"
|
|
|
|
dest: '/etc/yum.repos.d/tcmu-runner-dev.repo'
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
backup: yes
|
|
|
|
|
|
|
|
- name: get latest available build for ceph-iscsi
|
|
|
|
uri:
|
|
|
|
url: "https://shaman.ceph.com/api/search/?status=ready&project={{ item }}&flavor=default&distros=centos/{{ ansible_facts['distribution_major_version'] }}/noarch&ref={{ ceph_dev_branch }}&sha1={{ ceph_dev_sha1 }}"
|
|
|
|
return_content: yes
|
|
|
|
run_once: true
|
|
|
|
register: latest_build_ceph_iscsi
|
|
|
|
with_items: "{{ iscsi_base }}"
|
|
|
|
|
|
|
|
- name: fetch ceph red hat development repository for ceph-iscsi
|
|
|
|
uri:
|
|
|
|
# Use the centos repo since we don't currently have a dedicated red hat repo
|
|
|
|
url: "{{ (item.content | from_json)[0]['chacra_url'] }}repo"
|
|
|
|
return_content: yes
|
|
|
|
register: ceph_dev_yum_repo_ceph_iscsi
|
|
|
|
with_items: "{{ latest_build_ceph_iscsi.results }}"
|
|
|
|
|
|
|
|
- name: configure ceph red hat development repository for tcmu-runner
|
|
|
|
copy:
|
|
|
|
content: "{{ item.content }}"
|
|
|
|
dest: '/etc/yum.repos.d/{{ item.item.item }}-dev.repo'
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
backup: yes
|
|
|
|
with_items: '{{ ceph_dev_yum_repo_ceph_iscsi.results }}'
|
2017-10-10 16:39:02 +08:00
|
|
|
|
2019-10-21 22:32:55 +08:00
|
|
|
- name: ceph-iscsi stable repository
|
|
|
|
get_url:
|
2021-03-03 22:43:50 +08:00
|
|
|
url: "https://download.ceph.com/ceph-iscsi/{{ '3' if use_new_ceph_iscsi | bool else '2' }}/rpm/el{{ ansible_facts['distribution_major_version'] }}/ceph-iscsi.repo"
|
2019-10-21 22:32:55 +08:00
|
|
|
dest: /etc/yum.repos.d/ceph-iscsi.repo
|
|
|
|
force: true
|
2020-08-20 00:11:02 +08:00
|
|
|
register: result
|
|
|
|
until: result is succeeded
|
2019-10-21 22:32:55 +08:00
|
|
|
when: ceph_repository == 'community'
|
2017-10-10 16:39:02 +08:00
|
|
|
|
2018-09-07 20:45:43 +08:00
|
|
|
- name: install ceph iscsi package
|
|
|
|
package:
|
2019-10-21 22:32:55 +08:00
|
|
|
name: "{{ common_pkgs + iscsi_base }}"
|
2018-09-07 20:45:43 +08:00
|
|
|
state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}"
|
2018-12-19 21:55:01 +08:00
|
|
|
register: result
|
|
|
|
until: result is succeeded
|
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
|
|
|
|
2020-01-29 06:31:55 +08:00
|
|
|
# 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
|
2017-08-05 02:18:11 +08:00
|
|
|
service:
|
2020-01-29 06:31:55 +08:00
|
|
|
name: tcmu-runner
|
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
|