Add more visibility for the 'when' statement.

Signed-off-by: leseb <seb@redhat.com>
pull/289/head
leseb 2015-06-26 00:26:03 +02:00
parent 2b803e218c
commit 4a2c7ae0c1
30 changed files with 184 additions and 108 deletions

View File

@ -4,20 +4,31 @@
- name: restart ceph mons - name: restart ceph mons
command: service ceph restart mon 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 - name: restart ceph osds
command: service ceph restart osd 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 - name: restart ceph osds on ubuntu
command: restart ceph-osd-all 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 - name: restart ceph mdss
command: service ceph restart mds 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 - name: restart ceph rgws
command: /etc/init.d/radosgw restart command: /etc/init.d/radosgw restart
when: socket.rc == 0 and 'rgws' in group_names when:
socket.rc == 0 and
'rgws' in group_names

View File

@ -32,18 +32,21 @@
apt_repository: > apt_repository: >
repo="deb http://ceph.com/debian-{{ ceph_stable_release }}/ {{ ansible_lsb.codename }} main" repo="deb http://ceph.com/debian-{{ ceph_stable_release }}/ {{ ansible_lsb.codename }} main"
state=present state=present
changed_when: false
when: ceph_stable when: ceph_stable
- name: add Ceph development repository - name: add Ceph development repository
apt_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" repo="deb http://gitbuilder.ceph.com/ceph-deb-{{ ansible_lsb.codename }}-x86_64-basic/ref/{{ ceph_dev_branch }} {{ ansible_lsb.codename }} main"
state=present state=present
changed_when: false
when: ceph_dev when: ceph_dev
- name: add Inktank Ceph Enterprise repository - name: add Inktank Ceph Enterprise repository
apt_repository: > apt_repository: >
repo="deb file://{{ ceph_stable_ice_temp_path }} {{ ansible_lsb.codename }} main" repo="deb file://{{ ceph_stable_ice_temp_path }} {{ ansible_lsb.codename }} main"
state=present state=present
changed_when: false
when: ceph_stable_ice when: ceph_stable_ice
- name: install Ceph - name: install Ceph

View File

@ -30,17 +30,13 @@
- name: add Ceph stable repository - 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 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 when: ceph_stable
failed_when: repo_result.rc > 1
changed_when: repo_result.rc == 0
- name: add Ceph development repository - 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 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 when: ceph_dev
failed_when: repo_result.rc > 1
changed_when: repo_result.rc == 0
- name: add Inktank Ceph Enterprise repository - name: add Inktank Ceph Enterprise repository
template: > template: >

View File

@ -14,26 +14,26 @@
- name: check for a Ceph socket - name: check for a Ceph socket
shell: "stat /var/run/ceph/*.asok > /dev/null 2>&1" shell: "stat /var/run/ceph/*.asok > /dev/null 2>&1"
changed_when: false
ignore_errors: true ignore_errors: true
register: socket register: socket
changed_when: False
- name: generate cluster UUID - name: generate cluster UUID
shell: > shell: >
uuidgen | tee fetch/ceph_cluster_uuid.conf uuidgen | tee fetch/ceph_cluster_uuid.conf
creates=fetch/ceph_cluster_uuid.conf creates=fetch/ceph_cluster_uuid.conf
connection: local connection: local
sudo: false
register: cluster_uuid register: cluster_uuid
sudo: false
- name: read cluster UUID if it already exists - name: read cluster UUID if it already exists
command: > command: >
cat fetch/ceph_cluster_uuid.conf cat fetch/ceph_cluster_uuid.conf
removes=fetch/ceph_cluster_uuid.conf removes=fetch/ceph_cluster_uuid.conf
connection: local connection: local
sudo: false changed_when: false
register: cluster_uuid register: cluster_uuid
changed_when: False sudo: false
- include: check-mandatory-vars.yml - include: check-mandatory-vars.yml

View File

