Add pydoc to playbook binary, fix default types for playbook '.get()' call
This commit is contained in:
parent
34cbbfbfe1
commit
c57df6220b
2 changed files with 10 additions and 3 deletions
|
@ -15,14 +15,20 @@
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
|
||||||
|
#######################################################
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import ansible.playbook
|
import ansible.playbook
|
||||||
import ansible.constants as C
|
import ansible.constants as C
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
|
||||||
|
#######################################################
|
||||||
|
|
||||||
def main(args):
|
def main(args):
|
||||||
|
''' run ansible-playbook operations '''
|
||||||
|
|
||||||
|
# create parser for CLI options
|
||||||
parser = OptionParser()
|
parser = OptionParser()
|
||||||
parser.usage = "ans-playbook playbook.yml ..."
|
parser.usage = "ans-playbook playbook.yml ..."
|
||||||
parser.add_option('-f','--forks', dest='forks', default=C.DEFAULT_FORKS, type='int',
|
parser.add_option('-f','--forks', dest='forks', default=C.DEFAULT_FORKS, type='int',
|
||||||
|
@ -35,6 +41,7 @@ def main(args):
|
||||||
print >> sys.stderr, "playbook path is a required argument"
|
print >> sys.stderr, "playbook path is a required argument"
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
# run all playbooks specified on the command line
|
||||||
for playbook in args:
|
for playbook in args:
|
||||||
pb = ansible.playbook.PlayBook(
|
pb = ansible.playbook.PlayBook(
|
||||||
playbook=playbook,
|
playbook=playbook,
|
||||||
|
|
|
@ -161,8 +161,8 @@ class PlayBook(object):
|
||||||
# summary information about successes and
|
# summary information about successes and
|
||||||
# failures. TODO: split into subfunction
|
# failures. TODO: split into subfunction
|
||||||
|
|
||||||
dark = results.get("dark", [])
|
dark = results.get("dark", {})
|
||||||
contacted = results.get("contacted", [])
|
contacted = results.get("contacted", {})
|
||||||
ok_hosts = contacted.keys()
|
ok_hosts = contacted.keys()
|
||||||
|
|
||||||
for host, msg in dark.items():
|
for host, msg in dark.items():
|
||||||
|
|
Loading…
Reference in a new issue