aboutsummaryrefslogtreecommitdiff
path: root/ansible
diff options
context:
space:
mode:
Diffstat (limited to 'ansible')
-rw-r--r--ansible/roles/ceph/tasks/config.yml9
-rw-r--r--ansible/roles/ceph/tasks/generate_cluster.yml14
-rw-r--r--ansible/roles/ceph/tasks/start_mons.yml3
-rw-r--r--ansible/roles/ceph/templates/ceph-mon.json.j22
-rw-r--r--ansible/roles/ceph/templates/ceph.conf.j210
5 files changed, 22 insertions, 16 deletions
diff --git a/ansible/roles/ceph/tasks/config.yml b/ansible/roles/ceph/tasks/config.yml
index 21ae654b9..d9af3a5c6 100644
--- a/ansible/roles/ceph/tasks/config.yml
+++ b/ansible/roles/ceph/tasks/config.yml
@@ -1,4 +1,13 @@
---
+- name: Looking up hostname
+ command: getent hosts {{ hostvars[inventory_hostname]['ansible_' + storage_interface]['ipv4']['address'] }}
+ changed_when: False
+ register: storage_hostname
+
+- name: Setting storage hostname
+ set_fact:
+ storage_hostname: "{{ storage_hostname.stdout.split()[1] }}"
+
- name: Ensuring config directories exist
file:
path: "{{ node_config_directory }}/{{ item }}"
diff --git a/ansible/roles/ceph/tasks/generate_cluster.yml b/ansible/roles/ceph/tasks/generate_cluster.yml
index 1556e08c3..44927bdea 100644
--- a/ansible/roles/ceph/tasks/generate_cluster.yml
+++ b/ansible/roles/ceph/tasks/generate_cluster.yml
@@ -7,7 +7,8 @@
environment:
KOLLA_BOOTSTRAP:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
- MON_IP: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}"
+ MON_IP: "{{ hostvars[inventory_hostname]['ansible_' + storage_interface]['ipv4']['address'] }}"
+ HOSTNAME: "{{ storage_hostname }}"
image: "{{ ceph_mon_image_full }}"
labels:
BOOTSTRAP:
@@ -18,16 +19,7 @@
- "ceph_mon:/var/lib/ceph"
- "ceph_mon_config:/etc/ceph"
-- name: Starting ceph-mon container
- kolla_docker:
- action: "start_container"
- common_options: "{{ docker_common_options }}"
- image: "{{ ceph_mon_image_full }}"
- name: "ceph_mon"
- volumes:
- - "{{ node_config_directory }}/ceph-mon/:{{ container_config_directory }}/:ro"
- - "ceph_mon:/var/lib/ceph"
- - "ceph_mon_config:/etc/ceph"
+- include: start_mons.yml
- name: Setting host for cluster files
set_fact:
diff --git a/ansible/roles/ceph/tasks/start_mons.yml b/ansible/roles/ceph/tasks/start_mons.yml
index be1548c96..e555d8d5d 100644
--- a/ansible/roles/ceph/tasks/start_mons.yml
+++ b/ansible/roles/ceph/tasks/start_mons.yml
@@ -3,6 +3,9 @@
kolla_docker:
action: "start_container"
common_options: "{{ docker_common_options }}"
+ environment:
+ KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
+ HOSTNAME: "{{ storage_hostname }}"
image: "{{ ceph_mon_image_full }}"
name: "ceph_mon"
volumes:
diff --git a/ansible/roles/ceph/templates/ceph-mon.json.j2 b/ansible/roles/ceph/templates/ceph-mon.json.j2
index 3ce4869e9..0821b575d 100644
--- a/ansible/roles/ceph/templates/ceph-mon.json.j2
+++ b/ansible/roles/ceph/templates/ceph-mon.json.j2
@@ -1,5 +1,5 @@
{
- "command": "/usr/bin/ceph-mon -d -i {{ ansible_hostname }} --public-addr {{ hostvars[inventory_hostname]['ansible_' + storage_interface]['ipv4']['address'] }}:6789",
+ "command": "/usr/bin/ceph-mon -d -i {{ storage_hostname }} --public-addr {{ hostvars[inventory_hostname]['ansible_' + storage_interface]['ipv4']['address'] }}:6789",
"config_files": [
{
"source": "{{ container_config_directory }}/ceph.conf",
diff --git a/ansible/roles/ceph/templates/ceph.conf.j2 b/ansible/roles/ceph/templates/ceph.conf.j2
index a91435a79..0f0cd7fbe 100644
--- a/ansible/roles/ceph/templates/ceph.conf.j2
+++ b/ansible/roles/ceph/templates/ceph.conf.j2
@@ -1,8 +1,10 @@
[global]
fsid = {{ ceph_cluster_fsid }}
-mon initial members = {% for host in groups['ceph-mon'] %}{{ hostvars[host]['ansible_hostname'] }}{% if not loop.last %}, {% endif %}{% endfor %}
+mon initial members = {% for host in groups['ceph-mon'] %}{{ hostvars[host]['storage_hostname'] }}{% if not loop.last %}, {% endif %}{% endfor %}
-mon host = {% for host in groups['ceph-mon'] %}{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}{% if not loop.last %}, {% endif %}{% endfor %}
+mon host = {% for host in groups['ceph-mon'] %}{{ hostvars[host]['storage_hostname'] }}{% if not loop.last %}, {% endif %}{% endfor %}
+
+mon addr = {% for host in groups['ceph-mon'] %}{{ hostvars[host]['ansible_' + hostvars[host]['storage_interface']]['ipv4']['address'] }}:6789{% if not loop.last %}, {% endif %}{% endfor %}
auth cluster required = cephx
auth service required = cephx
@@ -10,8 +12,8 @@ auth client required = cephx
{% if service_name is defined and service_name == 'ceph-rgw' %}
[client.radosgw.gateway]
-host = {{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}
+host = {{ hostvars[inventory_hostname]['ansible_' + storage_interface]['ipv4']['address'] }}
keyring = /etc/ceph/ceph.client.radosgw.keyring
log file = /var/log/radosgw/client.radosgw.gateway.log
-rgw frontends = civetweb port={{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}:{{ rgw_port }}
+rgw frontends = civetweb port={{ hostvars[inventory_hostname]['ansible_' + storage_interface]['ipv4']['address'] }}:{{ rgw_port }}
{% endif %}