CentOS Stream 10
Sponsored Link

Ansible : Install2025/02/18

 

Install Ansible which is the configuration management tool.

Ansible does not require dedicated server/client program, it needs Ansible command and SSH only.

[1]

Start SSH service on all client hosts which you'd like to manage with Ansible.

[2] Install Ansible.
[root@dlp ~]#
dnf -y install ansible-core
[root@dlp ~]#
ansible --version

ansible [core 2.16.14]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.12/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.12.8 (main, Dec  3 2024, 00:00:00) [GCC 14.2.1 20241104 (Red Hat 14.2.1-6)] (/usr/bin/python3)
  jinja version = 3.1.5
  libyaml = True
[3] Define client hosts as management targets.
[root@dlp ~]#
mv /etc/ansible/ansible.cfg /etc/ansible/ansible.cfg.org

[root@dlp ~]#
ansible-config init --disabled > /etc/ansible/ansible.cfg

[root@dlp ~]#
vi /etc/ansible/ansible.cfg
# line 320 : uncomment and change if you need (check or not SSH host key)

host_key_checking=
False
[root@dlp ~]#
vi /etc/ansible/hosts
# add to last line
# set target hosts

10.0.0.50

# set targets as a group
# any group name

[target_servers]
# set targets per line

10.0.0.51
10.0.0.52
# confirm settings
# show all defined hosts

[root@dlp ~]#
ansible all --list-hosts

  hosts (3):
    10.0.0.50
    10.0.0.51
    10.0.0.52

# show specific hosts in a group

[root@dlp ~]#
ansible target_servers --list-hosts

  hosts (2):
    10.0.0.51
    10.0.0.52
Matched Content