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
Rishabh Dave 2018-09-07 18:15:43 +05:30 committed by Sébastien Han
parent 34275ac847
commit 8edbda96df
12 changed files with 474 additions and 517 deletions

View File

@ -493,19 +493,28 @@
when: not is_atomic when: not is_atomic
ignore_errors: true ignore_errors: true
- name: remove docker-py on Debian - name: debian based systems tasks
block:
- name: remove docker-py on debian
pip: pip:
name: docker-py name: docker-py
state: absent state: absent
when:
- ansible_distribution == 'Debian'
- name: remove six on Debian - name: remove six on debian
pip: pip:
name: six name: six
state: absent state: absent
when:
- ansible_distribution == 'Debian' - 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 - name: remove pip and docker on ubuntu
apt: apt:
@ -519,35 +528,21 @@
- docker.io - docker.io
when: ansible_distribution == 'Ubuntu' when: ansible_distribution == 'Ubuntu'
- name: remove pip and docker on debian - name: red hat based systems tasks
apt: block:
name: "{{ item }}"
state: absent
update_cache: yes
autoremove: yes
with_items:
- python-pip
- docker-engine
when: ansible_distribution == 'Debian'
- name: remove epel-release on redhat - name: remove epel-release on redhat
yum: yum:
name: epel-release name: epel-release
state: absent state: absent
when:
ansible_os_family == 'RedHat' and
not is_atomic
- name: yum related tasks on red hat
block:
- name: remove pip on redhat - name: remove pip on redhat
yum: yum:
name: "{{ item }}" name: "{{ item }}"
state: absent state: absent
with_items: with_items:
- python-pip - python-pip
when:
ansible_os_family == 'RedHat' and
ansible_pkg_mgr == "yum" and
not is_atomic
- name: remove docker-engine on redhat - name: remove docker-engine on redhat
yum: yum:
@ -555,10 +550,6 @@
state: absent state: absent
with_items: with_items:
- docker-engine - docker-engine
when:
ansible_os_family == 'RedHat' and
ansible_pkg_mgr == "yum" and
not is_atomic
# for CentOS # for CentOS
- name: remove docker on redhat - name: remove docker on redhat
@ -567,11 +558,21 @@
state: absent state: absent
with_items: with_items:
- docker - docker
when:
ansible_os_family == 'RedHat' and
ansible_pkg_mgr == "yum" and
not is_atomic
- 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 - name: remove pip and docker on redhat
dnf: dnf:
name: "{{ item }}" name: "{{ item }}"
@ -580,48 +581,22 @@
- python-pip - python-pip
- docker-engine - docker-engine
- docker - 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 - name: remove package dependencies on redhat
command: dnf -y autoremove command: dnf -y autoremove
args: args:
warn: no warn: no
when:
ansible_os_family == 'RedHat' and
ansible_pkg_mgr == "dnf" and
not is_atomic
- name: remove package dependencies on redhat again - name: remove package dependencies on redhat again
command: dnf -y autoremove command: dnf -y autoremove
args: args:
warn: no warn: no
when:
ansible_pkg_mgr == "dnf"
when: when:
ansible_os_family == 'RedHat' and ansible_os_family == 'RedHat' and
ansible_pkg_mgr == "dnf" and
not is_atomic not is_atomic
- name: purge ceph directories - name: purge ceph directories
hosts: hosts:

View File

