theforeman / foreman_ansible_inventory

Foreman dynamic inventory script for ansible - Now merged into Ansible itself
GNU General Public License v3.0
70 stars 31 forks source link

Make Host and Host group parameters Ansible variables #1

Closed dLobatog closed 8 years ago

dLobatog commented 8 years ago

I think it'd be useful to access Foreman parameters as Ansible variables we can use in playbooks:

Something like this:

coreos-local-media.lobatolan.home etcd=https://discovery.etcd.io/a7b895a9491c2e2907a11b5a4104e470
[lobatolan.home-base/CoreOS cluster]
coreos-local-media.lobatolan.home 
[lobatolan.home-base/CoreOS cluster:vars]
ansible_python_interpreter="PATH=/home/core/bin:$PATH python"
ansible_ssh_user=core
agx commented 8 years ago

On Sun, Feb 07, 2016 at 12:46:46AM -0800, Daniel Lobato García wrote:

I think it'd be useful to access Foreman parameters as Ansible variables we can use in playbooks:

Something like this:

coreos-local-medialobatolanhome etcd=https://discoveryetcdio/a7b895a9491c2e2907a11b5a4104e470
[lobatolanhome-base/CoreOS cluster]
coreos-local-medialobatolanhome 
[lobatolanhome-base/CoreOS cluster:vars]
ansible_python_interpreter="PATH=/home/core/bin:$PATH python"
ansible_ssh_user=core

Agreed. Is there a simpler way than using

/api/v2/hosts/:hostid/parameters

and /api/v2/hostgroups/:hostgroupid

and combining these? I.e. is there a single call that resolves the values? Cheers, -- Guidob

dLobatog commented 8 years ago

Agreed. Is there a simpler way than using

/api/v2/hosts/:hostid/parameters

and /api/v2/hostgroups/:hostgroupid

and combining these? I.e. is there a single call that resolves the values?

I think that'd be the way to go, yes. If it's really tough to do we can add another endpoint on foreman_ansible to serve these parameters or something like that, but ideally the API should suffice

Daniel Lobato Garcia

@dLobatog blog.daniellobato.me daniellobato.me

GPG: http://keys.gnupg.net/pks/lookup?op=get&search=0x7A92D6DD38D6DE30 Keybase: https://keybase.io/elobato