Merge pull request #289 from leseb/cosmetic-again

WIP: Cosmetic
pull/290/head
Leseb 2015-06-26 14:48:24 +02:00
commit 7da28ef497
30 changed files with 184 additions and 108 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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', '<') }}

View File

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

View File

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

View File

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

View File

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

View File

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

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"
# 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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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 }}-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: >

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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