Created
November 26, 2019 11:21
-
-
Save mohclips/9eefe2172a79245045b57a882927fd46 to your computer and use it in GitHub Desktop.
Read a remote yaml file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- hosts: search_master, search_data | |
serial: 1 # run one at a time | |
gather_facts: false | |
become: yes | |
vars: | |
# cannot be done as lookup are only on the Ansible controller | |
#config: "{{ lookup('file','/etc/elasticsearch/elasticsearch.yml') | from_yaml }}" | |
tasks: | |
- command: > | |
cat /etc/elasticsearch/elasticsearch.yml | |
register: | |
raw_config | |
- name: output | |
vars: | |
config: "{{ raw_config.stdout | from_yaml }}" | |
debug: | |
var: config['cluster.name'] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment