mirror of https://github.com/ceph/ceph-ansible.git
use blocks directives to group tasks
Using block directives simplifies the playbooks and makes them more readable. Fixes: https://github.com/ceph/ceph-ansible/issues/2835 Signed-off-by: Rishabh Dave <ridave@redhat.com>pull/3283/head
parent
34275ac847
commit
8edbda96df
|
@ -493,19 +493,28 @@
|
|||
when: not is_atomic
|
||||
ignore_errors: true
|
||||
|
||||
- name: remove docker-py on Debian
|
||||
pip:
|
||||
name: docker-py
|
||||
state: absent
|
||||
when:
|
||||
- ansible_distribution == 'Debian'
|
||||
- name: debian based systems tasks
|
||||
block:
|
||||
- name: remove docker-py on debian
|
||||
pip:
|
||||
name: docker-py
|
||||
state: absent
|
||||
|
||||
- name: remove six on Debian
|
||||
pip:
|
||||
name: six
|
||||
state: absent
|
||||
when:
|
||||
- ansible_distribution == 'Debian'
|
||||
- name: remove six on debian
|
||||
pip:
|
||||
name: six
|
||||
state: absent
|
||||
|
||||
- name: remove pip and docker on debian
|
||||
apt:
|
||||
name: "{{ item }}"
|
||||
state: absent
|
||||
update_cache: yes
|
||||
autoremove: yes
|
||||
with_items:
|
||||
- python-pip
|
||||
- docker-engine
|
||||
when: ansible_distribution == 'Debian'
|
||||
|
||||
- name: remove pip and docker on ubuntu
|
||||
apt:
|
||||
|
@ -519,109 +528,75 @@
|
|||
- docker.io
|
||||
when: ansible_distribution == 'Ubuntu'
|
||||
|
||||
- name: remove pip and docker on debian
|
||||
apt:
|
||||
name: "{{ item }}"
|
||||
state: absent
|
||||
update_cache: yes
|
||||
autoremove: yes
|
||||
with_items:
|
||||
- python-pip
|
||||
- docker-engine
|
||||
when: ansible_distribution == 'Debian'
|
||||
- name: red hat based systems tasks
|
||||
block:
|
||||
- name: remove epel-release on redhat
|
||||
yum:
|
||||
name: epel-release
|
||||
state: absent
|
||||
|
||||
- name: remove epel-release on redhat
|
||||
yum:
|
||||
name: epel-release
|
||||
state: absent
|
||||
- name: yum related tasks on red hat
|
||||
block:
|
||||
- name: remove pip on redhat
|
||||
yum:
|
||||
name: "{{ item }}"
|
||||
state: absent
|
||||
with_items:
|
||||
- python-pip
|
||||
|
||||
- name: remove docker-engine on redhat
|
||||
yum:
|
||||
name: "{{ item }}"
|
||||
state: absent
|
||||
with_items:
|
||||
- docker-engine
|
||||
|
||||
# for CentOS
|
||||
- name: remove docker on redhat
|
||||
yum:
|
||||
name: "{{ item }}"
|
||||
state: absent
|
||||
with_items:
|
||||
- docker
|
||||
|
||||
- name: remove package dependencies on redhat
|
||||
command: yum -y autoremove
|
||||
args:
|
||||
warn: no
|
||||
|
||||
- name: remove package dependencies on redhat again
|
||||
command: yum -y autoremove
|
||||
args:
|
||||
warn: no
|
||||
when:
|
||||
ansible_pkg_mgr == "yum"
|
||||
|
||||
- name: dnf related tasks on red hat
|
||||
block:
|
||||
- name: remove pip and docker on redhat
|
||||
dnf:
|
||||
name: "{{ item }}"
|
||||
state: absent
|
||||
with_items:
|
||||
- python-pip
|
||||
- docker-engine
|
||||
- docker
|
||||
|
||||
- name: remove package dependencies on redhat
|
||||
command: dnf -y autoremove
|
||||
args:
|
||||
warn: no
|
||||
|
||||
- name: remove package dependencies on redhat again
|
||||
command: dnf -y autoremove
|
||||
args:
|
||||
warn: no
|
||||
when:
|
||||
ansible_pkg_mgr == "dnf"
|
||||
when:
|
||||
ansible_os_family == 'RedHat' and
|
||||
not is_atomic
|
||||
|
||||
- name: remove pip on redhat
|
||||
yum:
|
||||
name: "{{ item }}"
|
||||
state: absent
|
||||
with_items:
|
||||
- python-pip
|
||||
when:
|
||||
ansible_os_family == 'RedHat' and
|
||||
ansible_pkg_mgr == "yum" and
|
||||
not is_atomic
|
||||
|
||||
- name: remove docker-engine on redhat
|
||||
yum:
|
||||
name: "{{ item }}"
|
||||
state: absent
|
||||
with_items:
|
||||
- docker-engine
|
||||
when:
|
||||
ansible_os_family == 'RedHat' and
|
||||
ansible_pkg_mgr == "yum" and
|
||||
not is_atomic
|
||||
|
||||
# for CentOS
|
||||
- name: remove docker on redhat
|
||||
yum:
|
||||
name: "{{ item }}"
|
||||
state: absent
|
||||
with_items:
|
||||
- docker
|
||||
when:
|
||||
ansible_os_family == 'RedHat' and
|
||||
ansible_pkg_mgr == "yum" and
|
||||
not is_atomic
|
||||
|
||||
- name: remove pip and docker on redhat
|
||||
dnf:
|
||||
name: "{{ item }}"
|
||||
state: absent
|
||||
with_items:
|
||||
- python-pip
|
||||
- docker-engine
|
||||
- docker
|
||||
when:
|
||||
ansible_os_family == 'RedHat' and
|
||||
ansible_pkg_mgr == "dnf" and
|
||||
not is_atomic
|
||||
|
||||
- name: remove package dependencies on redhat
|
||||
command: yum -y autoremove
|
||||
args:
|
||||
warn: no
|
||||
when:
|
||||
ansible_os_family == 'RedHat' and
|
||||
ansible_pkg_mgr == "yum" and
|
||||
not is_atomic
|
||||
|
||||
- name: remove package dependencies on redhat again
|
||||
command: yum -y autoremove
|
||||
args:
|
||||
warn: no
|
||||
when:
|
||||
ansible_os_family == 'RedHat' and
|
||||
ansible_pkg_mgr == "yum" and
|
||||
not is_atomic
|
||||
|
||||
- name: remove package dependencies on redhat
|
||||
command: dnf -y autoremove
|
||||
args:
|
||||
warn: no
|
||||
when:
|
||||
ansible_os_family == 'RedHat' and
|
||||
ansible_pkg_mgr == "dnf" and
|
||||
not is_atomic
|
||||
|
||||
- name: remove package dependencies on redhat again
|
||||
command: dnf -y autoremove
|
||||
args:
|
||||
warn: no
|
||||
when:
|
||||
ansible_os_family == 'RedHat' and
|
||||
ansible_pkg_mgr == "dnf" and
|
||||
not is_atomic
|
||||
|
||||
|
||||
- name: purge ceph directories
|
||||
|
||||
hosts:
|
||||
|
|
|
@ -19,34 +19,36 @@
|
|||
# - Jewel from latest Canonical 16.04 distro
|
||||
# - All previous versions from Canonical
|
||||
# - Infernalis from ceph.com
|
||||
- name: check /etc/default/ceph exist
|
||||
stat:
|
||||
path: /etc/default/ceph
|
||||
register: etc_default_ceph
|
||||
check_mode: no
|
||||
when:
|
||||
- ansible_os_family == "Debian"
|
||||
- name: debian based systems - configure cluster name
|
||||
block:
|
||||
- name: check /etc/default/ceph exist
|
||||
stat:
|
||||
path: /etc/default/ceph
|
||||
register: etc_default_ceph
|
||||
check_mode: no
|
||||
|
||||
- name: configure cluster name
|
||||
lineinfile:
|
||||
dest: /etc/default/ceph
|
||||
insertafter: EOF
|
||||
create: yes
|
||||
regexp: "^CLUSTER="
|
||||
line: "CLUSTER={{ cluster }}"
|
||||
when:
|
||||
- ansible_os_family == "Debian"
|
||||
- etc_default_ceph.stat.exists
|
||||
- not etc_default_ceph.stat.isdir
|
||||
- name: configure cluster name
|
||||
block:
|
||||
- name: when /etc/default/ceph is not dir
|
||||
lineinfile:
|
||||
dest: /etc/default/ceph
|
||||
insertafter: EOF
|
||||
create: yes
|
||||
regexp: "^CLUSTER="
|
||||
line: "CLUSTER={{ cluster }}"
|
||||
when:
|
||||
- not etc_default_ceph.stat.isdir
|
||||
|
||||
- name: configure cluster name
|
||||
lineinfile:
|
||||
dest: /etc/default/ceph/ceph
|
||||
insertafter: EOF
|
||||
create: yes
|
||||
regexp: "^CLUSTER="
|
||||
line: "CLUSTER={{ cluster }}"
|
||||
- name: when /etc/default/ceph is dir
|
||||
lineinfile:
|
||||
dest: /etc/default/ceph/ceph
|
||||
insertafter: EOF
|
||||
create: yes
|
||||
regexp: "^CLUSTER="
|
||||
line: "CLUSTER={{ cluster }}"
|
||||
when:
|
||||
- etc_default_ceph.stat.isdir
|
||||
when:
|
||||
- etc_default_ceph.stat.exists
|
||||
when:
|
||||
- ansible_os_family == "Debian"
|
||||
- etc_default_ceph.stat.exists
|
||||
- etc_default_ceph.stat.isdir
|
||||
|
|
|
@ -11,11 +11,18 @@
|
|||
tags:
|
||||
- package-install
|
||||
|
||||
- name: include_tasks installs/install_on_debian.yml
|
||||
include_tasks: installs/install_on_debian.yml
|
||||
when: ansible_os_family == 'Debian'
|
||||
tags:
|
||||
- package-install
|
||||
- name: debian based systems tasks
|
||||
block:
|
||||
- name: include installs/install_on_debian.yml
|
||||
include_tasks: installs/install_on_debian.yml
|
||||
tags:
|
||||
- package-install
|
||||
- name: include ntp debian setup tasks
|
||||
include_tasks: "misc/ntp_debian.yml"
|
||||
when:
|
||||
- ntp_service_enabled
|
||||
when:
|
||||
- ansible_os_family == 'Debian'
|
||||
|
||||
- name: include_tasks installs/install_on_clear.yml
|
||||
include_tasks: installs/install_on_clear.yml
|
||||
|
|
|
@ -2,22 +2,39 @@
|
|||
- name: include remove_ceph_udev_rules.yml
|
||||
include_tasks: remove_ceph_udev_rules.yml
|
||||
|
||||
- name: include debian_prerequisites.yml
|
||||
include_tasks: debian_prerequisites.yml
|
||||
- name: debian based systems tasks
|
||||
block:
|
||||
- name: include debian_prerequisites.yml
|
||||
include_tasks: debian_prerequisites.yml
|
||||
tags:
|
||||
with_pkg
|
||||
- name: install python-six
|
||||
package:
|
||||
name: python-six
|
||||
state: present
|
||||
update_cache: yes
|
||||
tags:
|
||||
with_pkg
|
||||
when:
|
||||
- ansible_distribution == 'Debian'
|
||||
tags:
|
||||
with_pkg
|
||||
|
||||
- name: install docker on ubuntu
|
||||
package:
|
||||
name: docker.io
|
||||
state: present
|
||||
update_cache: yes
|
||||
- name: ubuntu based systems tasks
|
||||
block:
|
||||
- name: install docker on ubuntu
|
||||
package:
|
||||
name: docker.io
|
||||
state: present
|
||||
update_cache: yes
|
||||
tags:
|
||||
with_pkg
|
||||
- name: install python-docker on ubuntu
|
||||
package:
|
||||
name: python-docker
|
||||
state: present
|
||||
tags:
|
||||
with_pkg
|
||||
when:
|
||||
- ansible_distribution == 'Ubuntu'
|
||||
tags:
|
||||
with_pkg
|
||||
|
||||
# ensure extras enabled for docker
|
||||
- name: enable extras on centos
|
||||
|
@ -31,42 +48,22 @@
|
|||
tags:
|
||||
with_pkg
|
||||
|
||||
- name: install python-six
|
||||
package:
|
||||
name: python-six
|
||||
state: present
|
||||
update_cache: yes
|
||||
when:
|
||||
- ansible_distribution != 'Debian'
|
||||
tags:
|
||||
with_pkg
|
||||
|
||||
- name: install python-docker-py on red hat / centos
|
||||
package:
|
||||
name: python-docker-py
|
||||
state: present
|
||||
- name: red hat based systems tasks
|
||||
block:
|
||||
- name: install python-docker-py on red hat / centos
|
||||
package:
|
||||
name: python-docker-py
|
||||
state: present
|
||||
tags:
|
||||
with_pkg
|
||||
- name: install docker on red hat / centos
|
||||
package:
|
||||
name: docker
|
||||
state: present
|
||||
tags:
|
||||
with_pkg
|
||||
when:
|
||||
- ansible_os_family == 'RedHat'
|
||||
tags:
|
||||
with_pkg
|
||||
|
||||
- name: install python-docker on ubuntu
|
||||
package:
|
||||
name: python-docker
|
||||
state: present
|
||||
when:
|
||||
- ansible_distribution == 'Ubuntu'
|
||||
tags:
|
||||
with_pkg
|
||||
|
||||
- name: install docker on red hat / centos
|
||||
package:
|
||||
name: docker
|
||||
state: present
|
||||
when:
|
||||
- ansible_os_family == 'RedHat'
|
||||
tags:
|
||||
with_pkg
|
||||
|
||||
- name: pause after docker install before starting (on openstack vms)
|
||||
pause: seconds=5
|
||||
|
|
|
@ -1,55 +1,48 @@
|
|||
---
|
||||
- name: set_fact ceph_iscsi_repos
|
||||
set_fact:
|
||||
ceph_iscsi_repos:
|
||||
- ceph-iscsi-config
|
||||
- tcmu-runner
|
||||
- python-rtslib
|
||||
- ceph-iscsi-cli
|
||||
when:
|
||||
- ansible_os_family == 'RedHat'
|
||||
- ceph_origin == 'repository'
|
||||
- ceph_repository == 'dev'
|
||||
- ceph_iscsi_config_dev
|
||||
- name: red hat based systems tasks
|
||||
block:
|
||||
- name: when ceph_iscsi_config_dev is true
|
||||
block:
|
||||
- name: set_fact ceph_iscsi_repos
|
||||
set_fact:
|
||||
ceph_iscsi_repos:
|
||||
- ceph-iscsi-config
|
||||
- tcmu-runner
|
||||
- python-rtslib
|
||||
- ceph-iscsi-cli
|
||||
|
||||
- name: fetch ceph-iscsi-config red hat 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 }}"
|
||||
when:
|
||||
- ansible_os_family == 'RedHat'
|
||||
- ceph_origin == 'repository'
|
||||
- ceph_repository == 'dev'
|
||||
- ceph_iscsi_config_dev
|
||||
- name: fetch ceph-iscsi-config 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 red hat 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 }}"
|
||||
when:
|
||||
- ansible_os_family == 'RedHat'
|
||||
- ceph_origin == 'repository'
|
||||
- ceph_repository == 'dev'
|
||||
- ceph_iscsi_config_dev
|
||||
- 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 }}"
|
||||
when:
|
||||
- ceph_origin == 'repository'
|
||||
- ceph_repository == 'dev'
|
||||
- ceph_iscsi_config_dev
|
||||
|
||||
- name: install redhat ceph iscsi package
|
||||
package:
|
||||
name: "{{ item }}"
|
||||
state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}"
|
||||
with_items:
|
||||
- tcmu-runner
|
||||
- ceph-iscsi-config
|
||||
- targetcli
|
||||
- python-rtslib
|
||||
- ceph-iscsi-cli
|
||||
- name: install ceph iscsi package
|
||||
package:
|
||||
name: "{{ item }}"
|
||||
state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}"
|
||||
with_items:
|
||||
- tcmu-runner
|
||||
- ceph-iscsi-config
|
||||
- targetcli
|
||||
- python-rtslib
|
||||
- ceph-iscsi-cli
|
||||
when:
|
||||
- ansible_os_family == 'RedHat'
|
||||
|
||||
|
|
|
@ -1,119 +1,12 @@
|
|||
---
|
||||
- name: add nfs-ganesha stable repository
|
||||
yum_repository:
|
||||
name: nfs_ganesha_stable
|
||||
description: nfs-ganesha stable repo
|
||||
gpgcheck: yes
|
||||
state: present
|
||||
gpgkey: "{{ ceph_stable_key }}"
|
||||
baseurl: "{{ ceph_mirror }}/nfs-ganesha/rpm-{{ nfs_ganesha_stable_branch }}/{{ ceph_release }}/$basearch"
|
||||
- name: include red hat based system related tasks
|
||||
include_tasks: pre_requisite_non_container_red_hat.yml
|
||||
when:
|
||||
- ansible_os_family == 'RedHat'
|
||||
- nfs_ganesha_stable
|
||||
- ceph_origin == 'repository'
|
||||
- ceph_repository == 'community'
|
||||
|
||||
- name: fetch nfs-ganesha red hat development repository
|
||||
uri:
|
||||
url: https://shaman.ceph.com/api/repos/nfs-ganesha/next/latest/{{ ansible_distribution | lower }}/{{ ansible_distribution_major_version }}/flavors/{{ nfs_ganesha_flavor }}/repo
|
||||
return_content: yes
|
||||
register: nfs_ganesha_dev_yum_repo
|
||||
- name: include debian based system related tasks
|
||||
include_tasks: pre_requisite_non_container_debian.yml
|
||||
when:
|
||||
- ansible_os_family == 'RedHat'
|
||||
- nfs_ganesha_dev
|
||||
- ceph_origin == 'repository'
|
||||
- ceph_repository == 'dev'
|
||||
|
||||
- name: add nfs-ganesha development repository
|
||||
copy:
|
||||
content: "{{ nfs_ganesha_dev_yum_repo.content }}"
|
||||
dest: /etc/yum.repos.d/nfs-ganesha-dev.repo
|
||||
owner: root
|
||||
group: root
|
||||
backup: yes
|
||||
when:
|
||||
- ansible_os_family == 'RedHat'
|
||||
- nfs_ganesha_dev
|
||||
- ceph_origin == 'repository'
|
||||
- ceph_repository == 'dev'
|
||||
|
||||
- name: add nfs-ganesha stable repository
|
||||
apt_repository:
|
||||
repo: "deb {{ nfs_ganesha_stable_deb_repo }} {{ ceph_stable_distro_source | default(ansible_lsb.codename) }} main"
|
||||
state: present
|
||||
update_cache: no
|
||||
register: add_ganesha_apt_repo
|
||||
when:
|
||||
- ansible_os_family == 'Debian'
|
||||
- nfs_ganesha_stable
|
||||
- ceph_origin == 'repository'
|
||||
- ceph_repository == 'community'
|
||||
|
||||
- name: update apt cache
|
||||
apt:
|
||||
update_cache: yes
|
||||
register: update_ganesha_apt_cache
|
||||
retries: 5
|
||||
delay: 2
|
||||
until: update_ganesha_apt_cache | success
|
||||
when:
|
||||
- ansible_os_family == 'Debian'
|
||||
- nfs_ganesha_stable
|
||||
- ceph_origin == 'repository'
|
||||
- ceph_repository == 'community'
|
||||
- add_ganesha_apt_repo | changed
|
||||
|
||||
- name: fetch nfs-ganesha development repository
|
||||
uri:
|
||||
url: https://shaman.ceph.com/api/repos/nfs-ganesha/next/latest/{{ ansible_distribution | lower }}/{{ ansible_distribution_release }}/flavors/{{ nfs_ganesha_flavor }}/repo
|
||||
return_content: yes
|
||||
register: nfs_ganesha_apt_repo
|
||||
when:
|
||||
- ansible_os_family == 'Debian'
|
||||
- nfs_ganesha_dev
|
||||
- ceph_origin == 'repository'
|
||||
- ceph_repository == 'dev'
|
||||
|
||||
- name: add nfs-ganesha development repository
|
||||
copy:
|
||||
content: "{{ nfs_ganesha_dev_apt_repo.content }}"
|
||||
dest: /etc/apt/sources.list.d/nfs-ganesha-dev.list
|
||||
owner: root
|
||||
group: root
|
||||
backup: yes
|
||||
when:
|
||||
- ansible_os_family == 'Debian'
|
||||
- nfs_ganesha_dev
|
||||
- ceph_origin == 'repository'
|
||||
- ceph_repository == 'dev'
|
||||
|
||||
- name: install nfs cephfs gateway
|
||||
package:
|
||||
name: nfs-ganesha-ceph
|
||||
state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}"
|
||||
when:
|
||||
- nfs_file_gw
|
||||
- ansible_os_family == 'RedHat'
|
||||
|
||||
- name: install redhat nfs-ganesha-rgw and ceph-radosgw packages
|
||||
package:
|
||||
name: "{{ item }}"
|
||||
state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}"
|
||||
with_items:
|
||||
- nfs-ganesha-rgw
|
||||
- ceph-radosgw
|
||||
when:
|
||||
- nfs_obj_gw
|
||||
- ansible_os_family == 'RedHat'
|
||||
|
||||
- name: install jemalloc for debian
|
||||
apt:
|
||||
name: libjemalloc1
|
||||
state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}"
|
||||
update_cache: yes
|
||||
when:
|
||||
- (ceph_origin == 'repository' or ceph_origin == 'distro')
|
||||
- ceph_repository != 'rhcs'
|
||||
- ansible_os_family == 'Debian'
|
||||
|
||||
- name: install nfs rgw/cephfs gateway - suse
|
||||
|
@ -130,50 +23,6 @@
|
|||
- ansible_os_family == 'Suse'
|
||||
- item.install | bool
|
||||
|
||||
- name: install nfs rgw/cephfs gateway - debian
|
||||
apt:
|
||||
name: "{{ item.name }}"
|
||||
allow_unauthenticated: yes
|
||||
with_items:
|
||||
- { name: 'nfs-ganesha-rgw', install: "{{ nfs_obj_gw }}" }
|
||||
- { name: 'radosgw', install: "{{ nfs_obj_gw }}" }
|
||||
- { name: 'nfs-ganesha-ceph', install: "{{ nfs_file_gw }}" }
|
||||
when:
|
||||
- (ceph_origin == 'repository' or ceph_origin == 'distro')
|
||||
- ceph_repository != 'rhcs'
|
||||
- ansible_os_family == 'Debian'
|
||||
- item.install | bool
|
||||
|
||||
# debian_rhcs installation
|
||||
- name: install red hat storage nfs gateway for debian
|
||||
apt:
|
||||
name: nfs-ganesha
|
||||
state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}"
|
||||
when:
|
||||
- ansible_os_family == 'Debian'
|
||||
- (ceph_origin == 'repository' or ceph_origin == 'distro')
|
||||
- ceph_repository == 'rhcs'
|
||||
|
||||
- name: install red hat storage nfs file gateway
|
||||
apt:
|
||||
name: nfs-ganesha-ceph
|
||||
state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}"
|
||||
when:
|
||||
- ansible_os_family == 'Debian'
|
||||
- (ceph_origin == 'repository' or ceph_origin == 'distro')
|
||||
- ceph_repository == 'rhcs'
|
||||
- nfs_file_gw
|
||||
|
||||
- name: install red hat storage nfs obj gateway
|
||||
apt:
|
||||
name: nfs-ganesha-rgw
|
||||
state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}"
|
||||
when:
|
||||
- ansible_os_family == 'Debian'
|
||||
- (ceph_origin == 'repository' or ceph_origin == 'distro')
|
||||
- ceph_repository == 'rhcs'
|
||||
- nfs_obj_gw
|
||||
|
||||
# NOTE (leseb): we use root:ceph for permissions since ganesha
|
||||
# does not have the right selinux context to read ceph directories.
|
||||
- name: create rados gateway and ganesha directories
|
||||
|
@ -193,36 +42,37 @@
|
|||
when:
|
||||
- item.create|bool
|
||||
|
||||
- name: copy bootstrap cephx keys
|
||||
copy:
|
||||
src: "{{ fetch_directory }}/{{ fsid }}{{ item.name }}"
|
||||
dest: "{{ item.name }}"
|
||||
owner: "ceph"
|
||||
group: "ceph"
|
||||
mode: "0600"
|
||||
with_items:
|
||||
- { name: "/var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring", copy_key: "{{ nfs_obj_gw }}" }
|
||||
when:
|
||||
- cephx
|
||||
- item.copy_key|bool
|
||||
- name: cephx related tasks
|
||||
block:
|
||||
- name: copy bootstrap cephx keys
|
||||
copy:
|
||||
src: "{{ fetch_directory }}/{{ fsid }}{{ item.name }}"
|
||||
dest: "{{ item.name }}"
|
||||
owner: "ceph"
|
||||
group: "ceph"
|
||||
mode: "0600"
|
||||
with_items:
|
||||
- { name: "/var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring", copy_key: "{{ nfs_obj_gw }}" }
|
||||
when:
|
||||
- item.copy_key|bool
|
||||
|
||||
- name: create rados gateway keyring
|
||||
command: ceph --cluster {{ cluster }} --name client.bootstrap-rgw --keyring /var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring auth get-or-create client.rgw.{{ ansible_hostname }} osd 'allow rwx' mon 'allow rw' -o /var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ ansible_hostname }}/keyring
|
||||
args:
|
||||
creates: /var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ ansible_hostname }}/keyring
|
||||
changed_when: false
|
||||
when:
|
||||
- nfs_obj_gw
|
||||
- cephx
|
||||
- name: nfs object gateway related tasks
|
||||
block:
|
||||
- name: create rados gateway keyring
|
||||
command: ceph --cluster {{ cluster }} --name client.bootstrap-rgw --keyring /var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring auth get-or-create client.rgw.{{ ansible_hostname }} osd 'allow rwx' mon 'allow rw' -o /var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ ansible_hostname }}/keyring
|
||||
args:
|
||||
creates: /var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ ansible_hostname }}/keyring
|
||||
changed_when: false
|
||||
|
||||
- name: set rados gateway key permissions
|
||||
file:
|
||||
path: /var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ ansible_hostname }}/keyring
|
||||
owner: "ceph"
|
||||
group: "ceph"
|
||||
mode: "0600"
|
||||
- name: set rados gateway key permissions
|
||||
file:
|
||||
path: /var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ ansible_hostname }}/keyring
|
||||
owner: "ceph"
|
||||
group: "ceph"
|
||||
mode: "0600"
|
||||
when:
|
||||
- nfs_obj_gw
|
||||
when:
|
||||
- nfs_obj_gw
|
||||
- cephx
|
||||
|
||||
- name: change ownership on /var/log/ganesha
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
---
|
||||
- name: debian based systems - repo handling
|
||||
block:
|
||||
- name: stable repos specific tasks
|
||||
block:
|
||||
- name: add nfs-ganesha stable repository
|
||||
apt_repository:
|
||||
repo: "deb {{ nfs_ganesha_stable_deb_repo }} {{ ceph_stable_distro_source | default(ansible_lsb.codename) }} main"
|
||||
state: present
|
||||
update_cache: no
|
||||
register: add_ganesha_apt_repo
|
||||
|
||||
- name: update apt cache
|
||||
apt:
|
||||
update_cache: yes
|
||||
register: update_ganesha_apt_cache
|
||||
retries: 5
|
||||
delay: 2
|
||||
until: update_ganesha_apt_cache | success
|
||||
when:
|
||||
- add_ganesha_apt_repo | changed
|
||||
when:
|
||||
- nfs_ganesha_stable
|
||||
- ceph_repository == 'community'
|
||||
|
||||
- name: debian based systems - dev repos specific tasks
|
||||
block:
|
||||
- name: fetch nfs-ganesha development repository
|
||||
uri:
|
||||
url: https://shaman.ceph.com/api/repos/nfs-ganesha/next/latest/{{ ansible_distribution | lower }}/{{ ansible_distribution_release }}/flavors/{{ nfs_ganesha_flavor }}/repo
|
||||
return_content: yes
|
||||
register: nfs_ganesha_apt_repo
|
||||
|
||||
- name: add nfs-ganesha development repository
|
||||
copy:
|
||||
content: "{{ nfs_ganesha_dev_apt_repo.content }}"
|
||||
dest: /etc/apt/sources.list.d/nfs-ganesha-dev.list
|
||||
owner: root
|
||||
group: root
|
||||
backup: yes
|
||||
when:
|
||||
- nfs_ganesha_dev
|
||||
- ceph_repository == 'dev'
|
||||
when:
|
||||
- ceph_origin == 'repository'
|
||||
|
||||
- name: debain based systems - install required packages
|
||||
block:
|
||||
- name: debian based systems- non-rhcs installation
|
||||
block:
|
||||
- name: install jemalloc for debian
|
||||
apt:
|
||||
name: libjemalloc1
|
||||
state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}"
|
||||
update_cache: yes
|
||||
- name: install nfs rgw/cephfs gateway - debian
|
||||
apt:
|
||||
name: "{{ item.name }}"
|
||||
allow_unauthenticated: yes
|
||||
with_items:
|
||||
- { name: 'nfs-ganesha-rgw', install: "{{ nfs_obj_gw }}" }
|
||||
- { name: 'radosgw', install: "{{ nfs_obj_gw }}" }
|
||||
- { name: 'nfs-ganesha-ceph', install: "{{ nfs_file_gw }}" }
|
||||
when:
|
||||
- item.install | bool
|
||||
when:
|
||||
- (ceph_origin == 'repository' or ceph_origin == 'distro')
|
||||
- ceph_repository != 'rhcs'
|
||||
|
||||
- name: debian based systems - rhcs installation
|
||||
block:
|
||||
- name: install red hat storage nfs gateway for debian
|
||||
apt:
|
||||
name: nfs-ganesha
|
||||
state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}"
|
||||
- name: install red hat storage nfs file gateway
|
||||
apt:
|
||||
name: nfs-ganesha-ceph
|
||||
state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}"
|
||||
when:
|
||||
- nfs_file_gw
|
||||
- name: install red hat storage nfs obj gateway
|
||||
apt:
|
||||
name: nfs-ganesha-rgw
|
||||
state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}"
|
||||
when:
|
||||
- nfs_obj_gw
|
||||
when:
|
||||
- (ceph_origin == 'repository' or ceph_origin == 'distro')
|
||||
- ceph_repository == 'rhcs'
|
|
@ -0,0 +1,54 @@
|
|||
---
|
||||
- name: red hat based systems - repo handling
|
||||
block:
|
||||
- name: add nfs-ganesha stable repository
|
||||
yum_repository:
|
||||
name: nfs_ganesha_stable
|
||||
description: nfs-ganesha stable repo
|
||||
gpgcheck: yes
|
||||
state: present
|
||||
gpgkey: "{{ ceph_stable_key }}"
|
||||
baseurl: "{{ ceph_mirror }}/nfs-ganesha/rpm-{{ nfs_ganesha_stable_branch }}/{{ ceph_release }}/$basearch"
|
||||
when:
|
||||
- nfs_ganesha_stable
|
||||
- ceph_repository == 'community'
|
||||
|
||||
- name: red hat based systems - dev repo related tasks
|
||||
block:
|
||||
- name: fetch nfs-ganesha red hat development repository
|
||||
uri:
|
||||
url: https://shaman.ceph.com/api/repos/nfs-ganesha/next/latest/{{ ansible_distribution | lower }}/{{ ansible_distribution_major_version }}/flavors/{{ nfs_ganesha_flavor }}/repo
|
||||
return_content: yes
|
||||
register: nfs_ganesha_dev_yum_repo
|
||||
|
||||
- name: add nfs-ganesha development repository
|
||||
copy:
|
||||
content: "{{ nfs_ganesha_dev_yum_repo.content }}"
|
||||
dest: /etc/yum.repos.d/nfs-ganesha-dev.repo
|
||||
owner: root
|
||||
group: root
|
||||
backup: yes
|
||||
when:
|
||||
- nfs_ganesha_dev
|
||||
- ceph_repository == 'dev'
|
||||
when:
|
||||
- ceph_origin == 'repository'
|
||||
|
||||
- name: red hat based systems - install nfs packages
|
||||
block:
|
||||
- name: install nfs cephfs gateway
|
||||
package:
|
||||
name: nfs-ganesha-ceph
|
||||
state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}"
|
||||
when:
|
||||
- nfs_file_gw
|
||||
|
||||
- name: install redhat nfs-ganesha-rgw and ceph-radosgw packages
|
||||
package:
|
||||
name: "{{ item }}"
|
||||
state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}"
|
||||
with_items:
|
||||
- nfs-ganesha-rgw
|
||||
- ceph-radosgw
|
||||
when:
|
||||
- nfs_obj_gw
|
|
@ -1,21 +1,17 @@
|
|||
---
|
||||
- name: disable osd directory parsing by updatedb
|
||||
command: updatedb -e /var/lib/ceph
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
- name: debian based systems tasks
|
||||
block:
|
||||
- name: disable osd directory parsing by updatedb
|
||||
command: updatedb -e /var/lib/ceph
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
- name: disable osd directory path in updatedb.conf
|
||||
replace:
|
||||
dest: /etc/updatedb.conf
|
||||
regexp: '^(PRUNEPATHS(?!.*/var/lib/ceph).*)"$'
|
||||
replace: '\1 /var/lib/ceph"'
|
||||
failed_when: false
|
||||
when:
|
||||
- ansible_os_family == "Debian"
|
||||
- osd_objectstore == 'filestore'
|
||||
- ansible_os_family == "Debian"
|
||||
|
||||
- name: disable osd directory path in updatedb.conf
|
||||
replace:
|
||||
dest: /etc/updatedb.conf
|
||||
regexp: '^(PRUNEPATHS(?!.*/var/lib/ceph).*)"$'
|
||||
replace: '\1 /var/lib/ceph"'
|
||||
failed_when: false
|
||||
when:
|
||||
- ansible_os_family == "Debian"
|
||||
- osd_objectstore == 'filestore'
|
||||
- ansible_os_family == "Debian"
|
||||
|
||||
|
|
|
@ -17,33 +17,33 @@
|
|||
when:
|
||||
- ansible_os_family not in ['Debian', 'RedHat', 'ClearLinux', 'Suse']
|
||||
|
||||
- name: fail on unsupported distribution for red hat ceph storage
|
||||
fail:
|
||||
msg: "Distribution not supported {{ ansible_distribution_version }} by Red Hat Ceph Storage, only RHEL >= 7.3"
|
||||
when:
|
||||
- ansible_distribution == 'Red Hat Enterprise Linux'
|
||||
- ceph_repository == 'rhcs'
|
||||
- ansible_distribution_version is version_compare('7.3', '<')
|
||||
- name: red hat based systems tasks
|
||||
block:
|
||||
- name: fail on unsupported distribution for red hat ceph storage
|
||||
fail:
|
||||
msg: "Distribution not supported {{ ansible_distribution_version }} by Red Hat Ceph Storage, only RHEL >= 7.3"
|
||||
when:
|
||||
- ansible_distribution_version | version_compare('7.3', '<')
|
||||
|
||||
- name: determine if node is registered with subscription-manager
|
||||
command: subscription-manager identity
|
||||
register: subscription
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
check_mode: no
|
||||
when:
|
||||
- ansible_distribution == 'Red Hat Enterprise Linux'
|
||||
- ceph_repository == 'rhcs'
|
||||
- ceph_repository_type == 'cdn'
|
||||
- name: subscription manager related tasks
|
||||
block:
|
||||
- name: determine if node is registered with subscription-manager
|
||||
command: subscription-manager identity
|
||||
register: subscription
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
check_mode: no
|
||||
|
||||
- name: fail on unregistered red hat rhcs linux
|
||||
fail:
|
||||
msg: "You must register your machine with subscription-manager"
|
||||
- name: fail on unregistered red hat rhcs linux
|
||||
fail:
|
||||
msg: "You must register your machine with subscription-manager"
|
||||
when:
|
||||
- subscription.rc != '0'
|
||||
when:
|
||||
- ceph_repository_type == 'cdn'
|
||||
when:
|
||||
- ansible_distribution == 'Red Hat Enterprise Linux'
|
||||
- ceph_repository == 'rhcs'
|
||||
- ceph_repository_type == 'cdn'
|
||||
- subscription.rc != '0'
|
||||
- ansible_distribution == 'Red Hat Enterprise Linux'
|
||||
|
||||
- name: fail on unsupported distribution for ubuntu cloud archive
|
||||
fail:
|
||||
|
@ -78,19 +78,21 @@
|
|||
when:
|
||||
- ansible_service_mgr != 'systemd'
|
||||
|
||||
- name: fail on unsupported distribution for iscsi gateways
|
||||
fail:
|
||||
msg: "iSCSI gateways can only be deployed on Red Hat Enterprise Linux or CentOS"
|
||||
when:
|
||||
- ansible_distribution not in ['RedHat', 'CentOS']
|
||||
- iscsi_gw_group_name in group_names
|
||||
- name: check if iscsi gateways is target on supported distros and versions
|
||||
block:
|
||||
- name: fail on unsupported distribution for iscsi gateways
|
||||
fail:
|
||||
msg: "iSCSI gateways can only be deployed on Red Hat Enterprise Linux or CentOS"
|
||||
when:
|
||||
- ansible_distribution not in ['RedHat', 'CentOS']
|
||||
|
||||
- name: fail on unsupported distribution version for iscsi gateways
|
||||
fail:
|
||||
msg: "iSCSI gateways can only be deployed on Red Hat Enterprise Linux or CentOS >= 7.4"
|
||||
- name: fail on unsupported distribution version for iscsi gateways
|
||||
fail:
|
||||
msg: "iSCSI gateways can only be deployed on Red Hat Enterprise Linux or CentOS >= 7.4"
|
||||
when:
|
||||
- ansible_distribution_version < '7.4'
|
||||
- ansible_distribution in ['RedHat', 'CentOS']
|
||||
when:
|
||||
- ansible_distribution in ['RedHat', 'CentOS']
|
||||
- ansible_distribution_version < '7.4'
|
||||
- iscsi_gw_group_name in group_names
|
||||
|
||||
- name: warn users that ceph-disk scenarios will be removed on 3.3
|
||||
|
|
|
@ -10,23 +10,24 @@
|
|||
- mon_use_fqdn or mds_use_fqdn
|
||||
- not use_fqdn_yes_i_am_sure
|
||||
|
||||
- name: fail if local scenario is enabled on debian
|
||||
fail:
|
||||
msg: "'local' installation scenario not supported on Debian systems"
|
||||
- name: debian based systems tasks
|
||||
block:
|
||||
- name: fail if local scenario is enabled on debian
|
||||
fail:
|
||||
msg: "'local' installation scenario not supported on Debian systems"
|
||||
when:
|
||||
- ceph_origin == 'local'
|
||||
- name: verify that ceph_rhcs_cdn_debian_repo url is valid for red hat storage
|
||||
fail:
|
||||
msg: "ceph_rhcs_cdn_debian_repo url is invalid, please set your customername:customerpasswd"
|
||||
when:
|
||||
- ceph_origin == 'repository'
|
||||
- ceph_repository == 'rhcs'
|
||||
- ceph_repository_type == 'cdn'
|
||||
- ceph_rhcs_cdn_debian_repo == 'https://customername:customerpasswd@rhcs.download.redhat.com'
|
||||
- ceph_repository not in ['rhcs', 'dev', 'obs']
|
||||
when:
|
||||
- ansible_os_family == 'Debian'
|
||||
- ceph_origin == 'local'
|
||||
|
||||
- name: verify that ceph_rhcs_cdn_debian_repo url is valid for red hat storage
|
||||
fail:
|
||||
msg: "ceph_rhcs_cdn_debian_repo url is invalid, please set your customername:customerpasswd"
|
||||
when:
|
||||
- ceph_origin == 'repository'
|
||||
- ceph_repository == 'rhcs'
|
||||
- ceph_repository_type == 'cdn'
|
||||
- ansible_os_family == 'Debian'
|
||||
- ceph_rhcs_cdn_debian_repo == 'https://customername:customerpasswd@rhcs.download.redhat.com'
|
||||
- ceph_repository not in ['rhcs', 'dev', 'obs']
|
||||
|
||||
- name: validate ntp daemon type
|
||||
fail:
|
||||
|
|
|
@ -23,40 +23,30 @@
|
|||
when:
|
||||
- not is_atomic
|
||||
|
||||
- name: disable fastest mirror detection
|
||||
ini_file:
|
||||
path: /etc/yum/pluginconf.d/fastestmirror.conf
|
||||
section: main
|
||||
option: enabled
|
||||
value: 0
|
||||
when:
|
||||
- ansible_distribution == 'CentOS'
|
||||
- not is_atomic
|
||||
|
||||
- name: install epel
|
||||
package:
|
||||
name: epel-release
|
||||
state: present
|
||||
when:
|
||||
- ansible_distribution == 'CentOS'
|
||||
- not is_atomic
|
||||
|
||||
- name: enable local epel repository
|
||||
ini_file:
|
||||
path: /etc/yum.repos.d/epel.repo
|
||||
section: epel
|
||||
option: baseurl
|
||||
value: http://apt-mirror.front.sepia.ceph.com/epel7/
|
||||
when:
|
||||
- ansible_distribution == 'CentOS'
|
||||
- not is_atomic
|
||||
|
||||
- name: disable remote epel repository
|
||||
ini_file:
|
||||
path: /etc/yum.repos.d/epel.repo
|
||||
section: epel
|
||||
option: metalink
|
||||
state: absent
|
||||
- name: centos based systems - configure repos
|
||||
block:
|
||||
- name: disable fastest mirror detection
|
||||
ini_file:
|
||||
path: /etc/yum/pluginconf.d/fastestmirror.conf
|
||||
section: main
|
||||
option: enabled
|
||||
value: 0
|
||||
- name: install epel
|
||||
package:
|
||||
name: epel-release
|
||||
state: present
|
||||
- name: enable local epel repository
|
||||
ini_file:
|
||||
path: /etc/yum.repos.d/epel.repo
|
||||
section: epel
|
||||
option: baseurl
|
||||
value: http://apt-mirror.front.sepia.ceph.com/epel7/
|
||||
- name: disable remote epel repository
|
||||
ini_file:
|
||||
path: /etc/yum.repos.d/epel.repo
|
||||
section: epel
|
||||
option: metalink
|
||||
state: absent
|
||||
when:
|
||||
- ansible_distribution == 'CentOS'
|
||||
- not is_atomic
|
||||
|
|
Loading…
Reference in New Issue