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

FEATURE REQUEST: Add more Ansible groups #5

Closed mattwilmott closed 8 years ago

mattwilmott commented 8 years ago

In addition to Hostgroup, Location and Organisation, it would be helpful if the following foreman derived facts were exposed as Ansible groups

This would allow actions such as configuring sssd based on domain, configuring NFS shares per Network, patching an Environment, configuring a service based on RHEL version or Linux flavour.

agx commented 8 years ago

On Wed, Feb 24, 2016 at 03:58:00PM -0800, mattwilmott wrote:

In addition to Hostgroup, Location and Organisation, it would be helpful if the following foreman derived facts were exposed as Ansible groups

  • Domain
  • Network and/or Subnet
  • Environment
  • OS Full Name
  • OS Family

This would allow actions such as configuring sssd based on domain, configuring NFS shares per Network, patching an Environment, configuring a service based on RHEL version or Linux flavour.

Sounds like a plan but instead of generating all of these I wonder if we should not just expand these via our group_patterns. So far we only use group params there but we could expand all hostvars there as well.

That would allow us to group by basially everything you have in hostvars['foremen'] and one could e.g. build up things like

{subnet_name}-{environment_name}-{image_name}

mattwilmott commented 8 years ago

That certainly sounds like a better idea On 26 Feb 2016 6:02 am, "Guido Günther" notifications@github.com wrote:

On Wed, Feb 24, 2016 at 03:58:00PM -0800, mattwilmott wrote:

In addition to Hostgroup, Location and Organisation, it would be helpful if the following foreman derived facts were exposed as Ansible groups

  • Domain
  • Network and/or Subnet
  • Environment
  • OS Full Name
  • OS Family

This would allow actions such as configuring sssd based on domain, configuring NFS shares per Network, patching an Environment, configuring a service based on RHEL version or Linux flavour.

Sounds like a plan but instead of generating all of these I wonder if we should not just expand these via our group_patterns. So far we only use group params there but we could expand all hostvars there as well.

That would allow us to group by basially everything you have in hostvars['foremen'] and one could e.g. build up things like

{subnet_name}-{environment_name}-{image_name}

— Reply to this email directly or view it on GitHub https://github.com/theforeman/foreman_ansible_inventory/issues/5#issuecomment-188932124 .

agx commented 8 years ago

https://github.com/theforeman/foreman_ansible_inventory/pull/7 should do the trick

agx commented 8 years ago

Sorry, ti's https://github.com/theforeman/foreman_ansible_inventory/pull/8