Skip to content

Commit

Permalink
config: add host-specific ceph_conf_overrides evaluation and generation.
Browse files Browse the repository at this point in the history
This allows us to use host-specific variables in ceph_conf_overrides variable. For example, this fixes usage of such variables (e.g. 'nss db path' having {{ ansible_hostname }} inside) in ceph_conf_overrides for rados gateway configuration (see profiles/rgw-keystone-v3) - issue ceph#2157.

Signed-off-by: Eduard Egorov <eduard.egorov@icl-services.com>
  • Loading branch information
eduardegorov committed Nov 13, 2017
1 parent 4c2d98f commit 9bce1cc
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions roles/ceph-config/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,28 @@
- /etc/ceph/ceph.d/

- name: template ceph_conf_overrides
local_action: copy content="{{ ceph_conf_overrides }}" dest="{{ fetch_directory }}/ceph_conf_overrides_temp"
become: false
run_once: true
copy:
content: "{{ ceph_conf_overrides }}"
dest: "/tmp/ceph_conf_overrides_temp_{{ ansible_hostname }}"

- name: copy tmp template file for ceph_conf_overrides to the ansible server
fetch:
src: "/tmp/ceph_conf_overrides_temp_{{ ansible_hostname }}"
dest: "{{ fetch_directory }}/{{ fsid }}/ceph_conf_overrides_temp_{{ ansible_hostname }}"
flat: yes

- name: get rendered ceph_conf_overrides
local_action: set_fact ceph_conf_overrides_rendered="{{ lookup('template', '{{ fetch_directory }}/ceph_conf_overrides_temp') | from_yaml }}"
become: false
run_once: true
set_fact:
ceph_conf_overrides_rendered: "{{ lookup('template', '{{ fetch_directory }}/{{ fsid }}/ceph_conf_overrides_temp_{{ ansible_hostname }}') | from_yaml }}"

- name: remove tmp template file for ceph_conf_overrides
local_action: file path="{{ fetch_directory }}/ceph_conf_overrides_temp" state=absent
file:
path: "/tmp/ceph_conf_overrides_temp_{{ ansible_hostname }}"
state: absent

- name: remove tmp template file for ceph_conf_overrides (localhost)
local_action: file path="{{ fetch_directory }}/{{ fsid }}/ceph_conf_overrides_temp_{{ ansible_hostname }}" state=absent
become: false
run_once: true

- name: "generate ceph configuration file: {{ cluster }}.conf"
action: config_template
Expand Down

0 comments on commit 9bce1cc

Please sign in to comment.