diff options
-rw-r--r-- | share/hydra/inventory | 27 | ||||
-rwxr-xr-x | share/hydra/mass | 9 |
2 files changed, 35 insertions, 1 deletions
diff --git a/share/hydra/inventory b/share/hydra/inventory index e69de29..97b63e6 100644 --- a/share/hydra/inventory +++ b/share/hydra/inventory @@ -0,0 +1,27 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Builds an inventory of nodes. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with this program. If not, see +# <http://www.gnu.org/licenses/>. +# Copyright (C) 2015 Silvio Rhatto<fujiro@sarava.org> + +# Dependencies +import yaml +import sys, os + +# TODO +class Inventory: + """Hydra inventory class""" diff --git a/share/hydra/mass b/share/hydra/mass index 3b1ed2d..b368ec0 100755 --- a/share/hydra/mass +++ b/share/hydra/mass @@ -16,6 +16,11 @@ # License along with this program. If not, see # <http://www.gnu.org/licenses/>. +# Issue commands with ansible +function mass_ansible { + HYDRA=$HYDRA ansible $ROLE -i $DIRNAME/inventory --sudo -a "$COMMAND" +} + # Issue commands with pssh function mass_pssh { hydra_check_command parallel-ssh @@ -53,6 +58,7 @@ source $APP_BASE/lib/hydra/functions || exit 1 hydra_config_load # Command line arguments +DIRNAME="`dirname $0`" BASENAME="`basename $0`" COMMAND="$*" @@ -66,7 +72,8 @@ if [ "$BASENAME" == "mass-update" ]; then elif [ "$BASENAME" == "mass-upgrade" ]; then COMMAND="DEBIAN_FRONTEND=noninteractive hydractl upgrade clean" elif [ "$BASENAME" == "mass-web" ]; then - set_nodes web + ROLE="web" + set_nodes $ROLE fi # Execute commands in hosts |