Hi,
I am using rax module to create rackspace server and setting a group
using group parameter. Currently, I use it for determining if the
server belongs to web or db group. In addition, I also want to add
capability of determining if the server belongs to production or
development.
Is it possible to pass a list to group parameter? Or is there
another way to achieve this?
To define “secondary” or extra groups to a device, you need to use the “groups” meta key. Note that this is plural and different from “group”.
I really recommend using the current copy of the ‘rax’ module in ansible (devel), not what has been released with 1.6.x, as the current version it fixes issues related to metadata. Additionally, make sure you are also using an up to date rax.py inventory plugin.
Example (trimmed to the important part):
- rax:
[snip]
meta:
groups: production,something,somethingelse
[snip]
Hi,
Sorry for the late reply. This task got delayed in implementing. I
finally got started with it. I copied the latest files in the commit
https://github.com/ansible/ansible/commit/609fd2e993d617b1c5af50540c9664cc0ece261a#diff-ec0444fc44a45df6dac363d61054d860
I also copied over the latest rax.py and tried to create a new host as follows:
$ RAX_CREDS_FILE=.raxpub ansible-playbook -i inventory/rax.py
new-host.yml -vvvv -e "groups=freeswitch,production group=production
rax_name=fs" -vvvv
But, I end up with the following error message
failed: [localhost] => {"failed": true}
msg: Invalid metadata size: Metadata property value greater than 255 characters
It’s unclear what module you are running in the ad-hoc above, as the default “-m” is usually the command module.
Did you perhaps change the default?