Marking particular hosts when using ansible linode dynamic inventory

I'm getting going using Ansible to manage my hosts. One thing I'd like to do is be able to mark particular hosts, so that particular actions aren't taken for those hosts. E.g., I monitor my hosts with Nagios, so most hosts need to have the Nagios NRPE server installed, but for the host that runs the Nagios server, I don't want NRPE installed. Or, for most hosts I have a standard Postfix configuration, but for the host that is my mail server, I don't want that standard Postfix configured applied, as it will need different configuration.

For my local hosts where I maintain a manual inventory, it's fairly easy. For hosts that need marked in this way, I add a particular variable to the host, and test for the existence of that variable in my playbooks. But for my Linode hosts, I'm using the Linode dynamic inventory plugin. I so far haven't found a way to mark a host on Linode in such a way that it will show up in the Linode dynamic inventory in Ansible. Have I missed something? Or have I missed some way in Ansible, for example, of attaching a variable to a host if it should be found in the dynamic inventory?

1 Reply

This was answered over on the ansible_project mailing list. The trick is to use the host_vars directory to declare variables.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct