Junior — Middle
How to automate the deployment of a Python interpreter on multiple servers using Ansible?
sobes.tech AI
Answer from AI
To automate the deployment of the Python interpreter on multiple servers using Ansible, you can create a simple playbook that:
- Connects to the target servers.
- Installs the required Python package via the package manager (e.g., apt for Ubuntu/Debian).
Example playbook for installing Python 3 on Ubuntu servers:
- hosts: all
become: yes
tasks:
- name: Update package cache
apt:
update_cache: yes
- name: Install Python 3
apt:
name: python3
state: present
Run:
ansible-playbook -i inventory.ini install_python.yml
Where inventory.ini is a file with the list of servers. This approach allows for quick and repeatable deployment of Python across multiple machines.