本文整理汇总了Python中ansible.constants方法的典型用法代码示例。如果您正苦于以下问题:Python ansible.constants方法的具体用法?Python ansible.constants怎么用?Python ansible.constants使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ansible
的用法示例。
在下文中一共展示了ansible.constants方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _load_ansible_config
# 需要导入模块: import ansible [as 别名]
# 或者: from ansible import constants [as 别名]
def _load_ansible_config(self, config):
"""Load ansible configuration from command-line."""
option_names = ['ansible_inventory', 'ansible_host_pattern', 'ansible_connection', 'ansible_user',
'ansible_module_path', 'ansible_become', 'ansible_become_method', 'ansible_become_user',
'ansible_ask_become_pass', 'ansible_subset']
kwargs = dict()
# Load command-line supplied values
for key in option_names:
short_key = key[8:]
kwargs[short_key] = config.getoption(key)
# normalize ansible.ansible_become options
kwargs['become'] = kwargs['become'] or ansible.constants.DEFAULT_BECOME
kwargs['become_user'] = kwargs['become_user'] or ansible.constants.DEFAULT_BECOME_USER
kwargs['ask_become_pass'] = kwargs['ask_become_pass'] or ansible.constants.DEFAULT_BECOME_ASK_PASS
log.debug("config: %s" % kwargs)
return kwargs
示例2: _make_secrets
# 需要导入模块: import ansible [as 别名]
# 或者: from ansible import constants [as 别名]
def _make_secrets(self, secret):
if _ANSIBLE_VER < 2.4:
return secret
from ansible.constants import DEFAULT_VAULT_ID_MATCH
from ansible.parsing.vault import VaultSecret
return [(DEFAULT_VAULT_ID_MATCH, VaultSecret(secret))]
示例3: become_methods
# 需要导入模块: import ansible [as 别名]
# 或者: from ansible import constants [as 别名]
def become_methods():
"""Return string list of become methods available to ansible."""
if become_loader:
return [method.name for method in become_loader.all()]
else:
return ansible.constants.BECOME_METHODS