INSTALLATION, UPGRADE & CONFIGURATION

https://docs.ansible.com/ansible/2.9/index.html

Ansible’s main goals are simplicity and ease-of-use.

usage of OpenSSH for transport with other transports and pull modes as alternatives

Ansible manages machines in an agent-less manner.

If needed, Ansible can easily connect with Kerberos, LDAP, and other centralized authentication management systems.

本页面里有整个ansible的大纲

https://docs.ansible.com/ansible/2.9/installation_guide/intro_installation.html

安装指南

Ansible is an agentless automation tool that by default manages machines over the SSH protocol. Once installed, Ansible does not add a database, and there will be no daemons to start or keep running. You only need to install it on one machine and it can manage an entire fleet of remote machines from that central point. When Ansible manages remote machines, it does not leave software installed or running on them, so there’s no real question about how to upgrade Ansible when moving to a new version.

  • Prerequisites (安装要求)

    • Control node requirements (控制节点)

      • Currently Ansible can be run from any machine with Python 2 (version 2.7) or Python 3 (versions 3.5 and higher) installed. This includes Red Hat, Debian, CentOS, macOS, any of the BSDs, and so on. Windows is not supported for the control node.
    • Managed node requirements (被控节点)

      • On the managed nodes, you need a way to communicate, which is normally SSH. By default this uses SFTP. If that’s not available, you can switch to SCP in ansible.cfg. You also need Python 2 (version 2.6 or later) or Python 3 (version 3.5 or later).
  • 不同版本的Ansible对被控节点的python版本要求不一样

  • 如果被控节点上安装开启了SELinux,则需要额外在被控节点安装 libselinux-python

ansible默认认为被控节点的python路径在 /usr/bin/python ,如果不是需要手动调整,常见相关报错如下

"module_stdout": "/bin/sh: /usr/bin/python: No such file or directory\r\n"

在Ansible的主机清单里可以配置每台机器的python解释器路径

  • Installing Ansible on RHEL, CentOS, or Fedora
    • yum 安装方式
    • 编译自己的rpm包
  • Installing Ansible on Ubuntu
  • Installing Ansible on Debian
  • Installing Ansible on Gentoo with portage
  • Installing Ansible on FreeBSD
  • Installing Ansible on macOS
  • Installing Ansible on Solaris
  • Installing Ansible on Arch Linux
  • Installing Ansible on Slackware Linux
  • Installing Ansible on Clear Linux
  • Installing Ansible with pip
    • 为避免干扰 最好安装在virtualenv里
  • Running Ansible from source (devel)
  • Finding tarballs of tagged releases
  • Ansible command shell completion
    • 命令自动补全
  • Ansible on GitHub

https://docs.ansible.com/ansible/2.9/installation_guide/intro_configuration.html

This topic describes how to control Ansible settings.

Certain settings in Ansible are adjustable via a configuration file (ansible.cfg).

If installing Ansible from a package manager, the latest ansible.cfg file should be present in /etc/ansible, possibly as a .rpmnew file (or other) as appropriate in the case of updates.

https://github.com/ansible/ansible/blob/devel/examples/ansible.cfg

Starting with Ansible version 2.4, you can use the ansible-config command line utility to list your available options and inspect the current values.

Ansible also allows configuration of settings using environment variables. If these environment variables are set, they will override any setting loaded from the configuration file.

Not all configuration options are present in the command line, just the ones deemed most useful or common. Settings in the command line will override those passed through the configuration file and the environment.

配置文件设置优先级 Command line options << Environmental configuration << Configuration file

https://docs.ansible.com/ansible/2.9/porting_guides/porting_guides.html

这篇文章说的是Ansible各类版本升级指南

porting 在计算机英语中是 移植 的含义