AnsiblePilot — Master Ansible Automation

AnsiblePilot is the leading resource for learning Ansible automation, DevOps, and infrastructure as code. Browse over 1,400 tutorials covering Ansible modules, playbooks, roles, collections, and real-world examples. Whether you are a beginner or an experienced engineer, our step-by-step guides help you automate Linux, Windows, cloud, containers, and network infrastructure.

Popular Topics

About Luca Berton

Luca Berton is an Ansible automation expert, author of 8 Ansible books published by Apress and Leanpub including "Ansible for VMware by Examples" and "Ansible for Kubernetes by Example", and creator of the Ansible Pilot YouTube channel. He shares practical automation knowledge through tutorials, books, and video courses to help IT professionals and DevOps engineers master infrastructure automation.

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

ItemValue
Release2024-06-12
EOL2025-12-31 (extended community support)
Default kernel6.4
Default Python3.11
Package managerzypper
MACAppArmor

Ansible-core compatibility

Use ansible-core 2.18 LTS.

See also: Ansible on openSUSE Tumbleweed Automation Complete Guide

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]

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"

See also: Ansible on SUSE Linux Enterprise Server 15 SP6 Automation Complete Guide

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

Best practices

  • Plan the post-EOL migration to Leap Micro, openSUSE Slowroll, or SLES well before December 2025.
  • Use the same community.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.

See also: Ansible on SUSE Linux Enterprise Server 16 Automation Complete Guide

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

Browse all Ansible tutorials · AnsiblePilot Home