--- # It is possible to set these are defaults with messy jinja templating one liners however: # 1. That is really hard to read and debug # 2. When running multiple plays with the same role the defaults are not re-evaluated. An example of this # can be seen in our the https://github.com/elastic/ansible-elasticsearch/blob/master/test/integration/xpack.yml # integration test and in the Multi Node server documentation examples https://github.com/elastic/ansible-elasticsearch/blob/master/test/integration/xpack.yml - name: Set backward compatibility for deprecated es_enable_xpack variable when: es_enable_xpack is defined and not es_enable_xpack block: - name: Set fact oss_version when using es_enable_xpack set_fact: oss_version=true - name: Warn about deprecated es_enable_xpack variable debug: msg: "WARNING: es_enable_xpack variable is now deprecated. You should use oss_version instead" - name: Set the defaults here otherwise they can't be overriden in the same play if the role is called twice set_fact: es_repo_name: "{{ es_major_version }}" es_package_name: "elasticsearch" es_other_package_name: "elasticsearch-oss" es_other_repo_name: "{{ 'oss-' + es_major_version }}" es_other_apt_url: "deb {{ es_repo_base }}/packages/{{ 'oss-' + es_major_version }}/apt stable main" - name: Use the oss repo and package set_fact: es_repo_name: "{{ 'oss-' + es_major_version }}" es_other_repo_name: "{{ es_major_version }}" es_other_apt_url: "deb {{ es_repo_base }}/packages/{{ es_major_version }}/apt stable main" es_package_name: "elasticsearch-oss" es_other_package_name: "elasticsearch" when: - oss_version - name: Set the URL scheme to https if SSL/TLS is enabled set_fact: es_api_scheme: "https" when: es_enable_http_ssl | bool