@ -19,15 +19,17 @@
# - Jewel from latest Canonical 16.04 distro # - Jewel from latest Canonical 16.04 distro
# - All previous versions from Canonical # - All previous versions from Canonical
# - Infernalis from ceph.com # - Infernalis from ceph.com
- name: debian based systems - configure cluster name
block:
- name: check /etc/default/ceph exist - name: check /etc/default/ceph exist
stat: stat:
path: /etc/default/ceph path: /etc/default/ceph
register: etc_default_ceph register: etc_default_ceph
check_mode: no check_mode: no
when:
- ansible_os_family == "Debian"
- name: configure cluster name - name: configure cluster name
block:
- name: when /etc/default/ceph is not dir
lineinfile: lineinfile:
dest: /etc/default/ceph dest: /etc/default/ceph
insertafter: EOF insertafter: EOF
@ -35,11 +37,9 @@
regexp: "^CLUSTER=" regexp: "^CLUSTER="
line: "CLUSTER={{ cluster }}" line: "CLUSTER={{ cluster }}"
when: when:
- ansible_os_family == "Debian"
- etc_default_ceph.stat.exists
- not etc_default_ceph.stat.isdir - not etc_default_ceph.stat.isdir
- name: configure cluster name - name: when /etc/default/ceph is dir
lineinfile: lineinfile:
dest: /etc/default/ceph/ceph dest: /etc/default/ceph/ceph
insertafter: EOF insertafter: EOF
@ -47,6 +47,8 @@
regexp: "^CLUSTER=" regexp: "^CLUSTER="
line: "CLUSTER={{ cluster }}" line: "CLUSTER={{ cluster }}"
when: when:
- ansible_os_family == "Debian"
- etc_default_ceph.stat.exists
- etc_default_ceph.stat.isdir - etc_default_ceph.stat.isdir
when:
- etc_default_ceph.stat.exists
when:
- ansible_os_family == "Debian"

View File

@ -11,11 +11,18 @@
tags: tags:
- package-install - package-install
- name: include_tasks installs/install_on_debian.yml - name: debian based systems tasks
block:
- name: include installs/install_on_debian.yml
include_tasks: installs/install_on_debian.yml include_tasks: installs/install_on_debian.yml
when: ansible_os_family == 'Debian'
tags: tags:
- package-install - 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 - name: include_tasks installs/install_on_clear.yml
include_tasks: installs/install_on_clear.yml include_tasks: installs/install_on_clear.yml

View File

@ -2,22 +2,39 @@
- name: include remove_ceph_udev_rules.yml - name: include remove_ceph_udev_rules.yml
include_tasks: remove_ceph_udev_rules.yml include_tasks: remove_ceph_udev_rules.yml
- name: debian based systems tasks
block:
- name: include debian_prerequisites.yml - name: include debian_prerequisites.yml
include_tasks: debian_prerequisites.yml include_tasks: debian_prerequisites.yml
when:
- ansible_distribution == 'Debian'
tags: tags:
with_pkg with_pkg
- name: install python-six
package:
name: python-six
state: present
update_cache: yes
tags:
with_pkg
when:
- ansible_distribution == 'Debian'
- name: ubuntu based systems tasks
block:
- name: install docker on ubuntu - name: install docker on ubuntu
package: package:
name: docker.io name: docker.io
state: present state: present
update_cache: yes update_cache: yes
when:
- ansible_distribution == 'Ubuntu'
tags: tags:
with_pkg with_pkg
- name: install python-docker on ubuntu
package:
name: python-docker
state: present
tags:
with_pkg
when:
- ansible_distribution == 'Ubuntu'
# ensure extras enabled for docker # ensure extras enabled for docker
- name: enable extras on centos - name: enable extras on centos
@ -31,42 +48,22 @@
tags: tags:
with_pkg with_pkg
- name: install python-six - name: red hat based systems tasks
package: block:
name: python-six
state: present
update_cache: yes
when:
- ansible_distribution != 'Debian'
tags:
with_pkg
- name: install python-docker-py on red hat / centos - name: install python-docker-py on red hat / centos
package: package:
name: python-docker-py name: python-docker-py
state: present state: present
when:
- ansible_os_family == 'RedHat'
tags: tags:
with_pkg 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 - name: install docker on red hat / centos
package: package:
name: docker name: docker
state: present state: present
when:
- ansible_os_family == 'RedHat'
tags: tags:
with_pkg with_pkg
when:
- ansible_os_family == 'RedHat'
- name: pause after docker install before starting (on openstack vms) - name: pause after docker install before starting (on openstack vms)
pause: seconds=5 pause: seconds=5

View File

