Ask Your Question
0

Update instances metadata with cli

asked 2019-03-18 12:48:46 -0500

foura1512 gravatar image

I have 40 instances runing and I need to set metadata to them ( example test=true ) with cli.

nova meta fce7eacda9744d81bba1fe872a0929ae set test=true

Does anyone have a simple script to set metadata to all instances ?

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2019-03-18 17:00:11 -0500

updated 2019-03-18 17:00:52 -0500

Not sure if the nova client allows you to do it, but with the openstack client, you can loop over all instances like this:

for i in $(openstack server list -c ID -f value)
do openstack server set property test=true $i
done

The column name might be “id” rather than “ID”; I can’t test the script right now.

edit flag offensive delete link more

Comments

Thanks.

A small correction of the script: for i in $(openstack server list -c ID -f value) do openstack server set $i --property test2=true done

foura1512 gravatar imagefoura1512 ( 2019-03-19 06:11:09 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2019-03-18 12:48:46 -0500

Seen: 30 times

Last updated: Mar 18