Merge pull request #1624 from ceph/chose-ceph-config-location

Choose ceph config location
pull/1626/head
Sébastien Han 2017-06-26 14:38:54 +02:00 committed by GitHub
commit 010897d1a5
31 changed files with 24 additions and 503 deletions

View File

@ -418,7 +418,9 @@ dummy:
# These values have to be set according to the base OS used by the container image, NOT the host. # These values have to be set according to the base OS used by the container image, NOT the host.
#bootstrap_dirs_owner: "64045" #bootstrap_dirs_owner: "64045"
#bootstrap_dirs_group: "64045" #bootstrap_dirs_group: "64045"
#
#ceph_conf_key_directory: /etc/ceph
############ ############
# KV store # # KV store #
############ ############

View File

@ -13,7 +13,9 @@ mon_use_fqdn: false # if set to true, the MON name used will be the fqdn
# These values have to be set according to the base OS used by the container image, NOT the host. # These values have to be set according to the base OS used by the container image, NOT the host.
bootstrap_dirs_owner: "64045" bootstrap_dirs_owner: "64045"
bootstrap_dirs_group: "64045" bootstrap_dirs_group: "64045"
#
ceph_conf_key_directory: /etc/ceph
############ ############
# KV store # # KV store #
############ ############

View File

@ -2,10 +2,10 @@
- name: set config and keys paths - name: set config and keys paths
set_fact: set_fact:
ceph_config_keys: ceph_config_keys:
- /etc/ceph/{{ cluster }}.client.admin.keyring - "{{ ceph_conf_key_directory }}/{{ cluster }}.client.admin.keyring"
- /etc/ceph/{{ cluster }}.conf - "{{ ceph_conf_key_directory }}/{{ cluster }}.conf"
- /etc/ceph/monmap-{{ cluster }} - "{{ ceph_conf_key_directory }}/monmap-{{ cluster }}"
- /etc/ceph/{{ cluster }}.mon.keyring - "{{ ceph_conf_key_directory }}/{{ cluster }}.mon.keyring"
- /var/lib/ceph/bootstrap-osd/{{ cluster }}.keyring - /var/lib/ceph/bootstrap-osd/{{ cluster }}.keyring
- /var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring - /var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring
- /var/lib/ceph/bootstrap-mds/{{ cluster }}.keyring - /var/lib/ceph/bootstrap-mds/{{ cluster }}.keyring

View File

@ -26,7 +26,7 @@
action: config_template action: config_template
args: args:
src: "{{ playbook_dir }}/roles/ceph-common/templates/ceph.conf.j2" src: "{{ playbook_dir }}/roles/ceph-common/templates/ceph.conf.j2"
dest: "/etc/ceph/{{ cluster }}.conf" dest: "{{ ceph_conf_key_directory }}/{{ cluster }}.conf"
owner: "root" owner: "root"
group: "root" group: "root"
mode: "0644" mode: "0644"

View File

@ -7,7 +7,7 @@
group: "{{ bootstrap_dirs_group }}" group: "{{ bootstrap_dirs_group }}"
mode: "0755" mode: "0755"
with_items: with_items:
- /etc/ceph/ - "{{ ceph_conf_key_directory }}"
- /var/lib/ceph/bootstrap-osd - /var/lib/ceph/bootstrap-osd
- /var/lib/ceph/bootstrap-mds - /var/lib/ceph/bootstrap-mds
- /var/lib/ceph/bootstrap-rgw - /var/lib/ceph/bootstrap-rgw

View File

