Refactor osd role

pull/416/head
Michael Sambol 2015-10-18 20:24:47 -05:00
parent 5a46160ad3
commit 48b1cf3be2
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 # NOTE (leseb) : this task is for disk devices only because of the explicit use of the first
# partition. # partition.
- name: activate osd(s) when device is a disk - name: activate osd(s) when device is a disk
command: | command: ceph-disk activate {{ item.1 | regex_replace('^(\/dev\/cciss\/c[0-9]{1}d[0-9]{1})$', '\\1p') }}1
ceph-disk activate {{ item.1 | regex_replace('^(\/dev\/cciss\/c[0-9]{1}d[0-9]{1})$', '\\1p') }}1
with_together: with_together:
- ispartition.results - ispartition.results
- devices - devices
@ -25,7 +24,7 @@
when: crush_location when: crush_location
- name: start and add that the osd service(s) to the init sequence - name: start and add that the osd service(s) to the init sequence
service: > service:
name=ceph name: ceph
state=started state: started
enabled=yes enabled: yes

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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