@ -1,20 +1,20 @@
--- ---
- 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
ignore_errors: true ignore_errors: true
changed_when: False
- name: disable transparent hugepage - name: disable transparent hugepage
command: "echo never > /sys/kernel/mm/transparent_hugepage/enabled" command: "echo never > /sys/kernel/mm/transparent_hugepage/enabled"
when: disable_transparent_hugepage changed_when: false
ignore_errors: true ignore_errors: true
changed_when: False when: disable_transparent_hugepage
- name: disable swap - name: disable swap
command: swapoff -a command: swapoff -a
when: disable_swap changed_when: false
ignore_errors: true ignore_errors: true
changed_when: False when: disable_swap
- name: apply OS tuning - name: apply OS tuning
sysctl: > sysctl: >

View File

@ -25,7 +25,9 @@
with_items: with_items:
- kmod-libceph-{{ ceph_stable_ice_kmod }}.rpm - kmod-libceph-{{ ceph_stable_ice_kmod }}.rpm
- kmod-rbd-{{ 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 - name: stat extracted ICE repo files
stat: > stat: >
@ -37,10 +39,14 @@
shell: > shell: >
tar -xzf ICE-{{ ceph_stable_ice_version }}-{{ ceph_stable_ice_distro }}.tar.gz tar -xzf ICE-{{ ceph_stable_ice_version }}-{{ ceph_stable_ice_distro }}.tar.gz
chdir={{ ceph_stable_ice_temp_path }} 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 - name: move ICE extracted packages
shell: "mv {{ ceph_stable_ice_temp_path }}/ceph/*/* {{ ceph_stable_ice_temp_path }}" 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

View File

@ -9,14 +9,16 @@
- /var/lib/ceph/bootstrap-mds/ceph.keyring - /var/lib/ceph/bootstrap-mds/ceph.keyring
- name: install docker-py - 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 - name: stat for Ceph config and keys
stat: > stat: >
path={{ item }} path={{ item }}
with_items: ceph_config_keys with_items: ceph_config_keys
ignore_errors: true
register: statconfig register: statconfig
ignore_errors: True
- name: try to fetch Ceph config and keys - name: try to fetch Ceph config and keys
copy: > copy: >

View File

@ -23,8 +23,8 @@
command: > 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 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 creates=/var/lib/ceph/mds/ceph-{{ ansible_hostname }}/keyring
changed_when: false
when: cephx when: cephx
changed_when: False
- name: set MDS key permissions - name: set MDS key permissions
file: > file: >
@ -44,6 +44,7 @@
with_items: with_items:
- done - done
- upstart - upstart
changed_when: false
when: ansible_distribution == "Ubuntu" when: ansible_distribution == "Ubuntu"
- name: activate metadata server with sysvinit - name: activate metadata server with sysvinit
@ -56,6 +57,7 @@
with_items: with_items:
- done - done
- sysvinit - sysvinit
changed_when: false
when: ansible_distribution != "Ubuntu" when: ansible_distribution != "Ubuntu"
- name: start and add that the metadata service to the init sequence (Ubuntu) - name: start and add that the metadata service to the init sequence (Ubuntu)
@ -64,6 +66,7 @@
state=started state=started
enabled=yes enabled=yes
args="id={{ ansible_hostname }}" args="id={{ ansible_hostname }}"
changed_when: false
when: ansible_distribution == "Ubuntu" when: ansible_distribution == "Ubuntu"
- name: start and add that the metadata service to the init sequence - name: start and add that the metadata service to the init sequence
@ -72,4 +75,5 @@
state=started state=started
enabled=yes enabled=yes
args=mds args=mds
changed_when: false
when: ansible_distribution != "Ubuntu" when: ansible_distribution != "Ubuntu"

View File

@ -8,17 +8,21 @@
command: > command: >
ceph auth get-or-create client.restapi osd 'allow *' mon 'allow *' -o /etc/ceph/ceph.client.restapi.keyring 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 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 - include: openstack_config.yml
when: openstack_config and cephx when:
openstack_config and
cephx
- name: find Ceph keys - name: find Ceph keys
shell: ls -1 /etc/ceph/*.keyring shell: ls -1 /etc/ceph/*.keyring
changed_when: false
register: ceph_keys register: ceph_keys
when: cephx when: cephx
changed_when: False
- name: set keys permissions - name: set keys permissions
file: > file: >
@ -34,12 +38,12 @@
src={{ item }} src={{ item }}
dest=fetch/{{ fsid }}/{{ item }} dest=fetch/{{ fsid }}/{{ item }}
flat=yes flat=yes
when: cephx
with_items: with_items:
- "{{ ceph_keys.stdout_lines }}" - "{{ ceph_keys.stdout_lines }}"
- /var/lib/ceph/bootstrap-osd/ceph.keyring - /var/lib/ceph/bootstrap-osd/ceph.keyring
- /var/lib/ceph/bootstrap-rgw/ceph.keyring - /var/lib/ceph/bootstrap-rgw/ceph.keyring
- /var/lib/ceph/bootstrap-mds/ceph.keyring - /var/lib/ceph/bootstrap-mds/ceph.keyring
when: cephx
- name: drop in a motd script to report status when logging in - name: drop in a motd script to report status when logging in
copy: > copy: >

View File

@ -8,10 +8,10 @@
with_items: with_items:
- cephfs_data - cephfs_data
- cephfs_metadata - cephfs_metadata
changed_when: False changed_when: false
when: not {{ ceph_version.stdout | version_compare('0.84', '<') }} when: not {{ ceph_version.stdout | version_compare('0.84', '<') }}
- name: create Ceph Filesystem - name: create Ceph Filesystem
command: ceph fs new {{ cephfs }} {{ cephfs_metadata }} {{ cephfs_data }} command: ceph fs new {{ cephfs }} {{ cephfs_metadata }} {{ cephfs_data }}
changed_when: False changed_when: false
when: not {{ ceph_version.stdout | version_compare('0.84', '<') }} when: not {{ ceph_version.stdout | version_compare('0.84', '<') }}

View File

@ -8,14 +8,16 @@
- /etc/ceph/ceph.mon.keyring - /etc/ceph/ceph.mon.keyring
- name: install docker-py - 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 - name: stat for Ceph config and keys
stat: > stat: >
path={{ item }} path={{ item }}
with_items: ceph_config_keys with_items: ceph_config_keys
ignore_errors: true
register: statconfig register: statconfig
ignore_errors: True
- name: try to fetch Ceph config and keys - name: try to fetch Ceph config and keys
copy: > copy: >

View File

@ -9,11 +9,14 @@
when: not ceph_containerized_deployment when: not ceph_containerized_deployment
- include: create_mds_filesystems.yml - include: create_mds_filesystems.yml
when: not ceph_containerized_deployment and mds when:
not ceph_containerized_deployment and
mds
- include: secure_cluster.yml - include: secure_cluster.yml
when: secure_cluster and not ceph_containerized_deployment when:
tags: secure_cluster secure_cluster and
not ceph_containerized_deployment
- include: docker.yml - include: docker.yml
when: ceph_containerized_deployment when: ceph_containerized_deployment

View File

@ -6,12 +6,12 @@
- "{{ openstack_cinder_pool }}" - "{{ openstack_cinder_pool }}"
- "{{ openstack_nova_pool }}" - "{{ openstack_nova_pool }}"
- "{{ openstack_cinder_backup_pool }}" - "{{ openstack_cinder_backup_pool }}"
ignore_errors: True changed_when: false
changed_when: False ignore_errors: true
- name: create OpenStack keys - name: create OpenStack keys
command: > command: >
ceph auth get-or-create {{ item.name }} {{ item.value }} -o /etc/ceph/ceph.{{ item.name }}.keyring ceph auth get-or-create {{ item.name }} {{ item.value }} -o /etc/ceph/ceph.{{ item.name }}.keyring
creates=/etc/ceph/ceph.{{ item.name }}.keyring creates=/etc/ceph/ceph.{{ item.name }}.keyring
with_items: openstack_keys with_items: openstack_keys
changed_when: False changed_when: false

View File

@ -10,7 +10,7 @@
- done - done
- upstart - upstart
when: ansible_distribution == "Ubuntu" when: ansible_distribution == "Ubuntu"
changed_when: False changed_when: false
- name: activate monitor with sysvinit - name: activate monitor with sysvinit
file: > file: >
@ -42,5 +42,5 @@
- name: get Ceph monitor version - name: get Ceph monitor version
shell: ceph daemon mon."{{ ansible_hostname }}" version | cut -d '"' -f 4 | cut -f 1,2 -d '.' shell: ceph daemon mon."{{ ansible_hostname }}" version | cut -d '"' -f 4 | cut -f 1,2 -d '.'
changed_when: false
register: ceph_version register: ceph_version
changed_when: False

View File

@ -8,9 +8,11 @@
- parted.results - parted.results
- ispartition.results - ispartition.results
- devices - devices
when: item.0.rc == 0 and item.1.rc != 0 changed_when: false
ignore_errors: True ignore_errors: true
changed_when: False 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. # NOTE (leseb): this task is for partitions because we don't explicitly use a partition.
- name: activate OSD(s) when device is a partition - name: activate OSD(s) when device is a partition
@ -18,9 +20,9 @@
with_together: with_together:
- ispartition.results - ispartition.results
- devices - devices
changed_when: false
ignore_errors: true
when: item.0.rc == 0 when: item.0.rc == 0
ignore_errors: True
changed_when: False
- include: osd_fragment.yml - include: osd_fragment.yml
when: crush_location when: crush_location

View File

@ -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" # 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 # 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 # 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 # I believe it's safer
- name: check if the device is a partition or a disk - 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]$))'" 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 with_items: devices
changed_when: false
ignore_errors: true
register: ispartition register: ispartition
changed_when: False
- name: if partition named 'ceph' exists - name: if partition named 'ceph' exists
shell: "parted --script {{ item }} print | egrep -sq '^ 1.*ceph'" shell: "parted --script {{ item }} print | egrep -sq '^ 1.*ceph'"
ignore_errors: True
with_items: devices with_items: devices
changed_when: false
ignore_errors: true
register: parted register: parted
changed_when: False

View File

@ -9,14 +9,16 @@
- /var/lib/ceph/bootstrap-osd/ceph.keyring - /var/lib/ceph/bootstrap-osd/ceph.keyring
- name: install docker-py - 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 - name: stat for Ceph config and keys
stat: > stat: >
path={{ item }} path={{ item }}
with_items: ceph_config_keys with_items: ceph_config_keys
ignore_errors: true
register: statconfig register: statconfig
ignore_errors: True
- name: try to fetch Ceph config and keys - name: try to fetch Ceph config and keys
copy: > copy: >

View File

@ -12,22 +12,27 @@
# failed, this is why we check if the device is a partition too. # failed, this is why we check if the device is a partition too.
- name: automatic prepare OSD disk(s) without partitions - name: automatic prepare OSD disk(s) without partitions
command: ceph-disk prepare "/dev/{{ item.key }}" 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
ignore_errors: True
with_dict: ansible_devices
register: prepared_osds 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) - name: manually Prepare OSD disk(s)
command: "ceph-disk prepare {{ item.2 }}" command: "ceph-disk prepare {{ item.2 }}"
ignore_errors: true
with_together:
- parted.results
- ispartition.results
- devices
when: when:
item.0.rc != 0 and item.0.rc != 0 and
item.1.rc != 0 and item.1.rc != 0 and
journal_collocation and not journal_collocation and not
osd_auto_discovery osd_auto_discovery
ignore_errors: True
with_together:
- parted.results
- ispartition.results
- devices
- include: activate_osds.yml - include: activate_osds.yml

View File

@ -17,14 +17,14 @@
# since Ansible will sequential process the loop # since Ansible will sequential process the loop
- name: prepare OSD disk(s) - name: prepare OSD disk(s)
command: "ceph-disk prepare {{ item }}" command: "ceph-disk prepare {{ item }}"
when: osd_directory
with_items: osd_directories with_items: osd_directories
changed_when: False changed_when: false
when: osd_directory
- name: activate OSD(s) - name: activate OSD(s)
command: "ceph-disk activate {{ item }}" command: "ceph-disk activate {{ item }}"
with_items: osd_directories with_items: osd_directories
changed_when: False changed_when: false
- name: start and add that the OSD service to the init sequence - name: start and add that the OSD service to the init sequence
service: > service: >

View File

@ -2,16 +2,16 @@
- name: get OSD path - name: get OSD path
shell: "df | grep {{ item }} | awk '{print $6}'" shell: "df | grep {{ item }} | awk '{print $6}'"
with_items: devices with_items: devices
register: osd_path changed_when: false
ignore_errors: true ignore_errors: true
changed_when: False register: osd_path
- name: get OSD id - name: get OSD id
command: cat {{ item.stdout }}/whoami command: cat {{ item.stdout }}/whoami
register: osd_id
with_items: osd_path.results with_items: osd_path.results
changed_when: false
ignore_errors: true ignore_errors: true
changed_when: False register: osd_id
- name: create a Ceph fragment and assemble directory - name: create a Ceph fragment and assemble directory
file: > file: >
@ -32,7 +32,7 @@
- name: copy ceph.conf for assembling - name: copy ceph.conf for assembling
command: cp /etc/ceph/ceph.conf /etc/ceph/ceph.d/ command: cp /etc/ceph/ceph.conf /etc/ceph/ceph.d/
changed_when: False changed_when: false
- name: assemble OSD sections - name: assemble OSD sections
assemble: > assemble: >

View File

@ -12,15 +12,16 @@
# failed, this is why we check if the device is a partition too. # failed, this is why we check if the device is a partition too.
- name: prepare OSD disk(s) - name: prepare OSD disk(s)
command: "ceph-disk prepare {{ item.2 }} {{ item.3 }}" 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: with_together:
- parted.results - parted.results
- ispartition.results - ispartition.results
- devices - devices
- raw_journal_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 - include: activate_osds.yml

View File

@ -4,12 +4,16 @@
# ensures that the device will get successfully prepared. # ensures that the device will get successfully prepared.
- name: erasing partitions and labels from OSD disk(s) - name: erasing partitions and labels from OSD disk(s)
command: ceph-disk zap {{ item }} command: ceph-disk zap {{ item }}
when: zap_devices and (journal_collocation or raw_multi_journal)
with_items: devices 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) - name: erasing partitions and labels from the journal device(s)
command: ceph-disk zap {{ item }} command: ceph-disk zap {{ item }}
when: zap_devices and raw_multi_journal
with_items: raw_journal_devices with_items: raw_journal_devices
changed_when: False changed_when: false
when:
zap_devices and
raw_multi_journal

View File

@ -9,14 +9,16 @@
- /var/lib/ceph/bootstrap-rgw/ceph.keyring - /var/lib/ceph/bootstrap-rgw/ceph.keyring
- name: install docker-py - 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 - name: stat for Ceph config and keys
stat: > stat: >
path={{ item }} path={{ item }}
with_items: ceph_config_keys with_items: ceph_config_keys
ignore_errors: true
register: statconfig register: statconfig
ignore_errors: True
- name: try to fetch Ceph config and keys - name: try to fetch Ceph config and keys
copy: > copy: >

View File

@ -14,7 +14,9 @@
- deb http://archive.ubuntu.com/ubuntu {{ ansible_lsb.codename }} multiverse - deb http://archive.ubuntu.com/ubuntu {{ ansible_lsb.codename }} multiverse
- deb http://archive.ubuntu.com/ubuntu {{ ansible_lsb.codename }}-updates multiverse - deb http://archive.ubuntu.com/ubuntu {{ ansible_lsb.codename }}-updates multiverse
- deb http://security.ubuntu.com/ubuntu {{ ansible_lsb.codename }}-security 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 # NOTE (leseb): disable the repo when we are using the Ceph repo for 100-continue packages
- name: disable multiverse repo for Precise - 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 }} multiverse
- deb http://archive.ubuntu.com/ubuntu {{ ansible_lsb.codename }}-updates multiverse - deb http://archive.ubuntu.com/ubuntu {{ ansible_lsb.codename }}-updates multiverse
- deb http://security.ubuntu.com/ubuntu {{ ansible_lsb.codename }}-security 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 # 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 - name: enable multiverse repo for Trusty
command: "apt-add-repository multiverse" 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 # NOTE (leseb): disable the repo when we are using the Ceph repo for 100-continue packages
- name: disable multiverse repo for Trusty - name: disable multiverse repo for Trusty
command: "apt-add-repository -r multiverse" 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 # NOTE (leseb): if using 100-continue, add Ceph dev key
- name: install the Ceph development repository key - name: install the Ceph development repository key
@ -83,7 +91,9 @@
- apache2.2-bin - apache2.2-bin
- apache2.2-common - apache2.2-common
- libapache2-mod-fastcgi - 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 - name: install Apache and fastcgi
apt: > apt: >
@ -106,7 +116,7 @@
with_items: with_items:
- a2enmod rewrite - a2enmod rewrite
- a2enmod fastcgi - a2enmod fastcgi
changed_when: False changed_when: false
- name: install Rados Gateway vhost - name: install Rados Gateway vhost
template: > template: >
@ -120,10 +130,10 @@
with_items: with_items:
- a2ensite rgw.conf - a2ensite rgw.conf
- a2dissite *default - a2dissite *default
ignore_errors: True changed_when: false
ignore_errors: true
notify: notify:
- restart apache2 - restart apache2
changed_when: False
- name: install s3gw.fcgi script - name: install s3gw.fcgi script
template: > template: >

View File

@ -11,7 +11,7 @@
- name: add special fastcgi repository - 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 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 - name: install Apache and fastcgi
yum: > yum: >
@ -39,6 +39,6 @@
- name: disable default site - name: disable default site
shell: sed -i "s/^[^+#]/#/g" /etc/httpd/conf.d/welcome.conf shell: sed -i "s/^[^+#]/#/g" /etc/httpd/conf.d/welcome.conf
changed_when: False changed_when: false
notify: notify:
- restart apache2 - restart apache2

View File

@ -3,23 +3,33 @@
when: not ceph_containerized_deployment when: not ceph_containerized_deployment
- include: install_redhat.yml - 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 - 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 - name: install Rados Gateway
apt: > apt: >
pkg=radosgw pkg=radosgw
state=present state=present
update_cache=yes 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 - name: install Rados Gateway
yum: > yum: >
name=ceph-radosgw name=ceph-radosgw
state=present 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 - include: openstack-keystone.yml
when: radosgw_keystone when: radosgw_keystone

View File

@ -23,8 +23,8 @@
command: > 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 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 creates=/var/lib/ceph/radosgw/ceph-rgw.{{ ansible_hostname }}/keyring
changed_when: false
when: cephx when: cephx
changed_when: False
- name: set RGW key permissions - name: set RGW key permissions
file: > file: >
@ -44,4 +44,5 @@
with_items: with_items:
- done - done
- upstart - upstart
changed_when: false
when: ansible_distribution == "Ubuntu" when: ansible_distribution == "Ubuntu"

View File

@ -2,17 +2,25 @@
# NOTE (leseb): if we don't perform this check Ansible will start multiple instance of radosgw # NOTE (leseb): if we don't perform this check Ansible will start multiple instance of radosgw
- name: check if RGW is started - name: check if RGW is started
command: /etc/init.d/radosgw status command: /etc/init.d/radosgw status
changed_when: false
ignore_errors: true
register: rgwstatus register: rgwstatus
ignore_errors: True
- name: start RGW - name: start RGW
command: /etc/init.d/radosgw start 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 - name: start RGW
service: name=radosgw-all state=started service: >
name=radosgw-all
state=started
when: ansible_distribution == "Ubuntu" when: ansible_distribution == "Ubuntu"
- name: start RGW - name: start RGW
service: name=ceph-radosgw state=started service: >
name=ceph-radosgw
state=started
when: ansible_os_family == 'RedHat' when: ansible_os_family == 'RedHat'

View File

@ -3,10 +3,10 @@
- name: check if Ceph REST API is already started - name: check if Ceph REST API is already started
shell: "pgrep ceph-rest-api" shell: "pgrep ceph-rest-api"
ignore_errors: true
register: restapi_status register: restapi_status
ignore_errors: True
- name: start Ceph REST API - name: start Ceph REST API
shell: "nohup ceph-rest-api &" shell: "nohup ceph-rest-api &"
changed_when: false
when: restapi_status.rc != 0 when: restapi_status.rc != 0
changed_when: False

View File

@ -26,8 +26,8 @@
with_items: with_items:
- done - done
- upstart - upstart
changed_when: false
when: ansible_distribution == "Ubuntu" when: ansible_distribution == "Ubuntu"
changed_when: False
- name: activate Ceph REST API with sysvinit - name: activate Ceph REST API with sysvinit
file: > file: >