本文整理汇总了Python中ansible.playbook.play.Play.tasks方法的典型用法代码示例。如果您正苦于以下问题:Python Play.tasks方法的具体用法?Python Play.tasks怎么用?Python Play.tasks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ansible.playbook.play.Play
的用法示例。
在下文中一共展示了Play.tasks方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: dict
# 需要导入模块: from ansible.playbook.play import Play [as 别名]
# 或者: from ansible.playbook.play.Play import tasks [as 别名]
hosts = '192.168.56.212',
gather_facts = 'no',
tasks = [ dict(
#action=dict(module='debug', args=dict(msg='Hello Galaxy!'))
action=dict(module='sysctl', args=dict(name='net.ipv4.ip_forward', value=1, state='present'))
)]
)
"""
#play = Play().load(play_source, variable_manager=variable_manager, loader=loader)
play = Play()
play.name = "custom play"
play.variable_manager=variable_manager
play.loader=loader
play.hosts = ['192.168.56.212']
play.gather_facts = 'no'
play.tasks = Task().load("asdasd")
# actually run it
tqm = None
try:
tqm = TaskQueueManager(
inventory=inventory,
variable_manager=variable_manager,
loader=loader,
options=options,
passwords=passwords,
# TODO callback must be an instance of CallbackBase or the name of a callback plugin
stdout_callback='default',
)
result = tqm.run(play)
finally: