From 4a2c7ae0c11e501fa24672d718d91efa627b40bc Mon Sep 17 00:00:00 2001 From: leseb Date: Fri, 26 Jun 2015 00:26:03 +0200 Subject: [PATCH] Cosmetic Add more visibility for the 'when' statement. Signed-off-by: leseb --- roles/ceph-common/handlers/main.yml | 21 +++++++++---- roles/ceph-common/tasks/install_on_debian.yml | 3 ++ roles/ceph-common/tasks/install_on_redhat.yml | 8 ++--- roles/ceph-common/tasks/main.yml | 8 ++--- roles/ceph-common/tasks/os_tuning.yml | 10 +++---- roles/ceph-common/tasks/prerequisite_ice.yml | 16 ++++++---- roles/ceph-mds/tasks/docker.yml | 6 ++-- roles/ceph-mds/tasks/pre_requisite.yml | 6 +++- roles/ceph-mon/tasks/ceph_keys.yml | 14 +++++---- .../ceph-mon/tasks/create_mds_filesystems.yml | 4 +-- roles/ceph-mon/tasks/docker.yml | 6 ++-- roles/ceph-mon/tasks/main.yml | 9 ++++-- roles/ceph-mon/tasks/openstack_config.yml | 6 ++-- roles/ceph-mon/tasks/start_monitor.yml | 4 +-- roles/ceph-osd/tasks/activate_osds.yml | 12 ++++---- roles/ceph-osd/tasks/check_devices.yml | 10 +++---- roles/ceph-osd/tasks/docker.yml | 6 ++-- roles/ceph-osd/tasks/journal_collocation.yml | 21 ++++++++----- roles/ceph-osd/tasks/osd_directory.yml | 6 ++-- roles/ceph-osd/tasks/osd_fragment.yml | 10 +++---- roles/ceph-osd/tasks/raw_multi_journal.yml | 11 +++---- roles/ceph-osd/tasks/zap_devices.yml | 12 +++++--- roles/ceph-radosgw/tasks/docker.yml | 6 ++-- roles/ceph-radosgw/tasks/install_debian.yml | 30 ++++++++++++------- roles/ceph-radosgw/tasks/install_redhat.yml | 4 +-- roles/ceph-radosgw/tasks/main.yml | 18 ++++++++--- roles/ceph-radosgw/tasks/pre_requisite.yml | 3 +- roles/ceph-radosgw/tasks/start_radosgw.yml | 16 +++++++--- roles/ceph-restapi/tasks/main.yml | 4 +-- roles/ceph-restapi/tasks/pre_requisite.yml | 2 +- 30 files changed, 184 insertions(+), 108 deletions(-) diff --git a/roles/ceph-common/handlers/main.yml b/roles/ceph-common/handlers/main.yml index d6bf1cfc5..6e98ad90a 100644 --- a/roles/ceph-common/handlers/main.yml +++ b/roles/ceph-common/handlers/main.yml @@ -4,20 +4,31 @@ - name: restart ceph mons command: service ceph restart mon - when: socket.rc == 0 and 'mons' in group_names + when: + socket.rc == 0 and + 'mons' in group_names - name: restart ceph osds command: service ceph restart osd - when: socket.rc == 0 and 'osds' in group_names + when: + socket.rc == 0 and + 'osds' in group_names - name: restart ceph osds on ubuntu command: restart ceph-osd-all - when: socket.rc == 0 and ansible_distribution == 'Ubuntu' and 'osds' in group_names + when: + socket.rc == 0 and + ansible_distribution == 'Ubuntu' and + 'osds' in group_names - name: restart ceph mdss command: service ceph restart mds - when: socket.rc == 0 and 'mdss' in group_names + when: + socket.rc == 0 and + 'mdss' in group_names - name: restart ceph rgws command: /etc/init.d/radosgw restart - when: socket.rc == 0 and 'rgws' in group_names + when: + socket.rc == 0 and + 'rgws' in group_names diff --git a/roles/ceph-common/tasks/install_on_debian.yml b/roles/ceph-common/tasks/install_on_debian.yml index 76fde548c..e72fba2ad 100644 --- a/roles/ceph-common/tasks/install_on_debian.yml +++ b/roles/ceph-common/tasks/install_on_debian.yml @@ -32,18 +32,21 @@ apt_repository: > repo="deb http://ceph.com/debian-{{ ceph_stable_release }}/ {{ ansible_lsb.codename }} main" state=present + changed_when: false when: ceph_stable - name: add Ceph development repository apt_repository: > repo="deb http://gitbuilder.ceph.com/ceph-deb-{{ ansible_lsb.codename }}-x86_64-basic/ref/{{ ceph_dev_branch }} {{ ansible_lsb.codename }} main" state=present + changed_when: false when: ceph_dev - name: add Inktank Ceph Enterprise repository apt_repository: > repo="deb file://{{ ceph_stable_ice_temp_path }} {{ ansible_lsb.codename }} main" state=present + changed_when: false when: ceph_stable_ice - name: install Ceph diff --git a/roles/ceph-common/tasks/install_on_redhat.yml b/roles/ceph-common/tasks/install_on_redhat.yml index 2c915210d..0774e1475 100644 --- a/roles/ceph-common/tasks/install_on_redhat.yml +++ b/roles/ceph-common/tasks/install_on_redhat.yml @@ -30,17 +30,13 @@ - name: add Ceph stable repository yum: name=http://ceph.com/rpm-{{ ceph_stable_release }}/{{ ceph_stable_redhat_distro }}/noarch/ceph-release-1-0.{{ ceph_stable_redhat_distro|replace('rhel', 'el') }}.noarch.rpm - register: repo_result + changed_when: false when: ceph_stable - failed_when: repo_result.rc > 1 - changed_when: repo_result.rc == 0 - name: add Ceph development repository yum: name=http://gitbuilder.ceph.com/ceph-rpm-{{ ceph_dev_redhat_distro }}-x86_64-basic/ref/{{ ceph_dev_branch }}/noarch/ceph-release-1-0.{{ ceph_stable_redhat_distro }}.noarch.rpm - register: repo_result + changed_when: false when: ceph_dev - failed_when: repo_result.rc > 1 - changed_when: repo_result.rc == 0 - name: add Inktank Ceph Enterprise repository template: > diff --git a/roles/ceph-common/tasks/main.yml b/roles/ceph-common/tasks/main.yml index 8435dae6a..bfac9d0b6 100644 --- a/roles/ceph-common/tasks/main.yml +++ b/roles/ceph-common/tasks/main.yml @@ -14,26 +14,26 @@ - name: check for a Ceph socket shell: "stat /var/run/ceph/*.asok > /dev/null 2>&1" + changed_when: false ignore_errors: true register: socket - changed_when: False - name: generate cluster UUID shell: > uuidgen | tee fetch/ceph_cluster_uuid.conf creates=fetch/ceph_cluster_uuid.conf connection: local - sudo: false register: cluster_uuid + sudo: false - name: read cluster UUID if it already exists command: > cat fetch/ceph_cluster_uuid.conf removes=fetch/ceph_cluster_uuid.conf connection: local - sudo: false + changed_when: false register: cluster_uuid - changed_when: False + sudo: false - include: check-mandatory-vars.yml diff --git a/roles/ceph-common/tasks/os_tuning.yml b/roles/ceph-common/tasks/os_tuning.yml index 2aee688fd..8e8e61f8a 100644 --- a/roles/ceph-common/tasks/os_tuning.yml +++ b/roles/ceph-common/tasks/os_tuning.yml @@ -1,20 +1,20 @@ --- - name: disable OSD directory parsing by updatedb command: updatedb -e /var/lib/ceph + changed_when: false ignore_errors: true - changed_when: False - name: disable transparent hugepage command: "echo never > /sys/kernel/mm/transparent_hugepage/enabled" - when: disable_transparent_hugepage + changed_when: false ignore_errors: true - changed_when: False + when: disable_transparent_hugepage - name: disable swap command: swapoff -a - when: disable_swap + changed_when: false ignore_errors: true - changed_when: False + when: disable_swap - name: apply OS tuning sysctl: > diff --git a/roles/ceph-common/tasks/prerequisite_ice.yml b/roles/ceph-common/tasks/prerequisite_ice.yml index 542816b1e..d03f33e31 100644 --- a/roles/ceph-common/tasks/prerequisite_ice.yml +++ b/roles/ceph-common/tasks/prerequisite_ice.yml @@ -25,7 +25,9 @@ with_items: - kmod-libceph-{{ ceph_stable_ice_kmod }}.rpm - kmod-rbd-{{ ceph_stable_ice_kmod }}.rpm - when: ceph_stable_ice and ansible_os_family == 'RedHat' + when: + ceph_stable_ice and + ansible_os_family == 'RedHat' - name: stat extracted ICE repo files stat: > @@ -37,10 +39,14 @@ shell: > tar -xzf ICE-{{ ceph_stable_ice_version }}-{{ ceph_stable_ice_distro }}.tar.gz chdir={{ ceph_stable_ice_temp_path }} - when: ceph_stable_ice and repo_exist.stat.exists == False - changed_when: False + changed_when: false + when: + ceph_stable_ice and + repo_exist.stat.exists == False - name: move ICE extracted packages shell: "mv {{ ceph_stable_ice_temp_path }}/ceph/*/* {{ ceph_stable_ice_temp_path }}" - when: ceph_stable_ice and repo_exist.stat.exists == False - changed_when: False + changed_when: false + when: + ceph_stable_ice and + repo_exist.stat.exists == False diff --git a/roles/ceph-mds/tasks/docker.yml b/roles/ceph-mds/tasks/docker.yml index bf1c10841..d0cb7ac5f 100644 --- a/roles/ceph-mds/tasks/docker.yml +++ b/roles/ceph-mds/tasks/docker.yml @@ -9,14 +9,16 @@ - /var/lib/ceph/bootstrap-mds/ceph.keyring - name: install docker-py - pip: name=docker-py version=1.1.0 # https://github.com/ansible/ansible-modules-core/issues/1227 + pip: > + name=docker-py + version=1.1.0 # https://github.com/ansible/ansible-modules-core/issues/1227 - name: stat for Ceph config and keys stat: > path={{ item }} with_items: ceph_config_keys + ignore_errors: true register: statconfig - ignore_errors: True - name: try to fetch Ceph config and keys copy: > diff --git a/roles/ceph-mds/tasks/pre_requisite.yml b/roles/ceph-mds/tasks/pre_requisite.yml index 7195128cd..d7412ae43 100644 --- a/roles/ceph-mds/tasks/pre_requisite.yml +++ b/roles/ceph-mds/tasks/pre_requisite.yml @@ -23,8 +23,8 @@ command: > ceph --cluster ceph --name client.bootstrap-mds --keyring /var/lib/ceph/bootstrap-mds/ceph.keyring auth get-or-create mds.{{ ansible_hostname }} osd 'allow rwx' mds 'allow' mon 'allow profile mds' -o /var/lib/ceph/mds/ceph-{{ ansible_hostname }}/keyring creates=/var/lib/ceph/mds/ceph-{{ ansible_hostname }}/keyring + changed_when: false when: cephx - changed_when: False - name: set MDS key permissions file: > @@ -44,6 +44,7 @@ with_items: - done - upstart + changed_when: false when: ansible_distribution == "Ubuntu" - name: activate metadata server with sysvinit @@ -56,6 +57,7 @@ with_items: - done - sysvinit + changed_when: false when: ansible_distribution != "Ubuntu" - name: start and add that the metadata service to the init sequence (Ubuntu) @@ -64,6 +66,7 @@ state=started enabled=yes args="id={{ ansible_hostname }}" + changed_when: false when: ansible_distribution == "Ubuntu" - name: start and add that the metadata service to the init sequence @@ -72,4 +75,5 @@ state=started enabled=yes args=mds + changed_when: false when: ansible_distribution != "Ubuntu" diff --git a/roles/ceph-mon/tasks/ceph_keys.yml b/roles/ceph-mon/tasks/ceph_keys.yml index f1306ff55..babac4a3e 100644 --- a/roles/ceph-mon/tasks/ceph_keys.yml +++ b/roles/ceph-mon/tasks/ceph_keys.yml @@ -8,17 +8,21 @@ command: > ceph auth get-or-create client.restapi osd 'allow *' mon 'allow *' -o /etc/ceph/ceph.client.restapi.keyring creates=/etc/ceph/ceph.client.restapi.keyring - when: cephx and restapi - changed_when: False + changed_when: false + when: + cephx and + restapi - include: openstack_config.yml - when: openstack_config and cephx + when: + openstack_config and + cephx - name: find Ceph keys shell: ls -1 /etc/ceph/*.keyring + changed_when: false register: ceph_keys when: cephx - changed_when: False - name: set keys permissions file: > @@ -34,12 +38,12 @@ src={{ item }} dest=fetch/{{ fsid }}/{{ item }} flat=yes - when: cephx with_items: - "{{ ceph_keys.stdout_lines }}" - /var/lib/ceph/bootstrap-osd/ceph.keyring - /var/lib/ceph/bootstrap-rgw/ceph.keyring - /var/lib/ceph/bootstrap-mds/ceph.keyring + when: cephx - name: drop in a motd script to report status when logging in copy: > diff --git a/roles/ceph-mon/tasks/create_mds_filesystems.yml b/roles/ceph-mon/tasks/create_mds_filesystems.yml index 769024b14..2a917ceb4 100644 --- a/roles/ceph-mon/tasks/create_mds_filesystems.yml +++ b/roles/ceph-mon/tasks/create_mds_filesystems.yml @@ -8,10 +8,10 @@ with_items: - cephfs_data - cephfs_metadata - changed_when: False + changed_when: false when: not {{ ceph_version.stdout | version_compare('0.84', '<') }} - name: create Ceph Filesystem command: ceph fs new {{ cephfs }} {{ cephfs_metadata }} {{ cephfs_data }} - changed_when: False + changed_when: false when: not {{ ceph_version.stdout | version_compare('0.84', '<') }} diff --git a/roles/ceph-mon/tasks/docker.yml b/roles/ceph-mon/tasks/docker.yml index 0abbe669f..a920f1658 100644 --- a/roles/ceph-mon/tasks/docker.yml +++ b/roles/ceph-mon/tasks/docker.yml @@ -8,14 +8,16 @@ - /etc/ceph/ceph.mon.keyring - name: install docker-py - pip: name=docker-py version=1.1.0 # https://github.com/ansible/ansible-modules-core/issues/1227 + pip: > + name=docker-py + version=1.1.0 # https://github.com/ansible/ansible-modules-core/issues/1227 - name: stat for Ceph config and keys stat: > path={{ item }} with_items: ceph_config_keys + ignore_errors: true register: statconfig - ignore_errors: True - name: try to fetch Ceph config and keys copy: > diff --git a/roles/ceph-mon/tasks/main.yml b/roles/ceph-mon/tasks/main.yml index 0d9502909..d56151e32 100644 --- a/roles/ceph-mon/tasks/main.yml +++ b/roles/ceph-mon/tasks/main.yml @@ -9,11 +9,14 @@ when: not ceph_containerized_deployment - include: create_mds_filesystems.yml - when: not ceph_containerized_deployment and mds + when: + not ceph_containerized_deployment and + mds - include: secure_cluster.yml - when: secure_cluster and not ceph_containerized_deployment - tags: secure_cluster + when: + secure_cluster and + not ceph_containerized_deployment - include: docker.yml when: ceph_containerized_deployment diff --git a/roles/ceph-mon/tasks/openstack_config.yml b/roles/ceph-mon/tasks/openstack_config.yml index e3462171c..1bfdf4582 100644 --- a/roles/ceph-mon/tasks/openstack_config.yml +++ b/roles/ceph-mon/tasks/openstack_config.yml @@ -6,12 +6,12 @@ - "{{ openstack_cinder_pool }}" - "{{ openstack_nova_pool }}" - "{{ openstack_cinder_backup_pool }}" - ignore_errors: True - changed_when: False + changed_when: false + ignore_errors: true - name: create OpenStack keys command: > ceph auth get-or-create {{ item.name }} {{ item.value }} -o /etc/ceph/ceph.{{ item.name }}.keyring creates=/etc/ceph/ceph.{{ item.name }}.keyring with_items: openstack_keys - changed_when: False + changed_when: false diff --git a/roles/ceph-mon/tasks/start_monitor.yml b/roles/ceph-mon/tasks/start_monitor.yml index e8a8496fa..52ee896d2 100644 --- a/roles/ceph-mon/tasks/start_monitor.yml +++ b/roles/ceph-mon/tasks/start_monitor.yml @@ -10,7 +10,7 @@ - done - upstart when: ansible_distribution == "Ubuntu" - changed_when: False + changed_when: false - name: activate monitor with sysvinit file: > @@ -42,5 +42,5 @@ - name: get Ceph monitor version shell: ceph daemon mon."{{ ansible_hostname }}" version | cut -d '"' -f 4 | cut -f 1,2 -d '.' + changed_when: false register: ceph_version - changed_when: False diff --git a/roles/ceph-osd/tasks/activate_osds.yml b/roles/ceph-osd/tasks/activate_osds.yml index 1011a74c6..a1d12e88f 100644 --- a/roles/ceph-osd/tasks/activate_osds.yml +++ b/roles/ceph-osd/tasks/activate_osds.yml @@ -8,9 +8,11 @@ - parted.results - ispartition.results - devices - when: item.0.rc == 0 and item.1.rc != 0 - ignore_errors: True - changed_when: False + changed_when: false + ignore_errors: true + when: + item.0.rc == 0 and + item.1.rc != 0 # NOTE (leseb): this task is for partitions because we don't explicitly use a partition. - name: activate OSD(s) when device is a partition @@ -18,9 +20,9 @@ with_together: - ispartition.results - devices + changed_when: false + ignore_errors: true when: item.0.rc == 0 - ignore_errors: True - changed_when: False - include: osd_fragment.yml when: crush_location diff --git a/roles/ceph-osd/tasks/check_devices.yml b/roles/ceph-osd/tasks/check_devices.yml index eae5d4dd6..ab1795914 100644 --- a/roles/ceph-osd/tasks/check_devices.yml +++ b/roles/ceph-osd/tasks/check_devices.yml @@ -2,18 +2,18 @@ # NOTE (leseb): current behavior of ceph-disk is to fail when the device is mounted "stderr: ceph-disk: Error: Device is mounted: /dev/sdb1" # the return code is 1, which makes sense, however ideally if ceph-disk will detect a ceph partition # it should exist we rc=0 and don't do anything unless we do something like --force -# As as a final word, I prefer to keep the partition check instead of running ceph-disk prepare with "ignore_errors: True" +# As as a final word, I prefer to keep the partition check instead of running ceph-disk prepare with "ignore_errors: true" # I believe it's safer - name: check if the device is a partition or a disk shell: "echo '{{ item }}' | egrep '/dev/(([a-z]{3,4}[0-9]$)|(cciss/c[0-9]{1}d[0-9]{1}p[0-9]$))'" - ignore_errors: true with_items: devices + changed_when: false + ignore_errors: true register: ispartition - changed_when: False - name: if partition named 'ceph' exists shell: "parted --script {{ item }} print | egrep -sq '^ 1.*ceph'" - ignore_errors: True with_items: devices + changed_when: false + ignore_errors: true register: parted - changed_when: False diff --git a/roles/ceph-osd/tasks/docker.yml b/roles/ceph-osd/tasks/docker.yml index 735476733..1d9fdad7a 100644 --- a/roles/ceph-osd/tasks/docker.yml +++ b/roles/ceph-osd/tasks/docker.yml @@ -9,14 +9,16 @@ - /var/lib/ceph/bootstrap-osd/ceph.keyring - name: install docker-py - pip: name=docker-py version=1.1.0 # https://github.com/ansible/ansible-modules-core/issues/1227 + pip: > + name=docker-py + version=1.1.0 # https://github.com/ansible/ansible-modules-core/issues/1227 - name: stat for Ceph config and keys stat: > path={{ item }} with_items: ceph_config_keys + ignore_errors: true register: statconfig - ignore_errors: True - name: try to fetch Ceph config and keys copy: > diff --git a/roles/ceph-osd/tasks/journal_collocation.yml b/roles/ceph-osd/tasks/journal_collocation.yml index 16f8e9e63..613715eea 100644 --- a/roles/ceph-osd/tasks/journal_collocation.yml +++ b/roles/ceph-osd/tasks/journal_collocation.yml @@ -12,22 +12,27 @@ # failed, this is why we check if the device is a partition too. - name: automatic prepare OSD disk(s) without partitions command: ceph-disk prepare "/dev/{{ item.key }}" - when: ansible_devices is defined and item.value.removable == "0" and item.value.partitions|count == 0 and journal_collocation and osd_auto_discovery - ignore_errors: True - with_dict: ansible_devices + ignore_errors: true register: prepared_osds + with_dict: ansible_devices + when: + ansible_devices is defined and + item.value.removable == "0" and + item.value.partitions|count == 0 and + journal_collocation and + osd_auto_discovery - name: manually Prepare OSD disk(s) command: "ceph-disk prepare {{ item.2 }}" + ignore_errors: true + with_together: + - parted.results + - ispartition.results + - devices when: item.0.rc != 0 and item.1.rc != 0 and journal_collocation and not osd_auto_discovery - ignore_errors: True - with_together: - - parted.results - - ispartition.results - - devices - include: activate_osds.yml diff --git a/roles/ceph-osd/tasks/osd_directory.yml b/roles/ceph-osd/tasks/osd_directory.yml index f5c68a48d..7be19b77c 100644 --- a/roles/ceph-osd/tasks/osd_directory.yml +++ b/roles/ceph-osd/tasks/osd_directory.yml @@ -17,14 +17,14 @@ # since Ansible will sequential process the loop - name: prepare OSD disk(s) command: "ceph-disk prepare {{ item }}" - when: osd_directory with_items: osd_directories - changed_when: False + changed_when: false + when: osd_directory - name: activate OSD(s) command: "ceph-disk activate {{ item }}" with_items: osd_directories - changed_when: False + changed_when: false - name: start and add that the OSD service to the init sequence service: > diff --git a/roles/ceph-osd/tasks/osd_fragment.yml b/roles/ceph-osd/tasks/osd_fragment.yml index 930c52c92..13ac57c89 100644 --- a/roles/ceph-osd/tasks/osd_fragment.yml +++ b/roles/ceph-osd/tasks/osd_fragment.yml @@ -2,16 +2,16 @@ - name: get OSD path shell: "df | grep {{ item }} | awk '{print $6}'" with_items: devices - register: osd_path + changed_when: false ignore_errors: true - changed_when: False + register: osd_path - name: get OSD id command: cat {{ item.stdout }}/whoami - register: osd_id with_items: osd_path.results + changed_when: false ignore_errors: true - changed_when: False + register: osd_id - name: create a Ceph fragment and assemble directory file: > @@ -32,7 +32,7 @@ - name: copy ceph.conf for assembling command: cp /etc/ceph/ceph.conf /etc/ceph/ceph.d/ - changed_when: False + changed_when: false - name: assemble OSD sections assemble: > diff --git a/roles/ceph-osd/tasks/raw_multi_journal.yml b/roles/ceph-osd/tasks/raw_multi_journal.yml index b63263750..76b7f0ff0 100644 --- a/roles/ceph-osd/tasks/raw_multi_journal.yml +++ b/roles/ceph-osd/tasks/raw_multi_journal.yml @@ -12,15 +12,16 @@ # failed, this is why we check if the device is a partition too. - name: prepare OSD disk(s) command: "ceph-disk prepare {{ item.2 }} {{ item.3 }}" - when: item.0.rc != 0 and - item.1.rc != 0 and - raw_multi_journal - ignore_errors: True with_together: - parted.results - ispartition.results - devices - raw_journal_devices - changed_when: False + changed_when: false + ignore_errors: true + when: + item.0.rc != 0 and + item.1.rc != 0 and + raw_multi_journal - include: activate_osds.yml diff --git a/roles/ceph-osd/tasks/zap_devices.yml b/roles/ceph-osd/tasks/zap_devices.yml index e5cbc9d00..9180daa09 100644 --- a/roles/ceph-osd/tasks/zap_devices.yml +++ b/roles/ceph-osd/tasks/zap_devices.yml @@ -4,12 +4,16 @@ # ensures that the device will get successfully prepared. - name: erasing partitions and labels from OSD disk(s) command: ceph-disk zap {{ item }} - when: zap_devices and (journal_collocation or raw_multi_journal) with_items: devices - changed_when: False + changed_when: false + when: + zap_devices and + (journal_collocation or raw_multi_journal) - name: erasing partitions and labels from the journal device(s) command: ceph-disk zap {{ item }} - when: zap_devices and raw_multi_journal with_items: raw_journal_devices - changed_when: False + changed_when: false + when: + zap_devices and + raw_multi_journal diff --git a/roles/ceph-radosgw/tasks/docker.yml b/roles/ceph-radosgw/tasks/docker.yml index fe8de1a66..43bf4c1ab 100644 --- a/roles/ceph-radosgw/tasks/docker.yml +++ b/roles/ceph-radosgw/tasks/docker.yml @@ -9,14 +9,16 @@ - /var/lib/ceph/bootstrap-rgw/ceph.keyring - name: install docker-py - pip: name=docker-py version=1.1.0 # https://github.com/ansible/ansible-modules-core/issues/1227 + pip: > + name=docker-py + version=1.1.0 # https://github.com/ansible/ansible-modules-core/issues/1227 - name: stat for Ceph config and keys stat: > path={{ item }} with_items: ceph_config_keys + ignore_errors: true register: statconfig - ignore_errors: True - name: try to fetch Ceph config and keys copy: > diff --git a/roles/ceph-radosgw/tasks/install_debian.yml b/roles/ceph-radosgw/tasks/install_debian.yml index 4922ddd45..1752f19ba 100644 --- a/roles/ceph-radosgw/tasks/install_debian.yml +++ b/roles/ceph-radosgw/tasks/install_debian.yml @@ -14,7 +14,9 @@ - deb http://archive.ubuntu.com/ubuntu {{ ansible_lsb.codename }} multiverse - deb http://archive.ubuntu.com/ubuntu {{ ansible_lsb.codename }}-updates multiverse - deb http://security.ubuntu.com/ubuntu {{ ansible_lsb.codename }}-security multiverse - when: ansible_lsb.codename in ['precise'] and not http_100_continue + when: + ansible_lsb.codename in ['precise'] and not + http_100_continue # NOTE (leseb): disable the repo when we are using the Ceph repo for 100-continue packages - name: disable multiverse repo for Precise @@ -25,19 +27,25 @@ - deb http://archive.ubuntu.com/ubuntu {{ ansible_lsb.codename }} multiverse - deb http://archive.ubuntu.com/ubuntu {{ ansible_lsb.codename }}-updates multiverse - deb http://security.ubuntu.com/ubuntu {{ ansible_lsb.codename }}-security multiverse - when: ansible_lsb.codename in ['precise'] and http_100_continue + when: + ansible_lsb.codename in ['precise'] and + http_100_continue # NOTE (leseb): needed for Ubuntu 14.04 to have access to libapache2-mod-fastcgi if 100-continue isn't being used - name: enable multiverse repo for Trusty command: "apt-add-repository multiverse" - when: ansible_lsb.codename in ['trusty'] and not http_100_continue - changed_when: False + changed_when: false + when: + ansible_lsb.codename in ['trusty'] and not + http_100_continue # NOTE (leseb): disable the repo when we are using the Ceph repo for 100-continue packages - name: disable multiverse repo for Trusty command: "apt-add-repository -r multiverse" - when: ansible_lsb.codename in ['trusty'] and http_100_continue - changed_when: False + changed_when: false + when: + ansible_lsb.codename in ['trusty'] and + http_100_continue # NOTE (leseb): if using 100-continue, add Ceph dev key - name: install the Ceph development repository key @@ -83,7 +91,9 @@ - apache2.2-bin - apache2.2-common - libapache2-mod-fastcgi - when: purge_default_apache.changed or purge_ceph_apache.changed + when: + purge_default_apache.changed or + purge_ceph_apache.changed - name: install Apache and fastcgi apt: > @@ -106,7 +116,7 @@ with_items: - a2enmod rewrite - a2enmod fastcgi - changed_when: False + changed_when: false - name: install Rados Gateway vhost template: > @@ -120,10 +130,10 @@ with_items: - a2ensite rgw.conf - a2dissite *default - ignore_errors: True + changed_when: false + ignore_errors: true notify: - restart apache2 - changed_when: False - name: install s3gw.fcgi script template: > diff --git a/roles/ceph-radosgw/tasks/install_redhat.yml b/roles/ceph-radosgw/tasks/install_redhat.yml index 436d21ef2..9be921d6c 100644 --- a/roles/ceph-radosgw/tasks/install_redhat.yml +++ b/roles/ceph-radosgw/tasks/install_redhat.yml @@ -11,7 +11,7 @@ - name: add special fastcgi repository command: rpm -ivh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm - changed_when: False + changed_when: false - name: install Apache and fastcgi yum: > @@ -39,6 +39,6 @@ - name: disable default site shell: sed -i "s/^[^+#]/#/g" /etc/httpd/conf.d/welcome.conf - changed_when: False + changed_when: false notify: - restart apache2 diff --git a/roles/ceph-radosgw/tasks/main.yml b/roles/ceph-radosgw/tasks/main.yml index eddbe05ac..05f3d0070 100644 --- a/roles/ceph-radosgw/tasks/main.yml +++ b/roles/ceph-radosgw/tasks/main.yml @@ -3,23 +3,33 @@ when: not ceph_containerized_deployment - include: install_redhat.yml - when: ansible_os_family == 'RedHat' and radosgw_frontend == 'apache' and not ceph_containerized_deployment + when: + ansible_os_family == 'RedHat' and + radosgw_frontend == 'apache' and not + ceph_containerized_deployment - include: install_debian.yml - when: ansible_os_family == 'Debian' and radosgw_frontend == 'apache' and not ceph_containerized_deployment + when: + ansible_os_family == 'Debian' and + radosgw_frontend == 'apache' and not + ceph_containerized_deployment - name: install Rados Gateway apt: > pkg=radosgw state=present update_cache=yes - when: ansible_os_family == 'Debian' and not ceph_containerized_deployment + when: + ansible_os_family == 'Debian' and not + ceph_containerized_deployment - name: install Rados Gateway yum: > name=ceph-radosgw state=present - when: ansible_os_family == 'RedHat' and not ceph_containerized_deployment + when: + ansible_os_family == 'RedHat' and not + ceph_containerized_deployment - include: openstack-keystone.yml when: radosgw_keystone diff --git a/roles/ceph-radosgw/tasks/pre_requisite.yml b/roles/ceph-radosgw/tasks/pre_requisite.yml index 88243ff1e..fbd2114a8 100644 --- a/roles/ceph-radosgw/tasks/pre_requisite.yml +++ b/roles/ceph-radosgw/tasks/pre_requisite.yml @@ -23,8 +23,8 @@ command: > ceph --cluster ceph --name client.bootstrap-rgw --keyring /var/lib/ceph/bootstrap-rgw/ceph.keyring auth get-or-create client.rgw.{{ ansible_hostname }} osd 'allow rwx' mon 'allow rw' -o /var/lib/ceph/radosgw/ceph-rgw.{{ ansible_hostname }}/keyring creates=/var/lib/ceph/radosgw/ceph-rgw.{{ ansible_hostname }}/keyring + changed_when: false when: cephx - changed_when: False - name: set RGW key permissions file: > @@ -44,4 +44,5 @@ with_items: - done - upstart + changed_when: false when: ansible_distribution == "Ubuntu" diff --git a/roles/ceph-radosgw/tasks/start_radosgw.yml b/roles/ceph-radosgw/tasks/start_radosgw.yml index 442072247..f56dca901 100644 --- a/roles/ceph-radosgw/tasks/start_radosgw.yml +++ b/roles/ceph-radosgw/tasks/start_radosgw.yml @@ -2,17 +2,25 @@ # NOTE (leseb): if we don't perform this check Ansible will start multiple instance of radosgw - name: check if RGW is started command: /etc/init.d/radosgw status + changed_when: false + ignore_errors: true register: rgwstatus - ignore_errors: True - name: start RGW command: /etc/init.d/radosgw start - when: rgwstatus.rc != 0 and ansible_distribution != "Ubuntu" and ansible_os_family != 'RedHat' + when: + rgwstatus.rc != 0 and + ansible_distribution != "Ubuntu" and + ansible_os_family != 'RedHat' - name: start RGW - service: name=radosgw-all state=started + service: > + name=radosgw-all + state=started when: ansible_distribution == "Ubuntu" - name: start RGW - service: name=ceph-radosgw state=started + service: > + name=ceph-radosgw + state=started when: ansible_os_family == 'RedHat' diff --git a/roles/ceph-restapi/tasks/main.yml b/roles/ceph-restapi/tasks/main.yml index 773186275..6d8ebc18f 100644 --- a/roles/ceph-restapi/tasks/main.yml +++ b/roles/ceph-restapi/tasks/main.yml @@ -3,10 +3,10 @@ - name: check if Ceph REST API is already started shell: "pgrep ceph-rest-api" + ignore_errors: true register: restapi_status - ignore_errors: True - name: start Ceph REST API shell: "nohup ceph-rest-api &" + changed_when: false when: restapi_status.rc != 0 - changed_when: False diff --git a/roles/ceph-restapi/tasks/pre_requisite.yml b/roles/ceph-restapi/tasks/pre_requisite.yml index 92e855532..982f9828c 100644 --- a/roles/ceph-restapi/tasks/pre_requisite.yml +++ b/roles/ceph-restapi/tasks/pre_requisite.yml @@ -26,8 +26,8 @@ with_items: - done - upstart + changed_when: false when: ansible_distribution == "Ubuntu" - changed_when: False - name: activate Ceph REST API with sysvinit file: >