Merge "Remove storage_hostname"

This commit is contained in:
Jenkins 2016-03-09 17:12:21 +00:00 committed by Gerrit Code Review
commit a82e7b1239
7 changed files with 10 additions and 17 deletions

View File

@ -33,6 +33,7 @@
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
OSD_DEV: "{{ item.1.device }}" OSD_DEV: "{{ item.1.device }}"
OSD_INITIAL_WEIGHT: "{{ osd_initial_weight }}" OSD_INITIAL_WEIGHT: "{{ osd_initial_weight }}"
HOSTNAME: "{{ hostvars[inventory_hostname]['ansible_' + storage_interface]['ipv4']['address'] }}"
image: "{{ ceph_osd_image_full }}" image: "{{ ceph_osd_image_full }}"
labels: labels:
BOOTSTRAP: BOOTSTRAP:
@ -55,6 +56,7 @@
CEPH_CACHE: CEPH_CACHE:
OSD_DEV: "{{ item.1.device }}" OSD_DEV: "{{ item.1.device }}"
OSD_INITIAL_WEIGHT: "{{ osd_initial_weight }}" OSD_INITIAL_WEIGHT: "{{ osd_initial_weight }}"
HOSTNAME: "{{ hostvars[inventory_hostname]['ansible_' + storage_interface]['ipv4']['address'] }}"
image: "{{ ceph_osd_image_full }}" image: "{{ ceph_osd_image_full }}"
labels: labels:
BOOTSTRAP: BOOTSTRAP:

View File

@ -8,7 +8,7 @@
KOLLA_BOOTSTRAP: KOLLA_BOOTSTRAP:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
MON_IP: "{{ hostvars[inventory_hostname]['ansible_' + storage_interface]['ipv4']['address'] }}" MON_IP: "{{ hostvars[inventory_hostname]['ansible_' + storage_interface]['ipv4']['address'] }}"
HOSTNAME: "{{ storage_hostname }}" HOSTNAME: "{{ hostvars[inventory_hostname]['ansible_' + storage_interface]['ipv4']['address'] }}"
image: "{{ ceph_mon_image_full }}" image: "{{ ceph_mon_image_full }}"
labels: labels:
BOOTSTRAP: BOOTSTRAP:

View File

@ -5,7 +5,7 @@
common_options: "{{ docker_common_options }}" common_options: "{{ docker_common_options }}"
environment: environment:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
HOSTNAME: "{{ storage_hostname }}" HOSTNAME: "{{ hostvars[inventory_hostname]['ansible_' + storage_interface]['ipv4']['address'] }}"
image: "{{ ceph_mon_image_full }}" image: "{{ ceph_mon_image_full }}"
name: "ceph_mon" name: "ceph_mon"
volumes: volumes:

View File

@ -1,5 +1,5 @@
{ {
"command": "/usr/bin/ceph-mon -d -i {{ storage_hostname }} --public-addr {{ hostvars[inventory_hostname]['ansible_' + storage_interface]['ipv4']['address'] }}:6789", "command": "/usr/bin/ceph-mon -d -i {{ hostvars[inventory_hostname]['ansible_' + storage_interface]['ipv4']['address'] }} --public-addr {{ hostvars[inventory_hostname]['ansible_' + storage_interface]['ipv4']['address'] }}:6789",
"config_files": [ "config_files": [
{ {
"source": "{{ container_config_directory }}/ceph.conf", "source": "{{ container_config_directory }}/ceph.conf",

View File

@ -1,8 +1,8 @@
[global] [global]
fsid = {{ ceph_cluster_fsid }} fsid = {{ ceph_cluster_fsid }}
mon initial members = {% for host in groups['ceph-mon'] %}{{ hostvars[host]['storage_hostname'] }}{% if not loop.last %}, {% endif %}{% endfor %} mon initial members = {% for host in groups['ceph-mon'] %}{{ hostvars[host]['ansible_' + hostvars[host]['storage_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 host = {% for host in groups['ceph-mon'] %}{{ hostvars[host]['ansible_' + hostvars[host]['storage_interface']]['ipv4']['address'] }}{% 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 %} mon addr = {% for host in groups['ceph-mon'] %}{{ hostvars[host]['ansible_' + hostvars[host]['storage_interface']]['ipv4']['address'] }}:6789{% if not loop.last %}, {% endif %}{% endfor %}

View File

@ -1,13 +1,4 @@
--- ---
- name: Looking up storage 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 - name: Ensuring config directories exist
file: file:
path: "{{ node_config_directory }}/{{ item }}" path: "{{ node_config_directory }}/{{ item }}"

View File

@ -44,11 +44,11 @@ if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then
# These commands only need to be run once per host but are safe to run # These commands only need to be run once per host but are safe to run
# repeatedly. This can be improved later or if any problems arise. # repeatedly. This can be improved later or if any problems arise.
ceph osd crush add-bucket "$(hostname)${CEPH_ROOT_NAME:+-${CEPH_ROOT_NAME}}" host ceph osd crush add-bucket "${HOSTNAME}${CEPH_ROOT_NAME:+-${CEPH_ROOT_NAME}}" host
ceph osd crush move "$(hostname)${CEPH_ROOT_NAME:+-${CEPH_ROOT_NAME}}" root=${CEPH_ROOT_NAME:-default} ceph osd crush move "${HOSTNAME}${CEPH_ROOT_NAME:+-${CEPH_ROOT_NAME}}" root=${CEPH_ROOT_NAME:-default}
# Adding osd to crush map # Adding osd to crush map
ceph osd crush add "${OSD_ID}" "${OSD_INITIAL_WEIGHT}" host="$(hostname)${CEPH_ROOT_NAME:+-${CEPH_ROOT_NAME}}" ceph osd crush add "${OSD_ID}" "${OSD_INITIAL_WEIGHT}" host="${HOSTNAME}${CEPH_ROOT_NAME:+-${CEPH_ROOT_NAME}}"
exit 0 exit 0
fi fi