On our AWS cloud side (different team), they use a Chef Recipe to import EC2 tags into OHAI. I want to replicate the same by running "knife tag create", which seems to work ok, but I am not able to create tags in JSON format (key, value pair). Also on EC2 instances, the main key is "tags", but where as "knife tag create", it's "tag".
Here is an example for EC2
knife node show myec2host.mydomain.net -l --attribute=tags --format=json
{
"myec2host.mydomain.net": {
"tags": {
"plugin": "Corporate Tags Ohai Plugin",
"provider": "AWS-EC2",
"Name": "myec2host",
"application_code": "lst",
}
}
}
On Primise VMware VM with attrbute set to "tag":
knife tag create onpremvm.mydomain.net environment:Non-Production
Created tags environment:Non-Production for node onpremvm.mydomain.net.
knife node show onpremvm.mydomain.net -l --attribute=tag --format=json
{
"onpremvm.mydomain.net": {
"tag": [
"provider=VMware-vCenter",
"environment:Non-Production"
]
}
}
Same On Primise VMware VM with attrbute set to "tags":
[root@evnpinfsanl01 ~]# knife node show onpremvm.mydomain.net -l --attribute=tags --format=json
{
"onpremvm.mydomain.net": {
"tags": {
"plugin": "Corporate Tags Ohai Plugin",
"provider": "VMware-vCenter"
}
}
}