@ -2,17 +2,17 @@
- name: set config and keys paths - name: set config and keys paths
set_fact: set_fact:
ceph_config_keys: ceph_config_keys:
- /etc/ceph/{{ cluster }}.conf - "{{ ceph_conf_key_directory }}/{{ cluster }}.conf"
- /etc/ceph/{{ cluster }}.client.admin.keyring - "{{ ceph_conf_key_directory }}/{{ cluster }}.client.admin.keyring"
- /etc/ceph/monmap-{{ cluster }} - "{{ ceph_conf_key_directory }}/monmap-{{ cluster }}"
- /etc/ceph/{{ cluster }}.mon.keyring - "{{ ceph_conf_key_directory }}/{{ cluster }}.mon.keyring"
- /var/lib/ceph/bootstrap-osd/{{ cluster }}.keyring - /var/lib/ceph/bootstrap-osd/{{ cluster }}.keyring
- /var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring - /var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring
- /var/lib/ceph/bootstrap-mds/{{ cluster }}.keyring - /var/lib/ceph/bootstrap-mds/{{ cluster }}.keyring
- name: add mgr keys to config and keys paths - name: add mgr keys to config and keys paths
set_fact: set_fact:
tmp_ceph_mgr_keys: /etc/ceph/{{ cluster }}.mgr.{{ hostvars[item]['ansible_hostname'] }}.keyring tmp_ceph_mgr_keys: "{{ ceph_conf_key_directory }}/{{ cluster }}.mgr.{{ hostvars[item]['ansible_hostname'] }}.keyring"
with_items: "{{ groups.get(mgr_group_name, []) }}" with_items: "{{ groups.get(mgr_group_name, []) }}"
register: tmp_ceph_mgr_keys_result register: tmp_ceph_mgr_keys_result
when: "{{ groups.get(mgr_group_name, []) | length > 0 }}" when: "{{ groups.get(mgr_group_name, []) | length > 0 }}"

View File

@ -6,9 +6,10 @@
always_run: true always_run: true
- name: set selinux permissions - name: set selinux permissions
shell: chcon -Rt svirt_sandbox_file_t {{ item }} shell: |
chcon -Rt svirt_sandbox_file_t {{ item }}
with_items: with_items:
- /etc/ceph - "{{ ceph_conf_key_directory }}"
- /var/lib/ceph - /var/lib/ceph
changed_when: false changed_when: false
when: sestatus.stdout != 'Disabled' when: sestatus.stdout != 'Disabled'

View File

@ -1,11 +0,0 @@
---
- name: create bootstrap directories
file:
path: "{{ item }}"
state: directory
owner: "{{ bootstrap_dirs_owner }}"
group: "{{ bootstrap_dirs_group }}"
mode: "0755"
with_items:
- /etc/ceph/
- /var/lib/ceph/bootstrap-mds

View File

@ -1,31 +0,0 @@
---
# NOTE (leseb): the mds container needs the admin key
# so it can create the mds pools for cephfs
- name: set config and keys paths
set_fact:
ceph_config_keys:
- /etc/ceph/{{ cluster }}.conf
- /etc/ceph/{{ cluster }}.client.admin.keyring
- /var/lib/ceph/bootstrap-mds/{{ cluster }}.keyring
- name: stat for ceph config and keys
local_action: stat path={{ fetch_directory }}/docker_mon_files/{{ item }}
with_items: "{{ ceph_config_keys }}"
changed_when: false
become: false
failed_when: false
always_run: true
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: 0644
changed_when: false
with_together:
- "{{ ceph_config_keys }}"
- "{{ statconfig.results }}"
when: item.1.stat.exists == true

View File

@ -1,14 +0,0 @@
---
- name: check if selinux is enabled
command: getenforce
register: sestatus
changed_when: false
always_run: true
- name: set selinux permissions
shell: chcon -Rt svirt_sandbox_file_t {{ item }}
with_items:
- /etc/ceph
- /var/lib/ceph
changed_when: false
when: sestatus.stdout != 'Disabled'

View File

@ -1,12 +0,0 @@
---
- name: create bootstrap directories
file:
path: "{{ item }}"
state: directory
owner: "64045"
group: "64045"
mode: "0755"
with_items:
- /etc/ceph
- /var/lib/ceph/mgr
- /var/lib/ceph/mgr/{{ cluster }}-{{ ansible_hostname }}

View File

