20 January 2026

ansible suse leap automation linux

Ansible on openSUSE Leap 15: Quick Setup Guide

Quick one-liner: Install Ansible on openSUSE Leap 15, configure your inventory, disable host key checking, and run your first ad-hoc commands — all in under 5 minutes.


🤔 Why This Matters

Ansible is more commonly associated with Red Hat, but it works just fine on SUSE. Setting it up on openSUSE Leap 15 is straightforward.


🔧 Step 1: Install Ansible

sudo zypper install ansible

🔧 Step 2: Configure Your Inventory

Edit /etc/ansible/hosts and add the hosts you want to manage:

[webservers]
192.168.5.1 ansible_user=root ansible_password=pass1234

[databases]
192.168.5.2 ansible_user=root ansible_password=pass1234 ansible_port=2222

The format is straightforward: - ansible_user — SSH username - ansible_password — SSH password - ansible_port — SSH port (optional, defaults to 22)


🔧 Step 3: Disable Host Key Checking (Optional)

If you're managing lab servers and don't want to confirm host keys every time, edit /etc/ansible/ansible.cfg:

[defaults]
host_key_checking = False

Security note: Only disable host key checking in trusted lab environments. For production, keep it enabled.


🔧 Step 4: Test Your Setup

# Ping all hosts
ansible all -m ping

# Run a command on all hosts
ansible all -a "cat /etc/hosts"

# Gather facts from all hosts
ansible all -m setup

You should see green SUCCESS responses from each host.


✅ Quick Reference

Command What It Does
zypper install ansible Install Ansible
ansible all -m ping Test connectivity
ansible all -a "command" Run an ad-hoc command
ansible all -m setup Gather system facts
ansible-playbook site.yml Run a playbook