@ -1,4 +1,8 @@
--- ---
- name: red hat based systems tasks
block:
- name: when ceph_iscsi_config_dev is true
block:
- name: set_fact ceph_iscsi_repos - name: set_fact ceph_iscsi_repos
set_fact: set_fact:
ceph_iscsi_repos: ceph_iscsi_repos:
@ -6,25 +10,15 @@
- tcmu-runner - tcmu-runner
- python-rtslib - python-rtslib
- ceph-iscsi-cli - ceph-iscsi-cli
when:
- ansible_os_family == 'RedHat'
- ceph_origin == 'repository'
- ceph_repository == 'dev'
- ceph_iscsi_config_dev
- name: fetch ceph-iscsi-config red hat development repository - name: fetch ceph-iscsi-config development repository
uri: uri:
url: https://shaman.ceph.com/api/repos/{{ item }}/{{ ceph_dev_branch }}/{{ ceph_dev_sha1 }}/{{ ansible_distribution | lower }}/{{ ansible_distribution_major_version }}/repo 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 return_content: yes
register: ceph_iscsi_config_dev_yum_repo register: ceph_iscsi_config_dev_yum_repo
with_items: "{{ ceph_iscsi_repos }}" with_items: "{{ ceph_iscsi_repos }}"
when:
- ansible_os_family == 'RedHat'
- ceph_origin == 'repository'
- ceph_repository == 'dev'
- ceph_iscsi_config_dev
- name: configure ceph-iscsi-config red hat development repository - name: configure ceph-iscsi-config development repository
copy: copy:
content: "{{ item.0.content }}" content: "{{ item.0.content }}"
dest: "/etc/yum.repos.d/{{ item.1 }}-dev.repo" dest: "/etc/yum.repos.d/{{ item.1 }}-dev.repo"
@ -35,12 +29,11 @@
- "{{ ceph_iscsi_config_dev_yum_repo.results }}" - "{{ ceph_iscsi_config_dev_yum_repo.results }}"
- "{{ ceph_iscsi_repos }}" - "{{ ceph_iscsi_repos }}"
when: when:
- ansible_os_family == 'RedHat'
- ceph_origin == 'repository' - ceph_origin == 'repository'
- ceph_repository == 'dev' - ceph_repository == 'dev'
- ceph_iscsi_config_dev - ceph_iscsi_config_dev
- name: install redhat ceph iscsi package - name: install ceph iscsi package
package: package:
name: "{{ item }}" name: "{{ item }}"
state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}" state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}"

View File

@ -1,119 +1,12 @@
--- ---
- name: add nfs-ganesha stable repository - name: include red hat based system related tasks
yum_repository: include_tasks: pre_requisite_non_container_red_hat.yml
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: when:
- ansible_os_family == 'RedHat' - ansible_os_family == 'RedHat'
- nfs_ganesha_stable
- ceph_origin == 'repository'
- ceph_repository == 'community'
- name: fetch nfs-ganesha red hat development repository - name: include debian based system related tasks
uri: include_tasks: pre_requisite_non_container_debian.yml
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
when: 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' - ansible_os_family == 'Debian'
- name: install nfs rgw/cephfs gateway - suse - name: install nfs rgw/cephfs gateway - suse
@ -130,50 +23,6 @@
- ansible_os_family == 'Suse' - ansible_os_family == 'Suse'
- item.install | bool - 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 # NOTE (leseb): we use root:ceph for permissions since ganesha
# does not have the right selinux context to read ceph directories. # does not have the right selinux context to read ceph directories.
- name: create rados gateway and ganesha directories - name: create rados gateway and ganesha directories
@ -193,6 +42,8 @@
when: when:
- item.create|bool - item.create|bool
- name: cephx related tasks
block:
- name: copy bootstrap cephx keys - name: copy bootstrap cephx keys
copy: copy:
src: "{{ fetch_directory }}/{{ fsid }}{{ item.name }}" src: "{{ fetch_directory }}/{{ fsid }}{{ item.name }}"
@ -203,17 +54,15 @@
with_items: with_items:
- { name: "/var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring", copy_key: "{{ nfs_obj_gw }}" } - { name: "/var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring", copy_key: "{{ nfs_obj_gw }}" }
when: when:
- cephx
- item.copy_key|bool - item.copy_key|bool
- name: nfs object gateway related tasks
block:
- name: create rados gateway keyring - 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 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: args:
creates: /var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ ansible_hostname }}/keyring creates: /var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ ansible_hostname }}/keyring
changed_when: false changed_when: false
when:
- nfs_obj_gw
- cephx
- name: set rados gateway key permissions - name: set rados gateway key permissions
file: file:
@ -223,6 +72,7 @@
mode: "0600" mode: "0600"
when: when:
- nfs_obj_gw - nfs_obj_gw
when:
- cephx - cephx
- name: change ownership on /var/log/ganesha - name: change ownership on /var/log/ganesha

