Let’s get started on how to install Ansible
on Linux Ubuntu and macOS.
What is Ansible?
Ansible is an all in one IT solution
. It’s an IT orchestration engine which automates configuration management, application deployment, remote infrastructure management command based simple tool.
Today we will go over detailed steps on Ansible installation steps and complete deployment guide.
How to install Ansible on Linux Ubuntu OS?
Step-1
Update OS to latest version.
- Command:
sudo apt-get update
root@localhost:~# sudo apt-get update Hit:1 http://mirrors.linode.com/ubuntu cosmic InRelease Get:2 http://mirrors.linode.com/ubuntu cosmic-updates InRelease [88.7 kB] Get:3 http://mirrors.linode.com/ubuntu cosmic-backports InRelease [74.6 kB] Get:4 http://mirrors.linode.com/ubuntu cosmic-updates/main i386 Packages [200 kB] Get:5 http://mirrors.linode.com/ubuntu cosmic-updates/main amd64 Packages [223 kB] Get:6 http://security.ubuntu.com/ubuntu cosmic-security InRelease [88.7 kB] Get:7 http://security.ubuntu.com/ubuntu cosmic-security/main amd64 Packages [131 kB] Get:8 http://security.ubuntu.com/ubuntu cosmic-security/main i386 Packages [109 kB] Fetched 915 kB in 1s (700 kB/s) Reading package lists... Done
Step-2
Install Ubuntu with software properties.
- Command:
sudo apt-get install software-properties-common
root@localhost:~# sudo apt-get install software-properties-common Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: python3-software-properties The following packages will be upgraded: python3-software-properties software-properties-common 2 upgraded, 0 newly installed, 0 to remove and 78 not upgraded. Need to get 32.3 kB of archives. After this operation, 0 B of additional disk space will be used. Do you want to continue? [Y/n] Y Get:1 http://mirrors.linode.com/ubuntu cosmic-updates/main amd64 software-properties-common all 0.96.27.1 [9,900 B] Get:2 http://mirrors.linode.com/ubuntu cosmic-updates/main amd64 python3-software-properties all 0.96.27.1 [22.4 kB] Fetched 32.3 kB in 0s (1,518 kB/s) (Reading database ... 112337 files and directories currently installed.) Preparing to unpack .../software-properties-common_0.96.27.1_all.deb ... Unpacking software-properties-common (0.96.27.1) over (0.96.27) ... Preparing to unpack .../python3-software-properties_0.96.27.1_all.deb ... Unpacking python3-software-properties (0.96.27.1) over (0.96.27) ... Processing triggers for man-db (2.8.4-2) ... Setting up python3-software-properties (0.96.27.1) ... Processing triggers for dbus (1.12.10-1ubuntu2) ... Setting up software-properties-common (0.96.27.1) ...
Step-3
Add Ansible package to your Ubuntu system.
- Command:
sudo apt-add-repository --yes --update ppa:ansible/ansible
root@localhost:~# sudo apt-add-repository --yes --update ppa:ansible/ansible Hit:1 http://mirrors.linode.com/ubuntu cosmic InRelease Hit:2 http://mirrors.linode.com/ubuntu cosmic-updates InRelease Get:3 http://mirrors.linode.com/ubuntu cosmic-backports InRelease [74.6 kB] Hit:4 http://security.ubuntu.com/ubuntu cosmic-security InRelease Get:5 http://ppa.launchpad.net/ansible/ansible/ubuntu cosmic InRelease [15.9 kB] Get:6 http://ppa.launchpad.net/ansible/ansible/ubuntu cosmic/main i386 Packages [536 B] Get:7 http://ppa.launchpad.net/ansible/ansible/ubuntu cosmic/main amd64 Packages [536 B] Get:8 http://ppa.launchpad.net/ansible/ansible/ubuntu cosmic/main Translation-en [344 B] Fetched 91.9 kB in 1s (64.7 kB/s) Reading package lists... Done
Step-4
Install Ansible completely.
- Command:
sudo apt-get install ansible
root@localhost:~# sudo apt-get install ansible Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: libsodium23 python-asn1crypto python-bcrypt python-cffi-backend python-crypto python-cryptography python-enum34 python-httplib2 python-idna python-ipaddress python-jinja2 python-markupsafe python-nacl python-paramiko python-pyasn1 python-setuptools python-six python-yaml sshpass Suggested packages: python-crypto-doc python-cryptography-doc python-cryptography-vectors python-enum34-doc python-jinja2-doc python-nacl-doc python-gssapi python-setuptools-doc The following NEW packages will be installed: ansible libsodium23 python-asn1crypto python-bcrypt python-cffi-backend python-crypto python-cryptography python-enum34 python-httplib2 python-idna python-ipaddress python-jinja2 python-markupsafe python-nacl python-paramiko python-pyasn1 python-setuptools python-six python-yaml sshpass 0 upgraded, 20 newly installed, 0 to remove and 78 not upgraded. Need to get 5,595 kB of archives. After this operation, 43.0 MB of additional disk space will be used. Do you want to continue? [Y/n] Y Get:1 http://mirrors.linode.com/ubuntu cosmic/main amd64 python-markupsafe amd64 1.0-1build2 [13.0 kB] Get:2 http://mirrors.linode.com/ubuntu cosmic/main amd64 python-jinja2 all 2.10-1 [94.6 kB] Get:3 http://mirrors.linode.com/ubuntu cosmic/main amd64 python-yaml amd64 3.12-1build3 [120 kB] Get:4 http://mirrors.linode.com/ubuntu cosmic/main amd64 python-cffi-backend amd64 1.11.5-3ubuntu1 [64.4 kB] Get:5 http://mirrors.linode.com/ubuntu cosmic/main amd64 python-six all 1.11.0-2 [11.3 kB] Get:6 http://mirrors.linode.com/ubuntu cosmic/main amd64 python-bcrypt amd64 3.1.4-2build1 [29.8 kB] Get:7 http://mirrors.linode.com/ubuntu cosmic/main amd64 python-asn1crypto all 0.24.0-1 [72.7 kB] Get:8 http://mirrors.linode.com/ubuntu cosmic/main amd64 python-enum34 all 1.1.6-2 [34.8 kB] Get:9 http://mirrors.linode.com/ubuntu cosmic/main amd64 python-idna all 2.6-1 [32.4 kB] Get:10 http://mirrors.linode.com/ubuntu cosmic/main amd64 python-ipaddress all 1.0.17-1 [18.2 kB] Get:11 http://mirrors.linode.com/ubuntu cosmic/main amd64 python-cryptography amd64 2.3-1ubuntu1 [204 kB] Get:12 http://mirrors.linode.com/ubuntu cosmic/main amd64 libsodium23 amd64 1.0.16-2build1 [144 kB] Get:13 http://mirrors.linode.com/ubuntu cosmic/main amd64 python-nacl amd64 1.2.1-3build1 [36.6 kB] Get:14 http://mirrors.linode.com/ubuntu cosmic/main amd64 python-pyasn1 all 0.4.2-3 [46.7 kB] Get:15 http://mirrors.linode.com/ubuntu cosmic-updates/main amd64 python-paramiko all 2.4.1-0ubuntu3.2 [119 kB] Get:16 http://mirrors.linode.com/ubuntu cosmic/main amd64 python-httplib2 all 0.11.3-1 [28.7 kB] Get:17 http://mirrors.linode.com/ubuntu cosmic/main amd64 python-crypto amd64 2.6.1-9build1 [244 kB] Get:18 http://mirrors.linode.com/ubuntu cosmic/main amd64 python-setuptools all 40.2.0-1 [331 kB] Get:19 http://mirrors.linode.com/ubuntu cosmic/universe amd64 sshpass amd64 1.06-1 [10.5 kB] Get:20 http://ppa.launchpad.net/ansible/ansible/ubuntu cosmic/main amd64 ansible all 2.7.8-1ppa~cosmic [3,939 kB] Fetched 5,595 kB in 2s (3,407 kB/s) Selecting previously unselected package python-markupsafe. (Reading database ... 112337 files and directories currently installed.) Preparing to unpack .../00-python-markupsafe_1.0-1build2_amd64.deb ... Unpacking python-markupsafe (1.0-1build2) ... Selecting previously unselected package python-jinja2. Preparing to unpack .../01-python-jinja2_2.10-1_all.deb ... Unpacking python-jinja2 (2.10-1) ... Selecting previously unselected package python-yaml. Preparing to unpack .../02-python-yaml_3.12-1build3_amd64.deb ... Unpacking python-yaml (3.12-1build3) ... Selecting previously unselected package python-cffi-backend. Preparing to unpack .../03-python-cffi-backend_1.11.5-3ubuntu1_amd64.deb ... Unpacking python-cffi-backend (1.11.5-3ubuntu1) ... Selecting previously unselected package python-six. Preparing to unpack .../04-python-six_1.11.0-2_all.deb ... Unpacking python-six (1.11.0-2) ... Selecting previously unselected package python-bcrypt. Preparing to unpack .../05-python-bcrypt_3.1.4-2build1_amd64.deb ... Unpacking python-bcrypt (3.1.4-2build1) ... Selecting previously unselected package python-asn1crypto. Preparing to unpack .../06-python-asn1crypto_0.24.0-1_all.deb ... Unpacking python-asn1crypto (0.24.0-1) ... Selecting previously unselected package python-enum34. Preparing to unpack .../07-python-enum34_1.1.6-2_all.deb ... Unpacking python-enum34 (1.1.6-2) ... Selecting previously unselected package python-idna. Preparing to unpack .../08-python-idna_2.6-1_all.deb ... Unpacking python-idna (2.6-1) ... Selecting previously unselected package python-ipaddress. Preparing to unpack .../09-python-ipaddress_1.0.17-1_all.deb ... Unpacking python-ipaddress (1.0.17-1) ... Selecting previously unselected package python-cryptography. Preparing to unpack .../10-python-cryptography_2.3-1ubuntu1_amd64.deb ... Unpacking python-cryptography (2.3-1ubuntu1) ... Selecting previously unselected package libsodium23:amd64. Preparing to unpack .../11-libsodium23_1.0.16-2build1_amd64.deb ... Unpacking libsodium23:amd64 (1.0.16-2build1) ... Selecting previously unselected package python-nacl. Preparing to unpack .../12-python-nacl_1.2.1-3build1_amd64.deb ... Unpacking python-nacl (1.2.1-3build1) ... Selecting previously unselected package python-pyasn1. Preparing to unpack .../13-python-pyasn1_0.4.2-3_all.deb ... Unpacking python-pyasn1 (0.4.2-3) ... Selecting previously unselected package python-paramiko. Preparing to unpack .../14-python-paramiko_2.4.1-0ubuntu3.2_all.deb ... Unpacking python-paramiko (2.4.1-0ubuntu3.2) ... Selecting previously unselected package python-httplib2. Preparing to unpack .../15-python-httplib2_0.11.3-1_all.deb ... Unpacking python-httplib2 (0.11.3-1) ... Selecting previously unselected package python-crypto. Preparing to unpack .../16-python-crypto_2.6.1-9build1_amd64.deb ... Unpacking python-crypto (2.6.1-9build1) ... Selecting previously unselected package python-setuptools. Preparing to unpack .../17-python-setuptools_40.2.0-1_all.deb ... Unpacking python-setuptools (40.2.0-1) ... Selecting previously unselected package sshpass. Preparing to unpack .../18-sshpass_1.06-1_amd64.deb ... Unpacking sshpass (1.06-1) ... Selecting previously unselected package ansible. Preparing to unpack .../19-ansible_2.7.8-1ppa~cosmic_all.deb ... Unpacking ansible (2.7.8-1ppa~cosmic) ... Setting up python-idna (2.6-1) ... Setting up python-setuptools (40.2.0-1) ... Setting up python-yaml (3.12-1build3) ... Setting up python-asn1crypto (0.24.0-1) ... Setting up python-crypto (2.6.1-9build1) ... Setting up python-pyasn1 (0.4.2-3) ... Setting up python-markupsafe (1.0-1build2) ... Setting up python-httplib2 (0.11.3-1) ... Setting up libsodium23:amd64 (1.0.16-2build1) ... Setting up python-cffi-backend (1.11.5-3ubuntu1) ... Setting up python-six (1.11.0-2) ... Processing triggers for libc-bin (2.28-0ubuntu1) ... Setting up sshpass (1.06-1) ... Setting up python-enum34 (1.1.6-2) ... Processing triggers for man-db (2.8.4-2) ... Setting up python-ipaddress (1.0.17-1) ... Setting up python-bcrypt (3.1.4-2build1) ... Setting up python-nacl (1.2.1-3build1) ... Setting up python-jinja2 (2.10-1) ... Setting up python-cryptography (2.3-1ubuntu1) ... Setting up python-paramiko (2.4.1-0ubuntu3.2) ... Setting up ansible (2.7.8-1ppa~cosmic) ...
And you are all set.
How to check which version of Ansible I’m running?
- Command:
ansible --version
root@localhost:~# ansible --version ansible 2.7.8 config file = /etc/ansible/ansible.cfg configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python2.7/dist-packages/ansible executable location = /usr/bin/ansible python version = 2.7.15+ (default, Oct 2 2018, 22:12:08) [GCC 8.2.0]
Where is my Ansible config file?
Ansible config file is located at location: /etc/ansible/
root@localhost:~# cd /etc/ansible/ root@localhost:/etc/ansible# ls -ltra total 36 -rw-r--r-- 1 root root 1016 Feb 21 19:50 hosts -rw-r--r-- 1 root root 20277 Feb 21 19:50 ansible.cfg drwxr-xr-x 2 root root 4096 Feb 21 19:50 roles drwxr-xr-x 93 root root 4096 Feb 23 17:05 .. drwxr-xr-x 3 root root 4096 Feb 23 17:05 .
Sample ansible.cfg file:
root@localhost:/etc/ansible# cat ansible.cfg # config file for ansible -- https://ansible.com/ # =============================================== # nearly all parameters can be overridden in ansible-playbook # or with command line flags. ansible will read ANSIBLE_CONFIG, # ansible.cfg in the current working directory, .ansible.cfg in # the home directory or /etc/ansible/ansible.cfg, whichever it # finds first [defaults] host_key_checking = false # some basic default values... #inventory = /etc/ansible/hosts #library = /usr/share/my_modules/ #module_utils = /usr/share/my_module_utils/ #remote_tmp = ~/.ansible/tmp #local_tmp = ~/.ansible/tmp #plugin_filters_cfg = /etc/ansible/plugin_filters.yml #forks = 5 #poll_interval = 15 #sudo_user = root #ask_sudo_pass = True #ask_pass = True #transport = smart #remote_port = 22 #module_lang = C #module_set_locale = False # plays will gather facts by default, which contain information about # the remote system. # # smart - gather by default, but don't regather if already gathered # implicit - gather by default, turn off with gather_facts: False # explicit - do not gather by default, must say gather_facts: True #gathering = implicit # This only affects the gathering done by a play's gather_facts directive, # by default gathering retrieves all facts subsets # all - gather all subsets # network - gather min and network facts # hardware - gather hardware facts (longest facts to retrieve) # virtual - gather min and virtual facts # facter - import facts from facter # ohai - import facts from ohai # You can combine them using comma (ex: network,virtual) # You can negate them using ! (ex: !hardware,!facter,!ohai) # A minimal set of facts is always gathered. #gather_subset = all # some hardware related facts are collected # with a maximum timeout of 10 seconds. This # option lets you increase or decrease that # timeout to something more suitable for the # environment. # gather_timeout = 10 # Ansible facts are available inside the ansible_facts.* dictionary # namespace. This setting maintains the behaviour which was the default prior # to 2.5, duplicating these variables into the main namespace, each with a # prefix of 'ansible_'. # This variable is set to True by default for backwards compatibility. It # will be changed to a default of 'False' in a future release. # ansible_facts. # inject_facts_as_vars = True # additional paths to search for roles in, colon separated #roles_path = /etc/ansible/roles # uncomment this to disable SSH key host checking #host_key_checking = False # change the default callback, you can only have one 'stdout' type enabled at a time. #stdout_callback = skippy ## Ansible ships with some plugins that require whitelisting, ## this is done to avoid running all of a type by default. ## These setting lists those that you want enabled for your system. ## Custom plugins should not need this unless plugin author specifies it. # enable callback plugins, they can output to stdout but cannot be 'stdout' type. #callback_whitelist = timer, mail # Determine whether includes in tasks and handlers are "static" by # default. As of 2.0, includes are dynamic by default. Setting these # values to True will make includes behave more like they did in the # 1.x versions. #task_includes_static = False #handler_includes_static = False # Controls if a missing handler for a notification event is an error or a warning #error_on_missing_handler = True # change this for alternative sudo implementations #sudo_exe = sudo # What flags to pass to sudo # WARNING: leaving out the defaults might create unexpected behaviours #sudo_flags = -H -S -n # SSH timeout #timeout = 10 # default user to use for playbooks if user is not specified # (/usr/bin/ansible will use current user as default) #remote_user = root # logging is off by default unless this path is defined # if so defined, consider logrotate #log_path = /var/log/ansible.log # default module name for /usr/bin/ansible #module_name = command # use this shell for commands executed under sudo # you may need to change this to bin/bash in rare instances # if sudo is constrained #executable = /bin/sh # if inventory variables overlap, does the higher precedence one win # or are hash values merged together? The default is 'replace' but # this can also be set to 'merge'. #hash_behaviour = replace # by default, variables from roles will be visible in the global variable # scope. To prevent this, the following option can be enabled, and only # tasks and handlers within the role will see the variables there #private_role_vars = yes # list any Jinja2 extensions to enable here: #jinja2_extensions = jinja2.ext.do,jinja2.ext.i18n # if set, always use this private key file for authentication, same as # if passing --private-key to ansible or ansible-playbook #private_key_file = /path/to/file # If set, configures the path to the Vault password file as an alternative to # specifying --vault-password-file on the command line. #vault_password_file = /path/to/vault_password_file # format of string {{ ansible_managed }} available within Jinja2 # templates indicates to users editing templates files will be replaced. # replacing {file}, {host} and {uid} and strftime codes with proper values. #ansible_managed = Ansible managed: {file} modified on %Y-%m-%d %H:%M:%S by {uid} on {host} # {file}, {host}, {uid}, and the timestamp can all interfere with idempotence # in some situations so the default is a static string: #ansible_managed = Ansible managed # by default, ansible-playbook will display "Skipping [host]" if it determines a task # should not be run on a host. Set this to "False" if you don't want to see these "Skipping" # messages. NOTE: the task header will still be shown regardless of whether or not the # task is skipped. #display_skipped_hosts = True # by default, if a task in a playbook does not include a name: field then # ansible-playbook will construct a header that includes the task's action but # not the task's args. This is a security feature because ansible cannot know # if the *module* considers an argument to be no_log at the time that the # header is printed. If your environment doesn't have a problem securing # stdout from ansible-playbook (or you have manually specified no_log in your # playbook on all of the tasks where you have secret information) then you can # safely set this to True to get more informative messages. #display_args_to_stdout = False # by default (as of 1.3), Ansible will raise errors when attempting to dereference # Jinja2 variables that are not set in templates or action lines. Uncomment this line # to revert the behavior to pre-1.3. #error_on_undefined_vars = False # by default (as of 1.6), Ansible may display warnings based on the configuration of the # system running ansible itself. This may include warnings about 3rd party packages or # other conditions that should be resolved if possible. # to disable these warnings, set the following value to False: #system_warnings = True # by default (as of 1.4), Ansible may display deprecation warnings for language # features that should no longer be used and will be removed in future versions. # to disable these warnings, set the following value to False: #deprecation_warnings = True # (as of 1.8), Ansible can optionally warn when usage of the shell and # command module appear to be simplified by using a default Ansible module # instead. These warnings can be silenced by adjusting the following # setting or adding warn=yes or warn=no to the end of the command line # parameter string. This will for example suggest using the git module # instead of shelling out to the git command. # command_warnings = False # set plugin path directories here, separate with colons #action_plugins = /usr/share/ansible/plugins/action #cache_plugins = /usr/share/ansible/plugins/cache #callback_plugins = /usr/share/ansible/plugins/callback #connection_plugins = /usr/share/ansible/plugins/connection #lookup_plugins = /usr/share/ansible/plugins/lookup #inventory_plugins = /usr/share/ansible/plugins/inventory #vars_plugins = /usr/share/ansible/plugins/vars #filter_plugins = /usr/share/ansible/plugins/filter #test_plugins = /usr/share/ansible/plugins/test #terminal_plugins = /usr/share/ansible/plugins/terminal #strategy_plugins = /usr/share/ansible/plugins/strategy # by default, ansible will use the 'linear' strategy but you may want to try # another one #strategy = free # by default callbacks are not loaded for /bin/ansible, enable this if you # want, for example, a notification or logging callback to also apply to # /bin/ansible runs #bin_ansible_callbacks = False # don't like cows? that's unfortunate. # set to 1 if you don't want cowsay support or export ANSIBLE_NOCOWS=1 #nocows = 1 # set which cowsay stencil you'd like to use by default. When set to 'random', # a random stencil will be selected for each task. The selection will be filtered # against the `cow_whitelist` option below. #cow_selection = default #cow_selection = random # when using the 'random' option for cowsay, stencils will be restricted to this list. # it should be formatted as a comma-separated list with no spaces between names. # NOTE: line continuations here are for formatting purposes only, as the INI parser # in python does not support them. #cow_whitelist=bud-frogs,bunny,cheese,daemon,default,dragon,elephant-in-snake,elephant,eyes,\ # hellokitty,kitty,luke-koala,meow,milk,moofasa,moose,ren,sheep,small,stegosaurus,\ # stimpy,supermilker,three-eyes,turkey,turtle,tux,udder,vader-koala,vader,www # don't like colors either? # set to 1 if you don't want colors, or export ANSIBLE_NOCOLOR=1 #nocolor = 1 # if set to a persistent type (not 'memory', for example 'redis') fact values # from previous runs in Ansible will be stored. This may be useful when # wanting to use, for example, IP information from one group of servers # without having to talk to them in the same playbook run to get their # current IP information. #fact_caching = memory #This option tells Ansible where to cache facts. The value is plugin dependent. #For the jsonfile plugin, it should be a path to a local directory. #For the redis plugin, the value is a host:port:database triplet: fact_caching_connection = localhost:6379:0 #fact_caching_connection=/tmp # retry files # When a playbook fails by default a .retry file will be created in ~/ # You can disable this feature by setting retry_files_enabled to False # and you can change the location of the files by setting retry_files_save_path #retry_files_enabled = False #retry_files_save_path = ~/.ansible-retry # squash actions # Ansible can optimise actions that call modules with list parameters # when looping. Instead of calling the module once per with_ item, the # module is called once with all items at once. Currently this only works # under limited circumstances, and only with parameters named 'name'. #squash_actions = apk,apt,dnf,homebrew,pacman,pkgng,yum,zypper # prevents logging of task data, off by default #no_log = False # prevents logging of tasks, but only on the targets, data is still logged on the master/controller #no_target_syslog = False # controls whether Ansible will raise an error or warning if a task has no # choice but to create world readable temporary files to execute a module on # the remote machine. This option is False by default for security. Users may # turn this on to have behaviour more like Ansible prior to 2.1.x. See # https://docs.ansible.com/ansible/become.html#becoming-an-unprivileged-user # for more secure ways to fix this than enabling this option. #allow_world_readable_tmpfiles = False # controls the compression level of variables sent to # worker processes. At the default of 0, no compression # is used. This value must be an integer from 0 to 9. #var_compression_level = 9 # controls what compression method is used for new-style ansible modules when # they are sent to the remote system. The compression types depend on having # support compiled into both the controller's python and the client's python. # The names should match with the python Zipfile compression types: # * ZIP_STORED (no compression. available everywhere) # * ZIP_DEFLATED (uses zlib, the default) # These values may be set per host via the ansible_module_compression inventory # variable #module_compression = 'ZIP_DEFLATED' # This controls the cutoff point (in bytes) on --diff for files # set to 0 for unlimited (RAM may suffer!). #max_diff_size = 1048576 # This controls how ansible handles multiple --tags and --skip-tags arguments # on the CLI. If this is True then multiple arguments are merged together. If # it is False, then the last specified argument is used and the others are ignored. # This option will be removed in 2.8. #merge_multiple_cli_flags = True # Controls showing custom stats at the end, off by default #show_custom_stats = True # Controls which files to ignore when using a directory as inventory with # possibly multiple sources (both static and dynamic) #inventory_ignore_extensions = ~, .orig, .bak, .ini, .cfg, .retry, .pyc, .pyo # This family of modules use an alternative execution path optimized for network appliances # only update this setting if you know how this works, otherwise it can break module execution #network_group_modules=eos, nxos, ios, iosxr, junos, vyos # When enabled, this option allows lookups (via variables like {{lookup('foo')}} or when used as # a loop with `with_foo`) to return data that is not marked "unsafe". This means the data may contain # jinja2 templating language which will be run through the templating engine. # ENABLING THIS COULD BE A SECURITY RISK #allow_unsafe_lookups = False # set default errors for all plays #any_errors_fatal = False [inventory] # enable inventory plugins, default: 'host_list', 'script', 'yaml', 'ini', 'auto' #enable_plugins = host_list, virtualbox, yaml, constructed # ignore these extensions when parsing a directory as inventory source #ignore_extensions = .pyc, .pyo, .swp, .bak, ~, .rpm, .md, .txt, ~, .orig, .ini, .cfg, .retry # ignore files matching these patterns when parsing a directory as inventory source #ignore_patterns= # If 'true' unparsed inventory sources become fatal errors, they are warnings otherwise. #unparsed_is_failed=False [privilege_escalation] #become=True #become_method=sudo #become_user=root #become_ask_pass=False [paramiko_connection] # uncomment this line to cause the paramiko connection plugin to not record new host # keys encountered. Increases performance on new host additions. Setting works independently of the # host key checking setting above. #record_host_keys=False # by default, Ansible requests a pseudo-terminal for commands executed under sudo. Uncomment this # line to disable this behaviour. #pty=False # paramiko will default to looking for SSH keys initially when trying to # authenticate to remote devices. This is a problem for some network devices
And you are all set. Let me know if you face any issue installing Ansible.
What’s next?
Install Ansible on macOS with command line commands:
How to install Ansible on MacOS using Homebrew or Python pip?