@ -1,43 +0,0 @@
---
- name: set config and keys paths
set_fact:
ceph_config_keys:
- /etc/ceph/{{ cluster }}.conf
- /etc/ceph/{{ cluster }}.mgr.{{ ansible_hostname }}.keyring
- name: stat for ceph config and keys
local_action: stat path={{ fetch_directory }}/docker_mon_files/{{ item }}
with_items: "{{ ceph_config_keys }}"
changed_when: false
become: false
failed_when: false
always_run: true
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: 0644
changed_when: false
with_together:
- "{{ ceph_config_keys }}"
- "{{ statconfig.results }}"
when: item.1.stat.exists == true
- name: "copy mgr key to /var/lib/ceph/mgr/{{ cluster }}-{{ ansible_hostname }}/keyring"
command: cp /etc/ceph/{{ cluster }}.mgr.{{ ansible_hostname }}.keyring /var/lib/ceph/mgr/{{ cluster }}-{{ ansible_hostname }}/keyring
changed_when: false
always_run: true
with_items: "{{ statconfig.results }}"
when: item.stat.exists == true
- name: set ceph mgr key permission
file:
path: "/var/lib/ceph/mgr/{{ cluster }}-{{ ansible_hostname }}/keyring"
owner: "{{ bootstrap_dirs_owner }}"
group: "{{ bootstrap_dirs_group }}"
mode: "0600"
when: cephx

View File

@ -1,14 +0,0 @@
---
- name: check if selinux is enabled
command: getenforce
register: sestatus
changed_when: false
always_run: true
- name: set selinux permissions
shell: chcon -Rt svirt_sandbox_file_t {{ item }}
with_items:
- /etc/ceph
- /var/lib/ceph
changed_when: false
when: sestatus.stdout != 'Disabled'

View File

@ -1,13 +0,0 @@
---
- name: create bootstrap directories
file:
path: "{{ item }}"
state: directory
owner: "{{ bootstrap_dirs_owner }}"
group: "{{ bootstrap_dirs_group }}"
mode: "0755"
with_items:
- /etc/ceph/
- /var/lib/ceph/bootstrap-osd
- /var/lib/ceph/bootstrap-mds
- /var/lib/ceph/bootstrap-rgw

View File

@ -1,50 +0,0 @@
---
- name: set config and keys paths
set_fact:
ceph_config_keys:
- /etc/ceph/{{ cluster }}.conf
- /etc/ceph/{{ cluster }}.client.admin.keyring
- /etc/ceph/monmap-{{ cluster }}
- /etc/ceph/{{ cluster }}.mon.keyring
- /var/lib/ceph/bootstrap-osd/{{ cluster }}.keyring
- /var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring
- /var/lib/ceph/bootstrap-mds/{{ cluster }}.keyring
- name: add mgr keys to config and keys paths
set_fact:
tmp_ceph_mgr_keys: /etc/ceph/{{ cluster }}.mgr.{{ hostvars[item]['ansible_hostname'] }}.keyring
with_items: "{{ groups.get(mgr_group_name, []) }}"
register: tmp_ceph_mgr_keys_result
when: "{{ groups.get(mgr_group_name, []) | length > 0 }}"
- name: convert mgr keys to an array
set_fact:
ceph_mgr_keys: "{{ tmp_ceph_mgr_keys_result.results | map(attribute='ansible_facts.tmp_ceph_mgr_keys') | list }}"
when: "{{ groups.get(mgr_group_name, []) | length > 0 }}"
- name: merge mgr keys to config and keys paths
set_fact:
ceph_config_keys: "{{ ceph_config_keys + ceph_mgr_keys }}"
when: "{{ groups.get(mgr_group_name, []) | length > 0 }}"
- name: stat for ceph config and keys
local_action: stat path={{ fetch_directory }}/docker_mon_files/{{ item }}
with_items: "{{ ceph_config_keys }}"
changed_when: false
become: false
failed_when: false
register: statconfig
always_run: true
- 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: 0644
changed_when: false
with_together:
- "{{ ceph_config_keys }}"
- "{{ statconfig.results }}"
when: item.1.stat.exists == true

