List of Behavioral Inventory Parameters Variables |
|||||
---|---|---|---|---|---|
ansible_connection |
smart |
ssh |
paramiko |
Connection type to the host. This can be the name of any of ansible’s connection plugins. SSH protocol types are smart, ssh or paramiko. |
|
ansible_host | The name of the host to connect to, if different from the alias you wish to give to it. | ||||
ansible_port | The ssh port number, if not 22 | ||||
ansible_user | The default ssh user name to use. | ||||
ansible_ssh_pass | The ssh password to use (never store this variable in plain text; always use a vault. | ||||
ansible_ssh_private_key_file | Private key file used by ssh. Useful if using multiple keys and you don’t want to use SSH agent. | ||||
ansible_ssh_common_args | This setting is always appended to the default command line for sftp, scp, and ssh. | ||||
ansible_sftp_extra_args | This setting is always appended to the default sftp command line. | ||||
ansible_scp_extra_args | This setting is always appended to the default scp command line. | ||||
ansible_ssh_extra_args | This setting is always appended to the default ssh command line. | ||||
ansible_ssh_pipelining | Determines whether or not to use SSH pipelining. | ||||
ansible_ssh_executable | This setting overrides the default behavior to use the system ssh. | ||||
Privilege escalation |
|||||
ansible_become | Equivalent to ansible_sudo or ansible_su, allows to force privilege escalation | ||||
ansible_become_method | Allows to set privilege escalation method | ||||
ansible_become_user | Equivalent to ansible_sudo_user or ansible_su_user, allows to set the user you become through privilege escalation | ||||
ansible_become_pass | Equivalent to ansible_sudo_pass or ansible_su_pass, allows you to set the privilege escalation password (never store this variable in plain text; always use a vault. | ||||
ansible_become_exe | Equivalent to ansible_sudo_exe or ansible_su_exe, allows you to set the executable for the escalation method selected | ||||
ansible_become_flags | Equivalent to ansible_sudo_flags or ansible_su_flags, allows you to set the flags passed to the selected escalation method. | ||||
Remote host environment parameters: |
|||||
ansible_shell_type | The shell type of the target system. You should not use this setting unless you have set the ansible_shell_executable to a non-Bourne (sh) compatible shell. | ||||
ansible_python_interpreter | The target host python path. This is useful for systems with more than one Python or not located at /usr/bin/python such as *BSD, or where /usr/bin/python is not a 2.X series Python. | ||||
ansible_*_interpreter | Works for anything such as ruby or perl and works just like ansible_python_interpreter. This replaces shebang of modules which will run on that host. | ||||
ansible_shell_executable | This sets the shell the ansible controller will use on the target machine, overrides executablein ansible.cfg which defaults to /bin/sh. |
Content of file "inventory"
localhost ansible_connection=local
web1.devopsschool.com ansible_connection=ssh
web2.devopsschool.com ansible_connection=smart
web3.devopsschool.com ansible_connection=paramiko
[webservers]
web1.devopsschool.com ansible_host=192.0.2.50 ansible_port: 5555
web2.devopsschool.com ansible_ssh_pass=pass123 ansible_user=devops ansible_become=yes
web3.devopsschool.com ansible_become_user
web4.devopsschool.com ansible_become_pass
web5.devopsschool.com ansible_ssh_private_key_file=/home/devops/.ssh/aws.pem ansible_become=yes
web6.devopsschool.com ansible_shell_type=bash
web7.devopsschool.com ansible_python_interpreter=/usr/local/bin/python ansible_ruby_interpreter=/usr/bin/ruby.1.9.3
web8.devopsschool.com ansible_shell_executable=/bin/bash
[dbservers]
one.devopsschool.com ansible_connection=ssh
two.devopsschool.com
three.devopsschool.com