Merge pull request #643 from ceph/monitor-ip

Provide the ability to provide monitor_address instead of an interface
pull/640/merge
Leseb 2016-03-23 13:38:44 +01:00
commit 29c07c1d4c
8 changed files with 29 additions and 5 deletions

View File

@ -191,7 +191,10 @@ dummy:
## Monitor options ## Monitor options
# #
# You must define either monitor_interface or monitor_address. Preference
# will go to monitor_interface if both are defined.
#monitor_interface: interface #monitor_interface: interface
#monitor_address: 0.0.0.0
#mon_use_fqdn: false # if set to true, the MON name used will be the fqdn in the ceph.conf #mon_use_fqdn: false # if set to true, the MON name used will be the fqdn in the ceph.conf
#mon_osd_down_out_interval: 600 #mon_osd_down_out_interval: 600
#mon_osd_min_down_reporters: 7 # number of OSDs per host + 1 #mon_osd_min_down_reporters: 7 # number of OSDs per host + 1
@ -286,6 +289,7 @@ dummy:
## REST API options ## REST API options
# #
#restapi_interface: "{{ monitor_interface }}" #restapi_interface: "{{ monitor_interface }}"
#restapi_address: "{{ monitor_address }}"
#restapi_port: 5000 #restapi_port: 5000
#restapi_base_url: /api/v0.1 #restapi_base_url: /api/v0.1
#restapi_log_level: warning # available level are: critical, error, warning, info, debug #restapi_log_level: warning # available level are: critical, error, warning, info, debug

View File

@ -183,7 +183,10 @@ rbd_default_format: 2
## Monitor options ## Monitor options
# #
# You must define either monitor_interface or monitor_address. Preference
# will go to monitor_interface if both are defined.
monitor_interface: interface monitor_interface: interface
monitor_address: 0.0.0.0
mon_use_fqdn: false # if set to true, the MON name used will be the fqdn in the ceph.conf mon_use_fqdn: false # if set to true, the MON name used will be the fqdn in the ceph.conf
mon_osd_down_out_interval: 600 mon_osd_down_out_interval: 600
mon_osd_min_down_reporters: 7 # number of OSDs per host + 1 mon_osd_min_down_reporters: 7 # number of OSDs per host + 1
@ -278,6 +281,7 @@ email_address: foo@bar.com
## REST API options ## REST API options
# #
restapi_interface: "{{ monitor_interface }}" restapi_interface: "{{ monitor_interface }}"
restapi_address: "{{ monitor_address }}"
restapi_port: 5000 restapi_port: 5000
restapi_base_url: /api/v0.1 restapi_base_url: /api/v0.1
restapi_log_level: warning # available level are: critical, error, warning, info, debug restapi_log_level: warning # available level are: critical, error, warning, info, debug

View File

@ -38,11 +38,12 @@
journal_size|int == 0 and journal_size|int == 0 and
osd_group_name in group_names osd_group_name in group_names
- name: make sure monitor_interface configured - name: make sure monitor_interface or monitor_address is configured
fail: fail:
msg: "monitor_interface must be configured. Interface for the monitor to listen on" msg: "monitor_interface or monitor_address must be configured. Interface for the monitor to listen on or IP address of that interface"
when: when:
monitor_interface == 'interface' and monitor_interface == 'interface' and
monitor_address == '0.0.0.0' and
mon_group_name in group_names mon_group_name in group_names
- name: make sure cluster_network configured - name: make sure cluster_network configured

View File

@ -92,11 +92,14 @@ debug auth = {{ debug_mon_level }}
{% if hostvars[host]['ansible_fqdn'] is defined and mon_use_fqdn %} {% if hostvars[host]['ansible_fqdn'] is defined and mon_use_fqdn %}
[mon.{{ hostvars[host]['ansible_fqdn'] }}] [mon.{{ hostvars[host]['ansible_fqdn'] }}]
host = {{ hostvars[host]['ansible_fqdn'] }} host = {{ hostvars[host]['ansible_fqdn'] }}
mon addr = {{ hostvars[host]['ansible_' + (hostvars[host]['monitor_interface'] if hostvars[host]['monitor_interface'] is defined else monitor_interface) ]['ipv4']['address'] }}
{% elif hostvars[host]['ansible_hostname'] is defined %} {% elif hostvars[host]['ansible_hostname'] is defined %}
[mon.{{ hostvars[host]['ansible_hostname'] }}] [mon.{{ hostvars[host]['ansible_hostname'] }}]
host = {{ hostvars[host]['ansible_hostname'] }} host = {{ hostvars[host]['ansible_hostname'] }}
mon addr = {{ hostvars[host]['ansible_' + (hostvars[host]['monitor_interface'] if hostvars[host]['monitor_interface'] is defined else monitor_interface) ]['ipv4']['address'] }} {% endif %}
{% if monitor_interface != "interface" %}
{% include 'mon_addr_interface.j2' %}
{% else %}
{% include 'mon_addr_address.j2' %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
@ -198,7 +201,11 @@ nss db path = {{ radosgw_nss_db_path }}
{% if groups[restapi_group_name] is defined %} {% if groups[restapi_group_name] is defined %}
[client.restapi] [client.restapi]
public addr = {{ hostvars[inventory_hostname]['ansible_' + restapi_interface]['ipv4']['address'] }}:{{ restapi_port }} {% if restapi_interface != "interface" %}
{% include 'client_restapi_interface.j2' %}
{% else %}
{% include 'client_restapi_address.j2' %}
{% endif %}
restapi base url = {{ restapi_base_url }} restapi base url = {{ restapi_base_url }}
restapi log level = {{ restapi_log_level }} restapi log level = {{ restapi_log_level }}
keyring = /var/lib/ceph/restapi/ceph-restapi/keyring keyring = /var/lib/ceph/restapi/ceph-restapi/keyring

View File

@ -0,0 +1,2 @@
public addr = {{ hostvars[inventory_hostname]['restapi_address'] if hostvars[inventory_hostname]['restapi_address'] is defined else restapi_address }}:{{ restapi_port }}

View File

@ -0,0 +1,2 @@
public addr = {{ hostvars[inventory_hostname]['ansible_' + restapi_interface]['ipv4']['address'] }}:{{ restapi_port }}

View File

@ -0,0 +1,2 @@
mon addr = {{ hostvars[host]['monitor_address'] if hostvars[host]['monitor_address'] is defined else monitor_address }}

View File

@ -0,0 +1,2 @@
mon addr = {{ hostvars[host]['ansible_' + (hostvars[host]['monitor_interface'] if hostvars[host]['monitor_interface'] is defined else monitor_interface) ]['ipv4']['address'] }}