当前位置: 首页>>代码示例>>Python>>正文


Python utils.VERBOSITY属性代码示例

本文整理汇总了Python中ansible.utils.VERBOSITY属性的典型用法代码示例。如果您正苦于以下问题:Python utils.VERBOSITY属性的具体用法?Python utils.VERBOSITY怎么用?Python utils.VERBOSITY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在ansible.utils的用法示例。


在下文中一共展示了utils.VERBOSITY属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_pb

# 需要导入模块: from ansible import utils [as 别名]
# 或者: from ansible.utils import VERBOSITY [as 别名]
def get_pb(task):
    if task:
        runner_cb = PlaybookRunnerCallbacks(task, stats, verbose=utils.VERBOSITY)
        playbook_cb = PlaybookCallbacks(task, verbose=utils.VERBOSITY)
    else:
        runner_cb = callbacks.PlaybookRunnerCallbacks(stats, verbose=utils.VERBOSITY)
        playbook_cb = callbacks.PlaybookCallbacks(verbose=utils.VERBOSITY)

    pb = PlayBook(playbook='./test.yaml', 
                  callbacks=playbook_cb,
                  runner_callbacks=runner_cb,
                  stats=stats,
                  inventory=inventory,
                  extra_vars=vars,
                  )
    return pb 
开发者ID:onlytiancai,项目名称:ansible-celery-flask-demo,代码行数:18,代码来源:test_playbook.py

示例2: run

# 需要导入模块: from ansible import utils [as 别名]
# 或者: from ansible.utils import VERBOSITY [as 别名]
def run(self, playbook_relational_path, extra_vars=None):
        """
        run ansible playbook,
        only surport relational path.
        """
        stats = callbacks.AggregateStats()
        playbook_cb = callbacks.PlaybookCallbacks(verbose=utils.VERBOSITY)
        runner_cb = callbacks.PlaybookRunnerCallbacks(stats, verbose=utils.VERBOSITY)
        playbook_path = os.path.join(ANSIBLE_DIR, playbook_relational_path)

        pb = PlayBook(
            playbook=playbook_path,
            stats=stats,
            callbacks=playbook_cb,
            runner_callbacks=runner_cb,
            inventory=self.inventory,
            extra_vars=extra_vars,
            check=False)

        self.results = pb.run() 
开发者ID:zsjtoby,项目名称:DevOpsCloud,代码行数:22,代码来源:ansible_api.py

示例3: go_playbook

# 需要导入模块: from ansible import utils [as 别名]
# 或者: from ansible.utils import VERBOSITY [as 别名]
def go_playbook(self, playfile, jobid):
        try:
            # Set ansible api variables
            from ansible.playbook import PlayBook
            from ansible import callbacks
            from ansible import utils
            self.playbook_cb = callbacks.PlaybookCallbacks(verbose=utils.VERBOSITY)
            self.stats = callbacks.AggregateStats()
            self.runner_cb = callbacks.PlaybookRunnerCallbacks(self.stats, verbose=utils.VERBOSITY)
        except Exception, e:
            print(str(e))
            print('You need to run [python cldstkdeploy.py --setup all].')
            sys.exit()
            pass 
开发者ID:thehyperadvisor,项目名称:cldstk-deploy,代码行数:16,代码来源:cldstkdeploy.py

示例4: playbook_run

# 需要导入模块: from ansible import utils [as 别名]
# 或者: from ansible.utils import VERBOSITY [as 别名]
def playbook_run(inventory, playbook, default_user=None, default_port=None, default_pri_key_path=None):
    stats = callbacks.AggregateStats()
    playbook_cb = callbacks.PlaybookCallbacks(verbose=utils.VERBOSITY)
    runner_cb = callbacks.PlaybookRunnerCallbacks(stats, verbose=utils.VERBOSITY)
    # run the playbook
    print default_user, default_port, default_pri_key_path, inventory, playbook
    if default_user and default_port and default_pri_key_path:
        playbook = PlayBook(host_list=inventory,
                            playbook=playbook,
                            forks=5,
                            remote_user=default_user,
                            remote_port=default_port,
                            private_key_file=default_pri_key_path,
                            callbacks=playbook_cb,
                            runner_callbacks=runner_cb,
                            stats=stats,
                            become=True,
                            become_user='root')
    else:
        playbook = PlayBook(host_list=inventory,
                            playbook=playbook,
                            forks=5,
                            callbacks=playbook_cb,
                            runner_callbacks=runner_cb,
                            stats=stats,
                            become=True,
                            become_user='root')
    results = playbook.run()
    print results
    results_r = {'unreachable': [], 'failures': [], 'success': []}
    for hostname, result in results.items():
        if result.get('unreachable', 2):
            results_r['unreachable'].append(hostname)
            print "%s >>> unreachable" % hostname
        elif result.get('failures', 2):
            results_r['failures'].append(hostname)
            print "%s >>> Failed" % hostname
        else:
            results_r['success'].append(hostname)
            print "%s >>> Success" % hostname
    return results_r 
开发者ID:zsjtoby,项目名称:DevOpsCloud,代码行数:43,代码来源:tasks.py


注:本文中的ansible.utils.VERBOSITY属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。