Python ansible.module_utils.basic.env_fallback() Examples
The following are 9
code examples of ansible.module_utils.basic.env_fallback().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
ansible.module_utils.basic
, or try the search function
.
Example #1
Source File: vmware.py From skylight with GNU General Public License v3.0 | 6 votes |
def vmware_argument_spec(): return dict( hostname=dict(type='str', required=False, fallback=(env_fallback, ['VMWARE_HOST']), ), username=dict(type='str', aliases=['user', 'admin'], required=False, fallback=(env_fallback, ['VMWARE_USER'])), password=dict(type='str', aliases=['pass', 'pwd'], required=False, no_log=True, fallback=(env_fallback, ['VMWARE_PASSWORD'])), port=dict(type='int', default=443, fallback=(env_fallback, ['VMWARE_PORT'])), validate_certs=dict(type='bool', required=False, default=True, fallback=(env_fallback, ['VMWARE_VALIDATE_CERTS'])), )
Example #2
Source File: alicloud_ecs.py From alibaba.alicloud with Apache License 2.0 | 6 votes |
def ecs_argument_spec(): spec = acs_common_argument_spec() spec.update( dict( alicloud_region=dict(required=True, aliases=['region', 'region_id'], fallback=(env_fallback, ['ALICLOUD_REGION', 'ALICLOUD_REGION_ID'])), alicloud_assume_role_arn=dict(fallback=(env_fallback, ['ALICLOUD_ASSUME_ROLE_ARN']), aliases=['assume_role_arn']), alicloud_assume_role_session_name=dict(fallback=(env_fallback, ['ALICLOUD_ASSUME_ROLE_SESSION_NAME']), aliases=['assume_role_session_name']), alicloud_assume_role_session_expiration=dict(type='int', fallback=(env_fallback, ['ALICLOUD_ASSUME_ROLE_SESSION_EXPIRATION']), aliases=['assume_role_session_expiration']), alicloud_assume_role=dict(type='dict', aliases=['assume_role']), profile=dict(fallback=(env_fallback, ['ALICLOUD_PROFILE'])), shared_credentials_file=dict(fallback=(env_fallback, ['ALICLOUD_SHARED_CREDENTIALS_FILE'])) ) ) return spec
Example #3
Source File: digital_ocean_floating_ip.py From algo with GNU Affero General Public License v3.0 | 6 votes |
def main(): module = AnsibleModule( argument_spec=dict( state=dict(choices=['present', 'absent'], default='present'), ip=dict(aliases=['id'], required=False), region=dict(required=False), droplet_id=dict(required=False, type='int'), oauth_token=dict( no_log=True, # Support environment variable for DigitalOcean OAuth Token fallback=(env_fallback, ['DO_API_TOKEN', 'DO_API_KEY', 'DO_OAUTH_TOKEN']), required=True, ), validate_certs=dict(type='bool', default=True), timeout=dict(type='int', default=30), ), required_if=[ ('state', 'delete', ['ip']) ], mutually_exclusive=[ ['region', 'droplet_id'] ], ) core(module)
Example #4
Source File: alicloud_ecs.py From alibaba.alicloud with Apache License 2.0 | 5 votes |
def acs_common_argument_spec(): return dict( alicloud_access_key=dict(aliases=['access_key_id', 'access_key'], no_log=True, fallback=(env_fallback, ['ALICLOUD_ACCESS_KEY', 'ALICLOUD_ACCESS_KEY_ID'])), alicloud_secret_key=dict(aliases=['secret_access_key', 'secret_key'], no_log=True, fallback=(env_fallback, ['ALICLOUD_SECRET_KEY', 'ALICLOUD_SECRET_ACCESS_KEY'])), alicloud_security_token=dict(aliases=['security_token'], no_log=True, fallback=(env_fallback, ['ALICLOUD_SECURITY_TOKEN'])), ecs_role_name=dict(aliases=['role_name'], fallback=(env_fallback, ['ALICLOUD_ECS_ROLE_NAME'])) )
Example #5
Source File: vmanage.py From python-viptela with GNU General Public License v3.0 | 5 votes |
def vmanage_argument_spec(): return dict(host=dict(type='str', required=True, fallback=(env_fallback, ['VMANAGE_HOST'])), port=dict(type='str', required=False, fallback=(env_fallback, ['VMANAGE_PORT'])), user=dict(type='str', required=True, fallback=(env_fallback, ['VMANAGE_USERNAME'])), password=dict(type='str', required=True, fallback=(env_fallback, ['VMANAGE_PASSWORD'])), validate_certs=dict(type='bool', required=False, default=False), timeout=dict(type='int', default=30) )
Example #6
Source File: viptela.py From python-viptela with GNU General Public License v3.0 | 5 votes |
def viptela_argument_spec(): return dict(host=dict(type='str', required=True, fallback=(env_fallback, ['VMANAGE_HOST'])), port=dict(type='str', required=False, fallback=(env_fallback, ['VMANAGE_PORT'])), user=dict(type='str', required=True, fallback=(env_fallback, ['VMANAGE_USERNAME'])), password=dict(type='str', required=True, fallback=(env_fallback, ['VMANAGE_PASSWORD'])), validate_certs=dict(type='bool', required=False, default=False), timeout=dict(type='int', default=30) )
Example #7
Source File: f5_utils.py From ansible_f5 with Apache License 2.0 | 5 votes |
def f5_argument_spec(): return dict( server=dict( type='str', required=True, fallback=(env_fallback, ['F5_SERVER']) ), user=dict( type='str', required=True, fallback=(env_fallback, ['F5_USER']) ), password=dict( type='str', aliases=['pass', 'pwd'], required=True, no_log=True, fallback=(env_fallback, ['F5_PASSWORD']) ), validate_certs=dict( default='yes', type='bool', fallback=(env_fallback, ['F5_VALIDATE_CERTS']) ), server_port=dict( type='int', default=443, fallback=(env_fallback, ['F5_SERVER_PORT']) ), state=dict( type='str', default='present', choices=['present', 'absent'] ), partition=dict( type='str', default='Common', fallback=(env_fallback, ['F5_PARTITION']) ) )
Example #8
Source File: sensu_go.py From sensu-go-ansible with MIT License | 4 votes |
def __init__(self, argument_spec, attributes, resource, **kwargs): self.headers = {"Content-Type": "application/json"} # List of attributes from the upstream specification self.attributes = attributes # The type of resource to work with. i.e.: checks, handlers, etc. self.resource = resource args = dict( name=dict(type='str', required=True), host=dict( type='str', required=True, fallback=(env_fallback, ['ANSIBLE_SENSU_GO_HOST']) ), port=dict( type='int', default=8080, fallback=(env_fallback, ['ANSIBLE_SENSU_GO_PORT']) ), protocol=dict( type='str', default='http', choices=['http', 'https'], fallback=(env_fallback, ['ANSIBLE_SENSU_GO_PROTOCOL']) ), url_username=dict( type='str', default='admin', aliases=['username'], fallback=(env_fallback, ['ANSIBLE_SENSU_GO_USERNAME']) ), url_password=dict( type='str', default='P@ssw0rd!', no_log=True, aliases=['password'], fallback=(env_fallback, ['ANSIBLE_SENSU_GO_PASSWORD']) ), namespace=dict(type='str', default='default'), validate_certs=dict(type='bool', default=True), ) argument_spec.update(args) super(SensuGo, self).__init__(argument_spec=argument_spec, **kwargs)
Example #9
Source File: gcp_utils.py From google.cloud with GNU General Public License v3.0 | 4 votes |
def __init__(self, *args, **kwargs): arg_spec = {} if 'argument_spec' in kwargs: arg_spec = kwargs['argument_spec'] kwargs['argument_spec'] = self._merge_dictionaries( arg_spec, dict( project=dict( required=False, type='str', fallback=(env_fallback, ['GCP_PROJECT'])), auth_kind=dict( required=True, fallback=(env_fallback, ['GCP_AUTH_KIND']), choices=['machineaccount', 'serviceaccount', 'application'], type='str'), service_account_email=dict( required=False, fallback=(env_fallback, ['GCP_SERVICE_ACCOUNT_EMAIL']), type='str'), service_account_file=dict( required=False, fallback=(env_fallback, ['GCP_SERVICE_ACCOUNT_FILE']), type='path'), service_account_contents=dict( required=False, fallback=(env_fallback, ['GCP_SERVICE_ACCOUNT_CONTENTS']), no_log=True, type='jsonarg'), scopes=dict( required=False, fallback=(env_fallback, ['GCP_SCOPES']), type='list'), env_type=dict( required=False, fallback=(env_fallback, ['GCP_ENV_TYPE']), type='str') ) ) mutual = [] if 'mutually_exclusive' in kwargs: mutual = kwargs['mutually_exclusive'] kwargs['mutually_exclusive'] = mutual.append( ['service_account_email', 'service_account_file', 'service_account_contents'] ) AnsibleModule.__init__(self, *args, **kwargs)