Ansible on openSUSE Leap 15.6 Automation Complete Guide
By Luca Berton · Published 2024-01-01 · Category: installation
Automate openSUSE Leap 15.6 with Ansible: zypper, AppArmor, firewalld, Cockpit, Podman, YaST integration, and migration to Leap Micro / SLES.
openSUSE Leap 15.6 is the community release built on the same SLE 15 SP6 source. It targets developers, lab servers, and home users who want SLES-quality stability without subscription. Leap 15.6 ships kernel 6.4, Python 3.11, OpenSSH 9.6, AppArmor, and firewalld. It is supported through December 2025 and (with extension) into 2026, after which users migrate to Leap Micro 6.x or openSUSE Slowroll. This guide covers Ansible automation on Leap 15.6.
openSUSE Leap 15.6 release facts
| Item | Value | |---|---| | Release | 2024-06-12 | | EOL | 2025-12-31 (extended community support) | | Default kernel | 6.4 | | Default Python | 3.11 | | Package manager | zypper | | MAC | AppArmor |
See also: Ansible on openSUSE Tumbleweed Automation Complete Guide
Ansible-core compatibility
Use ansible-core 2.18 LTS.
Baseline playbook
- name: openSUSE Leap 15.6 baseline
hosts: leap156
become: true
tasks:
- name: Refresh repos
community.general.zypper_repository: { repo: "*", autorefresh: true, runrefresh: true }
- name: Update packages
community.general.zypper: { name: "*", state: latest }
- name: Install baseline tools
community.general.zypper:
name: [vim, chrony, firewalld, apparmor-utils, cockpit, podman, htop]
state: present
- name: Enable services
ansible.builtin.service:
name: "{{ item }}"
enabled: true
state: started
loop: [chronyd, firewalld, cockpit.socket]
See also: Ansible on SUSE Linux Enterprise Server 15 SP6 Automation Complete Guide
YaST as a fallback (idempotent CLI)
- name: Use YaST to add a user (when AD/LDAP not available)
hosts: leap156
become: true
tasks:
- name: yast users add
ansible.builtin.command: yast users add username=devops password={{ vault_devops_pass }} no_home=yes
register: yast
changed_when: "'created' in yast.stdout"
Migration path: Leap 15.6 -> SLES 15 SP6
- name: Migrate Leap 15.6 to SLES 15 SP6
hosts: leap156
become: true
tasks:
- name: Download SLES migration tool
ansible.builtin.get_url:
url: https://download.suse.com/migration/leap-to-sles.sh
dest: /root/leap-to-sles.sh
mode: "0755"
- name: Run migration with reg code
ansible.builtin.command: /root/leap-to-sles.sh -r {{ scc_regcode }} -e {{ scc_email }}
args:
creates: /etc/SuSE-brand
See also: Ansible on SUSE Linux Enterprise Server 16 Automation Complete Guide
Best practices
• Plan the post-EOL migration to Leap Micro, openSUSE Slowroll, or SLES well before December 2025. • Use the samecommunity.general.zypper patterns from SLES playbooks — Leap shares the SLES code base.
• AppArmor profiles authored for Leap usually port unchanged to SLES.
Conclusion
openSUSE Leap 15.6 is the community face of SLES 15. Ansible playbooks translate 1:1 between the two, making Leap an excellent free testbed for SLES-bound automation.
Installing Ansible on openSUSE Leap 15.6
# Install via zypper
sudo zypper install ansible
# Verify
ansible --version
Zypper Package Management
- name: Configure openSUSE Leap 15.6
hosts: opensuse
become: true
tasks:
- name: Install packages
community.general.zypper:
name:
- vim
- git
- curl
- firewalld
- python3-pip
state: present
- name: Update all packages
community.general.zypper:
name: "*"
state: latest
- name: Configure firewalld
ansible.posix.firewalld:
service: "{{ item }}"
permanent: true
immediate: true
state: enabled
loop: [ssh, http, https]
- name: Manage AppArmor profiles
ansible.builtin.command: aa-enforce /etc/apparmor.d/usr.sbin.nginx
changed_when: true
- name: Enable automatic updates
community.general.zypper:
name: yast2-online-update-configuration
state: present
FAQ
What is the difference between Leap and Tumbleweed?
Leap is a stable release with fixed versions (like RHEL). Tumbleweed is rolling release with the latest packages. Leap is better for servers; Tumbleweed for workstations.
Is openSUSE Leap compatible with SLES?
Leap shares the same core as SLES. Most Ansible playbooks work on both with minimal changes, mainly around repository management.
Category: installation