Ansible3:ansible.cfg configuration description "Go"

Source: Internet
Author: User

Ansible is installed by default and has a profile/etc/ansible/ansible.cfg that defines the default configuration portion of the Ansible host, such as whether you need to enter a password by default, whether to turn on sudo authentication, action_ The location of the plugins plugin, the location of the hosts host group, whether to turn on the log function, the default port, the key file location, and so on.

Specific as follows:

[Defaults]
# some basic default values ...
Hostfile =/etc/ansible/hosts \ \ Specifies the location of the default hosts configuration
# Library_path =/usr/share/my_modules/
Remote_tmp = $HOME/.ansible/tmp
Pattern = *
Forks = 5
Poll_interval = 15
Sudo_user = root \ Remote sudo user
#ask_sudo_pass = True \ \ Ask the SSH password every time the ansible command is executed
#ask_pass = True \ \ Ask for sudo password each time the ansible command is executed
Transport = Smart
Remote_port = 22
Module_lang = C
Gathering = Implicit
host_key_checking = False \ \ Close the first time you use the Ansible connection client is the input command prompt
Log_path =/var/log/ansible.log You can add it yourself when you need it. Chown-r Root:root Ansible.log
system_warnings = False \ \ Close the system's prompt when running ansible, usually prompting for an upgrade
# Set Plugin path directories here, separate with colons
Action_plugins =/usr/share/ansible_plugins/action_plugins
Callback_plugins =/usr/share/ansible_plugins/callback_plugins
Connection_plugins =/usr/share/ansible_plugins/connection_plugins
Lookup_plugins =/usr/share/ansible_plugins/lookup_plugins
Vars_plugins =/usr/share/ansible_plugins/vars_plugins
Filter_plugins =/usr/share/ansible_plugins/filter_plugins
fact_caching = Memory
[Accelerate]
Accelerate_port = 5099
Accelerate_timeout = 30
Accelerate_connect_timeout = 5.0
# The daemon timeout is measured in minutes. This is measured
# from the last activity to the accelerate daemon.
Accelerate_daemon_timeout = 30

If you connect to a previously disconnected host, The Times are wrong:

Ansible test-a ' uptime '
192.168.1.1| FAILED =>using a SSH password instead of a key is not possible because Hostkey checking are enabled and Sshpass does not Support this. Please add this host ' s fingerprint to your known_hosts the file to manage.
192.168.1.2 | FAILED = Using a SSH password instead of a key is not possible because Host key checking is enabled and Sshpass does n  OT support this. Please add this host ' s fingerprint to your known_hosts the file to manage.

is due to the ~/.ssh/known_hosts file in this machine and there is fingerprint key string, SSH first connection when the general will be prompted to enter Yes to confirm that the key string is added to the ~/.ssh/known_hosts file.

Method 1:

When you make an SSH connection, you can use the-o parameter to set stricthostkeychecking to No, and use SSH to avoid prompting for the yes/no part of the first connection when you connect. By looking at the ansible.cfg configuration file, the following line is found:

[Ssh_connection]
# SSH arguments to use
# leaving off Controlpersist would result in poor performance
# Paramiko on older platforms rather than removing it
#ssh_args =-O controlmaster=auto-o controlpersist=60s

You can enable the Ssh_args section and use the following configuration to avoid errors that occur above:

Ssh_args =-O controlmaster=auto-o controlpersist=60s-o stricthostkeychecking=no
Method 2:

In the ansible.cfg configuration file, you will also find the following configuration:

# Uncomment this to disable SSH key host checking
host_key_checking = False

The default host_key_checking section is commented, and it is also possible to skip the SSH first connection hint verification section by looking up the comment for that line. However, in the actual test, it does not seem to be effective, it is recommended to use Method 1.

Other parts

The default ansible does not output the log to the file, but the following line is in the ansible.cfg configuration file:

Log_path =/var/log/ansible.log

By default Log_path This line is commented, open the comment of the line, and after all the commands are executed, the log is output to the/var/log/ansible.log file.

Turn from

This article is from the "Nobody" blog, please be sure to keep this source http://breezey.blog.51cto.com/2400275/1757635

Ansible3:ansible.cfg configuration description "Go"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.