View File

@ -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'

View File

@ -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

View File

@ -1,13 +1,10 @@
--- ---
- name: debian based systems tasks
block:
- name: disable osd directory parsing by updatedb - name: disable osd directory parsing by updatedb
command: updatedb -e /var/lib/ceph command: updatedb -e /var/lib/ceph
changed_when: false changed_when: false
failed_when: false failed_when: false
when:
- ansible_os_family == "Debian"
- osd_objectstore == 'filestore'
- ansible_os_family == "Debian"
- name: disable osd directory path in updatedb.conf - name: disable osd directory path in updatedb.conf
replace: replace:
dest: /etc/updatedb.conf dest: /etc/updatedb.conf
@ -15,7 +12,6 @@
replace: '\1 /var/lib/ceph"' replace: '\1 /var/lib/ceph"'
failed_when: false failed_when: false
when: when:
- ansible_os_family == "Debian"
- osd_objectstore == 'filestore' - osd_objectstore == 'filestore'
- ansible_os_family == "Debian" - ansible_os_family == "Debian"

View File

@ -17,33 +17,33 @@
when: when:
- ansible_os_family not in ['Debian', 'RedHat', 'ClearLinux', 'Suse'] - ansible_os_family not in ['Debian', 'RedHat', 'ClearLinux', 'Suse']
- name: red hat based systems tasks
block:
- name: fail on unsupported distribution for red hat ceph storage - name: fail on unsupported distribution for red hat ceph storage
fail: fail:
msg: "Distribution not supported {{ ansible_distribution_version }} by Red Hat Ceph Storage, only RHEL >= 7.3" msg: "Distribution not supported {{ ansible_distribution_version }} by Red Hat Ceph Storage, only RHEL >= 7.3"
when: when:
- ansible_distribution == 'Red Hat Enterprise Linux' - ansible_distribution_version | version_compare('7.3', '<')
- ceph_repository == 'rhcs'
- ansible_distribution_version is version_compare('7.3', '<')
- name: subscription manager related tasks
block:
- name: determine if node is registered with subscription-manager - name: determine if node is registered with subscription-manager
command: subscription-manager identity command: subscription-manager identity
register: subscription register: subscription
changed_when: false changed_when: false
failed_when: false failed_when: false
check_mode: no check_mode: no
when:
- ansible_distribution == 'Red Hat Enterprise Linux'
- ceph_repository == 'rhcs'
- ceph_repository_type == 'cdn'
- name: fail on unregistered red hat rhcs linux - name: fail on unregistered red hat rhcs linux
fail: fail:
msg: "You must register your machine with subscription-manager" msg: "You must register your machine with subscription-manager"
when: when:
- ansible_distribution == 'Red Hat Enterprise Linux'
- ceph_repository == 'rhcs'
- ceph_repository_type == 'cdn'
- subscription.rc != '0' - subscription.rc != '0'
when:
- ceph_repository_type == 'cdn'
when:
- ceph_repository == 'rhcs'
- ansible_distribution == 'Red Hat Enterprise Linux'
- name: fail on unsupported distribution for ubuntu cloud archive - name: fail on unsupported distribution for ubuntu cloud archive
fail: fail:
@ -78,19 +78,21 @@
when: when:
- ansible_service_mgr != 'systemd' - ansible_service_mgr != 'systemd'
- name: check if iscsi gateways is target on supported distros and versions
block:
- name: fail on unsupported distribution for iscsi gateways - name: fail on unsupported distribution for iscsi gateways
fail: fail:
msg: "iSCSI gateways can only be deployed on Red Hat Enterprise Linux or CentOS" msg: "iSCSI gateways can only be deployed on Red Hat Enterprise Linux or CentOS"
when: when:
- ansible_distribution not in ['RedHat', 'CentOS'] - ansible_distribution not in ['RedHat', 'CentOS']
- iscsi_gw_group_name in group_names
- name: fail on unsupported distribution version for iscsi gateways - name: fail on unsupported distribution version for iscsi gateways
fail: fail:
msg: "iSCSI gateways can only be deployed on Red Hat Enterprise Linux or CentOS >= 7.4" msg: "iSCSI gateways can only be deployed on Red Hat Enterprise Linux or CentOS >= 7.4"
when: when:
- ansible_distribution in ['RedHat', 'CentOS']
- ansible_distribution_version < '7.4' - ansible_distribution_version < '7.4'
- ansible_distribution in ['RedHat', 'CentOS']
when:
- iscsi_gw_group_name in group_names - iscsi_gw_group_name in group_names
- name: warn users that ceph-disk scenarios will be removed on 3.3 - name: warn users that ceph-disk scenarios will be removed on 3.3

