
As enterprise IT environments grow more complex, automation becomes not just a convenience but a necessity. With native support for Ansible in SUSE Linux Enterprise Server 16 (SLES 16), IT teams can manage systems at scale with greater consistency and control.
This guide introduces the fundamentals of Ansible and walks you through installing it, writing your first playbook, and automating your SLES 16 environment.
What Is Ansible?
Contents
Ansible is a widely adopted open source automation framework used for configuration management, application deployment, and orchestration across hybrid infrastructure. It’s agentless, secure by default, and uses human-readable YAML to define infrastructure as code.
With Ansible now integrated into SLES 16, administrators can streamline repetitive tasks, standardize system configuration, and reduce human error without needing to install any agents on managed systems.
Key Terminology
Before diving into hands-on steps, here’s a quick overview of common terms used in Ansible:
Why Use Ansible on SLES?
- Agentless: No dedicated connection software is required on the managed nodes.
- Secure by Default: Uses SSH for communication
- Parallel Execution: Runs tasks across many systems simultaneously
- Simple Syntax: YAML-based playbooks that anyone on your team can read
- Integrated in SLES 16: Supported by SUSE
Prerequisites
Control Node:
- A host running SLES 16
- Root user or user with sudo permissions
- Connection to Managed Nodes by SSH port.
Managed Node(s):
- A host(s) running SLES 15SP6+ or 16
- Root user or user with sudo permissions
Step 1: Install Ansible
With SLES 16, Ansible is already part of the base system no additional repositories or modules needed.
sudo zypper refresh sudo zypper install ansible
Verify the installation:
ansible --version
Expected output:
ansible [core 2.18.3] config file = None configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python3.13/site-packages/ansible ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections executable location = /usr/bin/ansible python version = 3.13.5 (main, Jun 12 2025, 00:40:24) [GCC] (/usr/bin/python3.13) jinja version = 3.1.6 libyaml = True
Step 2: Configure SSH Access for Automation
For Ansible to operate seamlessly, set up SSH key-based authentication from the control node to each managed node.
Generate a key pair on the control node:
ssh-keygen
(Note: It is recommended to use dedicated SSH key, which requires SSH key to be defined in the variable ansible_ssh_private_key_file
.)
Then copy the public key to the managed node:
ssh-copy-id <target user>@<IP address/Hostname of the managed node>
This one-time setup allows Ansible to connect securely without prompting for credentials during automation.
Step 3: Define an Inventory File
An inventory is a list of systems Ansible manages. You can define individual hosts or group them based on roles such as web, app, or database servers.
Although Ansible uses /etc/ansible/hosts
by default, it’s best practice to maintain a separate inventory file and specify it using the -i
flag. In this guide, we’ll connect using a dedicated automation user ansible
with sudo privileges.
Example (hosts.ini
):
[webservers] 10.10.10.11 ansible_user=ansible 10.10.10.12 ansible_user=ansible [dbservers] 10.10.20.5 ansible_user=ansible
Step 4: Verify Connectivity with an Ad-Hoc Command
Once your inventory and SSH configuration are in place, test the connection between the control node and managed systems using an Ansible ad-hoc command:
ansible all -i hosts.ini -m ping
If configured correctly, you should see a response like:
10.10.10.11 | SUCCESS => {"ping": "pong"} 10.10.10.12 | SUCCESS => {"ping": "pong"}
This confirms Ansible can securely reach the managed nodes over SSH.
Step 5: Create and Run Your First Playbook
Playbooks are YAML files that define the tasks Ansible should perform. Create a file named install.yml
to define a basic automation task for example, installing common packages on all managed SUSE systems:
--- - name: Ensure essential packages are present hosts: all become: true tasks: - name: Install vim and curl ansible.builtin.package: name: - suseconnect - curl state: present
Run the playbook:
ansible-playbook -i hosts.ini install.yml
Ansible will connect to each host in your inventory and execute the defined tasks using the system’s package manager.
Conclusion
With Ansible now included in SUSE Linux Enterprise Server 16, getting started with automation is straightforward. This guide covered the basics installing Ansible, setting up access to managed systems, and running your first playbook.
Ansible is a practical, scriptable way to manage multiple systems more reliably. SUSE’s integration ensures it works out of the box, so teams can focus on building repeatable tasks and improving day-to-day system administration.
(Visited 1 times, 1 visits today)