View File

@ -27,7 +27,7 @@
- name: create ceph rest api keyring when mon is containerized - name: create ceph rest api keyring when mon is containerized
command: docker exec ceph-mon-{{ ansible_hostname }} ceph --cluster {{ cluster }} auth get-or-create client.restapi osd 'allow *' mon 'allow *' -o /etc/ceph/{{ cluster }}.client.restapi.keyring command: docker exec ceph-mon-{{ ansible_hostname }} ceph --cluster {{ cluster }} auth get-or-create client.restapi osd 'allow *' mon 'allow *' -o /etc/ceph/{{ cluster }}.client.restapi.keyring
args: args:
creates: /etc/ceph/{{ cluster }}.client.restapi.keyring creates: "{{ ceph_conf_key_directory }}/{{ cluster }}.client.restapi.keyring"
changed_when: false changed_when: false
when: when:
- cephx - cephx
@ -48,7 +48,7 @@
- name: create ceph mgr keyring(s) when mon is containerized - name: create ceph mgr keyring(s) when mon is containerized
command: docker exec ceph-mon-{{ ansible_hostname }} ceph --cluster {{ cluster }} auth get-or-create mgr.{{ hostvars[item]['ansible_hostname'] }} mon 'allow profile mgr' osd 'allow *' mds 'allow *' -o /etc/ceph/{{ cluster }}.mgr.{{ hostvars[item]['ansible_hostname'] }}.keyring command: docker exec ceph-mon-{{ ansible_hostname }} ceph --cluster {{ cluster }} auth get-or-create mgr.{{ hostvars[item]['ansible_hostname'] }} mon 'allow profile mgr' osd 'allow *' mds 'allow *' -o /etc/ceph/{{ cluster }}.mgr.{{ hostvars[item]['ansible_hostname'] }}.keyring
args: args:
creates: /etc/ceph/{{ cluster }}.mgr.{{ hostvars[item]['ansible_hostname'] }}.keyring creates: "{{ ceph_conf_key_directory }}/{{ cluster }}.mgr.{{ hostvars[item]['ansible_hostname'] }}.keyring"
changed_when: false changed_when: false
when: when:
- cephx - cephx
@ -59,7 +59,7 @@
- name: stat for ceph mgr key(s) - name: stat for ceph mgr key(s)
stat: stat:
path: /etc/ceph/{{ cluster }}.mgr.{{ hostvars[item]['ansible_hostname'] }}.keyring path: "{{ ceph_conf_key_directory }}/{{ cluster }}.mgr.{{ hostvars[item]['ansible_hostname'] }}.keyring"
with_items: "{{ groups.get(mgr_group_name, []) }}" with_items: "{{ groups.get(mgr_group_name, []) }}"
changed_when: false changed_when: false
become: false become: false
@ -71,7 +71,7 @@
- name: push ceph mgr key(s) - name: push ceph mgr key(s)
fetch: fetch:
src: "/etc/ceph/{{ cluster }}.mgr.{{ hostvars[item.item]['ansible_hostname'] }}.keyring" src: "{{ ceph_conf_key_directory }}/{{ cluster }}.mgr.{{ hostvars[item.item]['ansible_hostname'] }}.keyring"
dest: "{{ fetch_directory }}/docker_mon_files/{{ item.stat.path }}" dest: "{{ fetch_directory }}/docker_mon_files/{{ item.stat.path }}"
flat: yes flat: yes
with_items: with_items:

View File

@ -1,14 +0,0 @@
---
- name: check if selinux is enabled
command: getenforce
register: sestatus
changed_when: false
always_run: true
- name: set selinux permissions
shell: chcon -Rt svirt_sandbox_file_t {{ item }}
with_items:
- /etc/ceph
- /var/lib/ceph
changed_when: false
when: sestatus.stdout != 'Disabled'