View File

@ -10,13 +10,13 @@
- mon_use_fqdn or mds_use_fqdn - mon_use_fqdn or mds_use_fqdn
- not use_fqdn_yes_i_am_sure - not use_fqdn_yes_i_am_sure
- name: debian based systems tasks
block:
- name: fail if local scenario is enabled on debian - name: fail if local scenario is enabled on debian
fail: fail:
msg: "'local' installation scenario not supported on Debian systems" msg: "'local' installation scenario not supported on Debian systems"
when: when:
- ansible_os_family == 'Debian'
- ceph_origin == 'local' - ceph_origin == 'local'
- name: verify that ceph_rhcs_cdn_debian_repo url is valid for red hat storage - name: verify that ceph_rhcs_cdn_debian_repo url is valid for red hat storage
fail: fail:
msg: "ceph_rhcs_cdn_debian_repo url is invalid, please set your customername:customerpasswd" msg: "ceph_rhcs_cdn_debian_repo url is invalid, please set your customername:customerpasswd"
@ -24,9 +24,10 @@
- ceph_origin == 'repository' - ceph_origin == 'repository'
- ceph_repository == 'rhcs' - ceph_repository == 'rhcs'
- ceph_repository_type == 'cdn' - ceph_repository_type == 'cdn'
- ansible_os_family == 'Debian'
- ceph_rhcs_cdn_debian_repo == 'https://customername:customerpasswd@rhcs.download.redhat.com' - ceph_rhcs_cdn_debian_repo == 'https://customername:customerpasswd@rhcs.download.redhat.com'
- ceph_repository not in ['rhcs', 'dev', 'obs'] - ceph_repository not in ['rhcs', 'dev', 'obs']
when:
- ansible_os_family == 'Debian'
- name: validate ntp daemon type - name: validate ntp daemon type
fail: fail:

View File

@ -23,34 +23,24 @@
when: when:
- not is_atomic - not is_atomic
- name: centos based systems - configure repos
block:
- name: disable fastest mirror detection - name: disable fastest mirror detection
ini_file: ini_file:
path: /etc/yum/pluginconf.d/fastestmirror.conf path: /etc/yum/pluginconf.d/fastestmirror.conf
section: main section: main
option: enabled option: enabled
value: 0 value: 0
when:
- ansible_distribution == 'CentOS'
- not is_atomic
- name: install epel - name: install epel
package: package:
name: epel-release name: epel-release
state: present state: present
when:
- ansible_distribution == 'CentOS'
- not is_atomic
- name: enable local epel repository - name: enable local epel repository
ini_file: ini_file:
path: /etc/yum.repos.d/epel.repo path: /etc/yum.repos.d/epel.repo
section: epel section: epel
option: baseurl option: baseurl
value: http://apt-mirror.front.sepia.ceph.com/epel7/ value: http://apt-mirror.front.sepia.ceph.com/epel7/
when:
- ansible_distribution == 'CentOS'
- not is_atomic
- name: disable remote epel repository - name: disable remote epel repository
ini_file: ini_file:
path: /etc/yum.repos.d/epel.repo path: /etc/yum.repos.d/epel.repo