Skip to content
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

Dynamic Inventory #1

Open
gvenka008c opened this issue Feb 16, 2016 · 5 comments
Open

Dynamic Inventory #1

gvenka008c opened this issue Feb 16, 2016 · 5 comments

Comments

@gvenka008c
Copy link

@sttts I was looking at your mesos repo [compute-platform/roles/mesos/tasks/]. How do you build your inventory? Are you using the dynamic inventory? Do you have any script that constructs your inventory file dynamically?

Thanks,
Govind

@sttts
Copy link
Owner

sttts commented Feb 16, 2016

I just have a static file with one line per host (with the IPs) and a list of hosts per role.

@gvenka008c
Copy link
Author

@sttts Thanks.

@gvenka008c
Copy link
Author

@sttts so is this script run against the static inventory file?

zk://
{%- for host in groups['mesos_masters'] -%}
{{ hostvars[host]['private_ip'] }}:2181{% if not loop.last %},{% endif %}
{%- endfor -%}
/mesos

@gvenka008c
Copy link
Author

@sttts I got the error as below when using the code
zk://
{%- for host in groups['mesos_masters'] -%}
{{ hostvars[host]['private_ip'] }}:2181{% if not loop.last %},{% endif %}
{%- endfor -%}
/mesos

Error:
fatal: [067cea8f-3725-40ff-aa02-675c54d988da]: FAILED! => {"changed": false, "failed": true, "msg": "AnsibleUndefinedVariable: ERROR! 'dict object' has no attribute 'private_ip'"}

@sttts
Copy link
Owner

sttts commented Feb 17, 2016

Here is some example:

[servers:vars]
domain=example.com

private_netdev=eth0:0
private_network=192.168.128.0
private_netmask=255.255.128.0
private_broadcast=192.168.255.255
weave_network_width=9

openvpn_route_netdev=tun0
openvpn_route_network=["10.0.0.0","192.168.128.0"]
openvpn_route_netmask=["255.128.0.0","255.255.128.0"]
openvpn_cidr=10.128.0.0/24
openvpn_client_network=10.128.0.0
openvpn_client_netmask=255.255.255.0
openvpn_nameserver=10.0.0.1

ansible_ssh_user=root

[email protected]
postfix_smartpass=secretpassword
postfix_smarthost=smtp.gmail.com

ganglia_clustername=example.com
ganglia_clusterowner="Dr. Stefan Schimanski"

papertrail_host=logs2
papertrail_port=12345

mesos_slave_ports=["20000-32000"]

nameservers=["109.74.192.20","109.74.193.20","109.74.194.20"]

root_authorized_keys="ssh-rsa SomESShPublICKey [email protected]"

haproxy_certificate_files=["ssl/exmaple.com.pem"]

[servers]
master1 ansible_ssh_host=109.74.196.73 private_ip=192.168.154.24 weave_ip=10.0.0.1 weave_container_cidr=10.1.0.0/16 public_host=master1.example.com
master2 ansible_ssh_host=178.79.164.23 private_ip=192.168.166.109 weave_ip=10.0.0.2 weave_container_cidr=10.2.0.0/16  public_host=master2.example.com
master3 ansible_ssh_host=176.58.102.53 private_ip=192.168.165.78 weave_ip=10.0.0.3 weave_container_cidr=10.3.0.0/16  public_host=master3.example.com

[openvpn_gateways]
master1

[mesos_masters]
master1 zoo_id=1
master2 zoo_id=2
master3 zoo_id=3

[compute_nodes]
master1
master2
master3

[gluster_nodes]
master1
master2
master3

#[ganglia_servers]
#install
#
#[install_servers]
#install

[galera_servers]
master1
master2
master3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants