Install pipx:
sudo apt install python3-pip
sudo pip install pipxInstall ansible-core:
pipx install --include-deps ansible
pipx install ansible-core
ansible --version
pipx inject --include-apps ansible argcomplete
activate-global-python-argcomplete --userAlso install this to manage Windows boxes:
ansible-galaxy collection install ansible.windowsGenerate a SSH key for the control node, and append its public key to managed node authorized_keys files.
Create a directory for your first playbook and cd into it. Create a basic inventory list in inventory.ini and include all hostnames/IPs you want to manage with Ansible:
[myhosts]
10.0.0.5
10.0.0.6
10.0.0.7Finally, create a playbook called playbook.yml:
- name: My first play
hosts: myhosts
tasks:
- name: Ping my hosts
ansible.builtin.ping:
- name: Print message
ansible.builtin.debug:
msg: Hello worldDeploy it with ansible-playbook -i inventory.ini playbook.yml