accessing host variables

My host inventory carries a bunch of variables for each host. The one I’m interested in is “serverType”. I’d expected to be able to access that variable on the action line. When I use $serverType or ${serverType}, I do not get any variable expansion. I tested this with:

action: command logger ${serverType}

My syslog on the managed system duritully contains:

Jun 29 07:17:16 xxxxxx root: $serverType

On the other hand, when I replace $serverType with ${ansible_eth0.ipv4.address}, the logger logs the IP address into the syslog.

What might the syntax be to access a server variable?

Thanks,

Ed Greenberg

What version of ansible are you using and can you include an example of how you are declaring the variable in your host file?

I'm guessing most likely there is something wrong with your variable declaration syntax.

Hi Michael, I’m using 0.4, as checked out on 6/19.

My variables are coming from an inventory program, not a file, so they come out as a json return:
$ ./inventory --host 0.0.0.0

{… “config_status”: “done”, “serverType”: “cirrus”, “accountName”: “xxxxx”, …}

Your comment caused me to review what I had written, and I found the bug in my inventory program.

Thank you.

Ed