View File

@ -1,24 +0,0 @@
---
- name: create bootstrap directories
file:
path: "{{ item }}"
state: directory
owner: "{{ bootstrap_dirs_owner }}"
group: "{{ bootstrap_dirs_group }}"
mode: "0755"
with_items:
- /etc/ceph/
- /var/lib/ceph/
- /var/lib/ceph/radosgw
- name: create ganesha directories
file:
path: "{{ item }}"
state: directory
owner: root
group: root
mode: "0755"
with_items:
- /etc/ganesha/
- /var/lib/nfs/ganesha
- /var/run/ganesha

View File

@ -1,37 +0,0 @@
---
- name: set config paths
set_fact:
nfs_config_keys:
- /etc/ganesha/ganesha.conf
- name: stat for config and keys
local_action: stat path={{ fetch_directory }}/docker_mon_files/{{ item }}
with_items: "{{ nfs_config_keys }}"
changed_when: false
become: false
failed_when: false
always_run: true
register: statconfig
- name: try to fetch config and keys
copy:
src: "{{ fetch_directory }}/docker_mon_files/{{ item.0 }}"
dest: "{{ item.0 }}"
owner: root
group: root
mode: 0644
changed_when: false
with_together:
- "{{ nfs_config_keys }}"
- "{{ statconfig.results }}"
when: item.1.stat.exists == true
- name: push ganesha files to the ansible server
fetch:
src: "{{ item.0 }}"
dest: "{{ fetch_directory }}/docker_mon_files/{{ item.0 }}"
flat: yes
with_together:
- "{{ nfs_config_keys }}"
- "{{ statconfig.results }}"
when: item.1.stat.exists == false

View File

@ -1,17 +0,0 @@
---
- name: check if selinux is enabled
command: getenforce
register: sestatus
changed_when: false
always_run: true
- name: set selinux permissions
shell: chcon -Rt svirt_sandbox_file_t {{ item }}
with_items:
- /etc/ceph
- /etc/ganesha
- /var/lib/ceph
- /var/lib/nfs/ganesha
- /var/run/ganesha
changed_when: false
when: sestatus.stdout != 'Disabled'

View File

@ -1,11 +0,0 @@
---
- name: create bootstrap directories
file:
path: "{{ item }}"
state: directory
owner: "{{ bootstrap_dirs_owner }}"
group: "{{ bootstrap_dirs_group }}"
mode: "0755"
with_items:
- /etc/ceph/
- /var/lib/ceph/bootstrap-osd

View File

@ -1,32 +0,0 @@
---
- name: set config and keys paths
set_fact:
ceph_config_keys:
- /etc/ceph/{{ cluster }}.conf
- /var/lib/ceph/bootstrap-osd/{{ cluster }}.keyring
- name: wait for ceph.conf and keys
local_action: >
wait_for
path="{{ fetch_directory }}/docker_mon_files/{{ item.0 }}"
become: false
with_items: "{{ ceph_config_keys }}"
- name: stat for ceph config and keys
local_action: stat path={{ fetch_directory }}/docker_mon_files/{{ item }}
with_items: "{{ ceph_config_keys }}"
changed_when: false
become: false
failed_when: false
always_run: true
register: statconfig
- name: try to copy ceph config and keys
copy:
src: "{{ fetch_directory }}/docker_mon_files/{{ item.0 }}"
dest: "{{ item.0 }}"
owner: root
group: root
mode: 0644
changed_when: false
with_items: "{{ ceph_config_keys }}"

View File

@ -1,14 +0,0 @@
---
- name: check if selinux is enabled
command: getenforce
register: sestatus
changed_when: false
always_run: true
- name: set selinux permissions
shell: chcon -Rt svirt_sandbox_file_t {{ item }}
with_items:
- /etc/ceph
- /var/lib/ceph
changed_when: false
when: sestatus.stdout != 'Disabled'

View File

@ -1,10 +0,0 @@
---
- name: create bootstrap directories
file:
path: "{{ item }}"
state: directory
owner: "{{ bootstrap_dirs_owner }}"
group: "{{ bootstrap_dirs_group }}"
mode: "0755"
with_items:
- /etc/ceph/

View File

@ -1,30 +0,0 @@
---
# NOTE (leseb): the mds container needs the admin key
# so it can create the mds pools for cephfs
- name: set config and keys paths
set_fact:
ceph_config_keys:
- /etc/ceph/{{ cluster }}.conf
- /etc/ceph/{{ cluster }}.client.admin.keyring
- name: stat for ceph config and keys
local_action: stat path={{ fetch_directory }}/docker_mon_files/{{ item }}
with_items: "{{ ceph_config_keys }}"
changed_when: false
become: false
failed_when: false
always_run: true
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: 0644
changed_when: false
with_together:
- "{{ ceph_config_keys }}"
- "{{ statconfig.results }}"
when: item.1.stat.exists == true

View File

@ -1,13 +0,0 @@
---
- name: check if selinux is enabled
command: getenforce
register: sestatus
changed_when: false
always_run: true
- name: set selinux permissions
shell: chcon -Rt svirt_sandbox_file_t {{ item }}
with_items:
- /etc/ceph
changed_when: false
when: sestatus.stdout != 'Disabled'

View File

@ -1,13 +0,0 @@
---
- name: create bootstrap directories
file:
path: "{{ item }}"
state: directory
owner: "{{ bootstrap_dirs_owner }}"
group: "{{ bootstrap_dirs_group }}"
mode: "0755"
with_items:
- /etc/ceph/
- /var/lib/ceph/bootstrap-osd
- /var/lib/ceph/bootstrap-mds
- /var/lib/ceph/bootstrap-rgw

View File

@ -1,28 +0,0 @@
---
- name: set config and keys paths
set_fact:
ceph_config_keys:
- /etc/ceph/{{ cluster }}.conf
- /etc/ceph/{{ cluster }}.client.admin.keyring
- name: stat for ceph config and keys
local_action: stat path={{ fetch_directory }}/docker_mon_files/{{ item }}
with_items: "{{ ceph_config_keys }}"
changed_when: false
become: false
ignore_errors: true
register: statconfig
always_run: true
- name: try to fetch ceph config and keys
copy:
src: "{{ playbook_dir }}/{{ fetch_directory }}/docker_mon_files/{{ item.0 }}"
dest: "{{ item.0 }}"
owner: root
group: root
mode: 0644
changed_when: false
with_together:
- "{{ ceph_config_keys }}"
- "{{ statconfig.results }}"
when: item.1.stat.exists == true

View File

@ -1,11 +0,0 @@
---
- name: create bootstrap directories
file:
path: "{{ item }}"
state: directory
owner: "{{ bootstrap_dirs_owner }}"
group: "{{ bootstrap_dirs_group }}"
mode: "0755"
with_items:
- /etc/ceph/
- /var/lib/ceph/bootstrap-rgw

View File

@ -1,28 +0,0 @@
---
- name: set config and keys paths
set_fact:
ceph_config_keys:
- /etc/ceph/{{ cluster }}.conf
- /var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring
- name: stat for ceph config and keys
local_action: stat path={{ fetch_directory }}/docker_mon_files/{{ item }}
with_items: "{{ ceph_config_keys }}"
changed_when: false
become: false
ignore_errors: true
always_run: true
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: 0644
changed_when: false
with_together:
- "{{ ceph_config_keys }}"
- "{{ statconfig.results }}"
when: item.1.stat.exists == true

View File

@ -1,14 +0,0 @@
---
- name: check if selinux is enabled
command: getenforce
register: sestatus
changed_when: false
always_run: true
- name: set selinux permissions
shell: chcon -Rt svirt_sandbox_file_t {{ item }}
with_items:
- /etc/ceph
- /var/lib/ceph
changed_when: false
when: sestatus.stdout != 'Disabled'