Friday, July 14, 2023

Subscription and Host Metric Changes in Ansible Automation Platform 2.4

What and Why?

Our customers use Ansible Automation Platform across a multitude of platforms, in a plethora of ways. Providing an accurate accounting and reporting capability is sometimes difficult across the various types of use cases we encounter.

If you have traditionally used the platform with infrequently changing or more static types of managed hosts, you’re probably pretty much covered. If however, you administer a more diverse and dynamic set of hosts, there may be occasions where you require more flexibility, when accounting for managed hosts against your purchased subscription.

That’s why in Ansible Automation Platform 2.4, we’ve introduced a new Host Metrics dashboard tab with the ability to:

  • View high level automation run details per managed host
    • The first and last time automated (this metric already existed)
    • The number of times automation has been run or attempted to be run against a host (new in 2.4)
    • The number of times a managed host has been deleted (new in 2.4)

The ability to view the number of times automation has been run on hosts is a simple but really useful metric:

  • Instantly see your most commonly automated hosts
  • See which hosts exist in your inventories but maybe haven’t been automated against
  • More accurately reflect the true nature of your automation landscape

Wouldn’t it be nice to have the ability to remove unautomated hosts not only from view but also any potential managed node counting? Well, in 2.4 you now can through our ‘soft deletion’ capability.

There are other type of use cases where you may want to delete hosts:

  • Ephemeral uniquely provisioned one shot hosts (perhaps used for CI/CD/testing only)
  • Other bench provisioning or temporary ‘one off’ hosts
  • Older hosts which have been decommissioned and will never to automated against again

It should be noted that we provide this soft deletion mechanism for legitimate use case scenarios like the above. It must not be used to violate subscription counting for the purposes of the likes of node recycling. Our terms of reference around managed nodes makes this clear for you.


Host Metrics and Subscriptions

So how does it work? Let’s walk through some example automation using Ansible Automation Platform and highlight the changes as we go. But first, let’s get a grip on what host metrics we now have.

Let’s start with a fresh vanilla Ansible Automation Platform 2.4 install, with a valid license already applied. Under Settings -> Subscription you’ll now see:

I’ve created a 1 node license just so it’s easier to demonstrate the changes and metric reporting. Normally your license count will be in multiples of 100s unless you’ve carved it up into smaller consumable manifest files (to share across platforms)

Some of these fields have changed in recent versions or are net new in 2.4. Let’s look at each on this page so we understand the metric meaning and intention:

Status - this is the most important metric and will either show as:

  • Compliant i.e. the number of hosts you have automated against is below your subscription count, or,
  • Out of compliance i.e. you have automated against more hosts than your subscription allows

Hosts automated - the number of hosts you have run or attempted to run automation against. This will tell you how many hosts in total across all use cases have been touched and count against your managed node subscription number.

Hosts imported - this isn’t used for licensing counting purposes but is provided to show how many hosts you have “imported”. This term is a hangover from older tower releases but you can assume this means hosts that have been added or created in controller in some way. It can be useful to reference this number against your automated hosts count:

  • If imported > hosts automated then you have more hosts referenced in inventories than you have managed node count. You may need to:
    • cleanse your inventory sources
    • perhaps your automation needs have increased and are about to run out of licensed managed nodes (big project rollout, more teams added, cloud adoption etc etc)
    • Your managed licensed node count is fine as long as you’re still Compliant
  • If imported < hosts automated then your hosts referenced in inventories is less than managed node count. Perhaps:
    • You’ve recently cleaned up or refreshed your inventory
    • You’re using something like the add_host module to create hosts/groups on-the-fly rather than directly from inventory sources
    • Your managed licensed node count is fine as long as you’re still Compliant

Hosts remaining - your managed node subscription count - hosts automated gives you the number of hosts you can still automate against before becoming non compliant.

Hosts deleted - if you delete a host from the Host Metrics dash (see later example)  then it’ll get counted here and reduce your total automated hosts count.

Active hosts previously deleted - if you delete a host but then automate against it subsequently it’ll show here. This is why we call it a ‘soft deletion’.

The remaining information details your type of subscription, expiry date etc and should be self explanatory so we’ll not cover it further.


Example Walkthrough

Let’s do some automation and host/inventory admin to see the effects this can have.

We start from a position of having:

  • A total licensed node count of 1
  • As I haven’t run any automation yet, hosts remaining is also 1
  • So we are in a compliant state
  • Note: I have simply not ‘reset’ the Hosts imported so it’s an arbitrary 7 in this example. Normally that would be 1 (localhost is present normally out of the box). But I wanted to leave it higher than hosts automated to show how it’s not affecting counting and compliance

The new Host Metrics dash is also empty:

Let’s automate against localhost and see the effects. I launched the Demo Template job against the Demo Inventory that just includes localhost.

The Host Metrics dash now shows my automation against localhost:

The subscription details now shows I’ve automated against 1 host but now have no hosts remaining, but I’m still compliant:

(Notice how hosts imported has changed again and still doesn’t have any effect)

Now let’s automate against more hosts so we breach our licensed node count and see what happens. In this case, I automated against further 2 hosts:

Subscriptions now show we’re out of compliance and have automated against the 3 hosts:

Let’s assume that those new hosts were ephemeral in nature (used only for CI purposes) and will never be used again. We can remove them from the Host Metrics view to account for this, by selecting the hosts and clicking on Delete:

After confirming you really want to do this,  they’ll be removed from the host list. If we now look at Subscriptions again, we’ll see the Hosts deleted count is now 2 (and hosts automated back down to 1), but we’re compliant again:

Our last scenario is where we automate again using a previously deleted host. I’ve re-run my automation, where host4 is still absent, but host6 is back in the inventory and now being automated against again.

Let’s have a look at the effects. host6 is back in the Host Metrics. Notice how automations are now 2 but soft deletions are also noted still. This way we can ensure that we accurately account for hosts that are still being actively used.

Finally, back in Subscriptions, we’re out of compliance once more and in place of having simply 2 hosts deleted, now we have 1 and 1 under “Active hosts previously deleted” to account for the reinstatement of host6:

Clearly this is not an ephemeral type use case and the host is still being actively used, so this provides you with more information to assess the situation. This will help with node counting and compliance and permit you to talk to your users about their usage. This can be especially useful when the platform admin doesn’t control the entire inventory, but is responsible for overall compliance.

If you’re interested in collecting such information from the API, that is available under https://controllerurl/api/v2/host_metrics/



This blog described the host metric accounting changes, the soft deletion capability and sequent subscription counting effects in Ansible Automation Platform 2.4.

You can now:

  • More accurately assess high level automation activities
  • Soft delete decommissioned, or unused hosts
  • Explain your compliance state with more clarity and information


from Ansible Blog

No comments:

Post a Comment