Ansible安裝

Ansible Installation
Packages
ansible-core
a minimalist language and runtime package
ansible
a much larger “batteries included” package
Version
2021 2-4:ansible-core 2.11
2021 1-6: Ansible 4.0
2021 9-11: ansible-core 2.12
2021 4-12: Ansible 5.0
2022 3-5: ansible-core 2.13
2022 3-7: Ansible 6.0
2022 9-11: ansible-core 2.14
2022 9-12: Ansible 7.0
Requirements
Control Node
UNIX-like OS
Red Hat
Debian
Ubuntu
macOS
BSDs ( Berkeley Software Distribution )
Windows with WSL ( Windows Subsystem for Linux )
>= Python 3.9 (for ansible-core 2.14)
Managed Node
>= Python 2.7 or Python 3.5 (for ansible-core 2.14)
User account for SSH
https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html
Install by apt
sudo apt install ansible
sudo apt upgrade ansible
Confirm
which ansible
/usr/bin/ansible
ansible --version
ansible 2.9.6 config file = /etc/ansible/ansible.cfg configured module search path = ['/home/jiali/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python3/dist-packages/ansible executable location = /usr/bin/ansible python version = 3.8.10 (default, Mar 13 2023, 10:26:41) [GCC 9.4.0
Install by pip
pip
sudo apt install python3-pip
which pip
/usr/bin/pip
pip --version
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)
python3 -m pip install [--user] ansible-core==X.X.X
python3 -m pip install [--user] ansible==6.7.0
python3 -m pip install --upgrade [--user] ansible
Confirm
python3 -m pip show ansible
python3 -m pip show ansible Name: ansible Version: 6.7.0 Summary: Radically simple IT automation Home-page: https://ansible.com/ Author: Ansible, Inc. Author-email: info@ansible.com License: GPLv3+ Location: /home/jiali/.local/lib/python3.8/site-packages Requires: ansible-core Required-by:
ansible --version
ansible --version ansible [core 2.13.8] config file = /etc/ansible/ansible.cfg configured module search path = ['/home/jiali/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /home/jiali/.local/lib/python3.8/site-packages/ansible ansible collection location = /home/jiali/.ansible/collections:/usr/share/ansible/collections executable location = /usr/bin/ansible python version = 3.8.10 (default, Mar 13 2023, 10:26:41) [GCC 9.4.0] jinja version = 3.1.2 libyaml = True
which ansible
/usr/bin/ansible
ls -l /usr/bin/ansible
/usr/bin/ansible -> ../lib/python3/dist-packages/ansible/cli/scripts/ansible_cli_stub.py