Merge pull request #416 from msambol/refactor_osd

Refactor osd role
pull/421/head
Leseb 2015-10-19 11:07:07 +02:00
commit 913241d562
7 changed files with 68 additions and 69 deletions

View File

@ -2,8 +2,7 @@
# NOTE (leseb) : this task is for disk devices only because of the explicit use of the first
# partition.
- name: activate osd(s) when device is a disk
command: |
ceph-disk activate {{ item.1 | regex_replace('^(\/dev\/cciss\/c[0-9]{1}d[0-9]{1})$', '\\1p') }}1
command: ceph-disk activate {{ item.1 | regex_replace('^(\/dev\/cciss\/c[0-9]{1}d[0-9]{1})$', '\\1p') }}1
with_together:
- ispartition.results
- devices
@ -25,7 +24,7 @@
when: crush_location
- name: start and add that the osd service(s) to the init sequence
service: >
name=ceph
state=started
enabled=yes
service:
name: ceph
state: started
enabled: yes

View File

@ -14,12 +14,12 @@
register: statconfig
- name: try to fetch ceph config and keys
copy: >
src={{ fetch_directory }}/docker_mon_files/{{ item.0 }}
dest={{ item.0 }}
owner=root
group=root
mode=644
copy:
src=: "{ fetch_directory }}/docker_mon_files/{{ item.0 }}"
dest: "{{ item.0 }}"
owner: root
group: root
mode: 644
changed_when: false
with_together:
- ceph_config_keys

View File

@ -1,11 +1,11 @@
---
- name: create osd bootstrap directory
file: >
path=/var/lib/ceph/bootstrap-osd
state=directory
file:
path: /var/lib/ceph/bootstrap-osd
state: directory
# NOTE (leseb): for version 1.1.0 because https://github.com/ansible/ansible-modules-core/issues/1227
- name: install docker-py
pip: >
name=docker-py
version=1.1.0
pip:
name: docker-py
version: 1.1.0

View File

@ -1,12 +1,12 @@
---
- name: run the ceph osd docker image
docker: >
image="{{ ceph_osd_docker_username }}/{{ ceph_osd_docker_imagename }}"
name={{ ansible_hostname }}-osd-{{ item | regex_replace('/', '') }}
net=host
pid=host
state=running
privileged=yes
env="OSD_DEVICE={{ item }},{{ ceph_osd_docker_extra_env }}"
volumes="/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph,/dev/:/dev/"
docker:
image: "{{ ceph_osd_docker_username }}/{{ ceph_osd_docker_imagename }}"
name: "{{ ansible_hostname }}-osd-{{ item | regex_replace('/', '') }}"
net: host
pid: host
state: running
privileged: yes
env: "OSD_DEVICE={{ item }},{{ ceph_osd_docker_extra_env }}"
volumes: "/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph,/dev/:/dev/"
with_items: ceph_osd_docker_devices

View File

@ -14,20 +14,20 @@
register: osd_id
- name: create a ceph fragment and assemble directory
file: >
path={{ item }}
state=directory
owner=root
group=root
mode=0644
file:
path: "{{ item }}"
state: directory
owner: root
group: root
mode: 0644
with_items:
- /etc/ceph/ceph.d/
- /etc/ceph/ceph.d/osd_fragments
- name: create the osd fragment
template: >
src=osd.conf.j2
dest=/etc/ceph/ceph.d/osd_fragments/osd.{{ item.stdout }}.conf
template:
src: osd.conf.j2
dest: /etc/ceph/ceph.d/osd_fragments/osd.{{ item.stdout }}.conf
with_items: osd_id.results
- name: copy ceph.conf for assembling
@ -35,17 +35,17 @@
changed_when: false
- name: assemble osd sections
assemble: >
src=/etc/ceph/ceph.d/osd_fragments/
dest=/etc/ceph/ceph.d/osd.conf
owner=root
group=root
mode=0644
assemble:
src: /etc/ceph/ceph.d/osd_fragments/
dest: /etc/ceph/ceph.d/osd.conf
owner: root
group: root
mode: 0644
- name: assemble ceph conf and osd fragments
assemble: >
src=/etc/ceph/ceph.d/
dest=/etc/ceph/ceph.conf
owner=root
group=root
mode=0644
assemble:
src: /etc/ceph/ceph.d/
dest: /etc/ceph/ceph.conf
owner: root
group: root
mode: 0644

View File

@ -1,21 +1,21 @@
---
- name: install dependencies
apt: >
pkg=parted
state=present
apt:
pkg: parted
state: present
when: ansible_os_family == 'Debian'
- name: install dependencies
yum: >
name=parted
state=present
yum:
name: parted
state: present
when: ansible_os_family == 'RedHat'
- name: copy osd bootstrap key
copy: >
src={{ fetch_directory }}/{{ fsid }}/var/lib/ceph/bootstrap-osd/ceph.keyring
dest=/var/lib/ceph/bootstrap-osd/ceph.keyring
owner=root
group=root
mode=600
copy:
src: "{{ fetch_directory }}/{{ fsid }}/var/lib/ceph/bootstrap-osd/ceph.keyring"
dest: /var/lib/ceph/bootstrap-osd/ceph.keyring
owner: root
group: root
mode: 600
when: cephx

View File

@ -5,11 +5,11 @@
# so it is really up to you to configure this properly.
# Declaring more than one directory on the same filesystem will confuse Ceph.
- name: create osd directories
file: >
path={{ item }}
state=directory
owner=root
group=root
file:
path: "{{ item }}"
state: directory
owner: root
group: root
with_items: osd_directories
# NOTE (leseb): the prepare process must be parallelized somehow...
@ -27,7 +27,7 @@
changed_when: false
- name: start and add that the OSD service to the init sequence
service: >
name=ceph
state=started
enabled=yes
service:
name: ceph
state: started
enabled: yes