-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do you write your hosts? #23
Comments
@collinglass In defaults, it says it has to be a But I actually came here because I am having trouble dynamically creating (in jinja) a variable that holds a List of dict. The Ansible issue #10098 suggest that this is currently a bug in Ansible? Is it possible to do this? Or should this project change to a different form of host specification? This is some debug code I was using, which seems like it should work, except that Ansible is treating it as a string:
From which I get:
Is there a better way to do this? |
@collinglass @hinchliff This is how I did: - hosts: zookeepers
gather_facts: no
vars:
zookeeper_hosts: "
{%- set ips = [] %}
{%- for zk in groups['zookeepers'] %}
{{- ips.append(dict(host=zk, id=loop.index)) }}
{%- endfor %}
{{- ips -}}
"
tasks:
- debug: var=zookeeper_hosts What I have found out is I had to use TASK [debug var=zookeeper_hosts] ***********************************************
ok: [zookeeper03.domain.net] => {
"changed": false,
"zookeeper_hosts": [
{
"host": "zookeeper01.domain.net",
"id": 1
},
{
"host": "zookeeper02.domain.net",
"id": 2
},
{
"host": "zookeeper03.domain.net",
"id": 3
}
]
} |
just fyi, I removed ".host" like below snippets(last 3line) in https://github.com/AnsibleShipyard/ansible-zookeeper/blob/master/templates/zoo.cfg.j2 then variable {% for server in zookeeper_hosts %}
server.{{loop.index}}={{server}}:2888:3888
{% endfor %} |
@ryoichitaniguchi @collinglass role now support both hash lists and array of hosts https://github.com/AnsibleShipyard/ansible-zookeeper/releases/tag/v0.9.2 |
I'm getting this error:
My hosts file is:
How do I write my hosts file so it acknowledges the host name?
The text was updated successfully, but these errors were encountered: