Ansible Custom Facts
-
So I want to install our backup agent on our servers but not on our workstations. I haven't found a good fact out of the box that you can use to separate the two. If I was using Ansible push (which I might switch to later on once tower is released for free) it wouldn't be an issue, but with ansible-pull you're limited to the facts on your localhost. So to add a custom fact you just need to add a script in
/etc/ansible/facts.d
that ends with.fact
and spits out some JSON. So here's what I did in/etc/ansible/facts.d/system_type.fact
:#!/bin/bash cat <<EOF { "label" : "workstation" } EOF
These facts are lumped together under the ansible_local group. So to call this with a conditional you would use
when: ansible_local.system_type.label == "workstation"
-
Right now I'll push this out with Ansible to the machines, but I'll add that in the template for our servers.
-
@stacksofplates said in Ansible Custom Facts:
which I might switch to later on once tower is released for free
When is this happening?
-
@aaronstuder said in Ansible Custom Facts:
@stacksofplates said in Ansible Custom Facts:
which I might switch to later on once tower is released for free
When is this happening?
Supposed to be this year.
-
@stacksofplates So then all you pay for is support?
-
@aaronstuder said in Ansible Custom Facts:
@stacksofplates So then all you pay for is support?
LOL - you almost make it sound like it will be cheap.
-
@aaronstuder said in Ansible Custom Facts:
@stacksofplates So then all you pay for is support?
I'm sure it will be an upstream project, because that's how everything else they have is set up. So if you want support you would get the stable version and pay 10K for 100 nodes (according to current pricing).
-
@stacksofplates It's already free for 10 nodes, so what will change? Free for unlimited nodes?
-
@aaronstuder said in Ansible Custom Facts:
@stacksofplates It's already free for 10 nodes, so what will change? Free for unlimited nodes?
Yes. It will be open source. So assuming they do an upstream it would be free for whatever unless you need support.
-
Trying to figure out if I should learn Ansible or Salt Stack.... hm..... Thoughts?
I am studying for my RHCSA... so maybe Ansible makes since?