From b35d4d7a19435bc141fcaf80a8e08d67785c4dbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Sj=C3=B6gren?= Date: Wed, 28 Sep 2016 00:16:38 +0200 Subject: [PATCH] add tag grouping MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Thomas Sjögren --- contrib/inventory/digital_ocean.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/contrib/inventory/digital_ocean.py b/contrib/inventory/digital_ocean.py index aaa0b94d5b..a1871f4d89 100755 --- a/contrib/inventory/digital_ocean.py +++ b/contrib/inventory/digital_ocean.py @@ -401,6 +401,11 @@ or environment variables (DO_API_TOKEN)\n''') self.inventory[image] = { 'hosts': [ ], 'vars': {} } self.inventory[image]['hosts'].append(dest) + if droplet['tags']: + for tag in droplet['tags']: + if tag not in self.inventory: + self.inventory[tag] = { 'hosts': [ ], 'vars': {} } + self.inventory[tag]['hosts'].append(dest) def load_droplet_variables_for_host(self):