diff --git a/defaults/main.yml b/defaults/main.yml index 0544c84..9d2b515 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -31,6 +31,7 @@ solr_heap: 1024M # core, solrcloud. # Use 'core' when running standalone. solr_mode: core +solr_host_address: '{{ ansible_default_ipv4.address }}' solr_download_dir: '{{ solr_base_dir }}/download' solr_zookeeper_data_dir: '{{ solr_data_dir }}/zoo_data' solr_install_collection1: False diff --git a/templates/solr-default.j2 b/templates/solr-default.j2 index 6835a30..1289df0 100644 --- a/templates/solr-default.j2 +++ b/templates/solr-default.j2 @@ -61,9 +61,11 @@ ZK_HOST="{{ solr_zk_hosts }}" # Set the ZooKeeper client timeout (for SolrCloud mode) ZK_CLIENT_TIMEOUT="{{ solr_zk_timeout }}" +{% if solr_mode == solrcloud %} # By default the start script uses "localhost"; override the hostname here # for production SolrCloud environments to control the hostname exposed to cluster state -#SOLR_HOST="192.168.1.1" +SOLR_HOST="{{ solr_host_address }}" +{% endif %} # By default the start script uses UTC; override the timezone if needed #SOLR_TIMEZONE="UTC"