Skip to content

Conversation

@mhuber-avst
Copy link
Contributor

Stumbled across this today, here's a solution to not process volumes if they're not empty

@stdevel
Copy link
Owner

stdevel commented Oct 3, 2025

Oh cool, I just discovered the same issue recently in #62.

I will have a look at your code, thanks a lot for sharing!

Copy link
Owner

@stdevel stdevel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed the linting but I can't add it to this PR. Here is the fixed install.yml:

---
- name: Install packages
  community.general.zypper:
    name: "{{ server_pkgs }}"
  notify: Reboot system (if immutable)
  become: true

- name: Ensure that Podman volumes work as expected
  containers.podman.podman_volume:
    name: test_volume
  become: true

- name: Check if volumes are already configured
  ansible.builtin.shell:
    cmd: |
      for vol in {{ server_disk_volumes }} {{ server_disk_database }}; do
      type=$(wipefs -O type -p $vol)
      [[ ${{ '{' ~ '#' }}type} -eq 0 ]] && echo "${vol}: true" || echo "${vol}: false"
      done
  register: server_volume_usage
  become: true

- name: Save volume config status to dict
  ansible.builtin.set_fact:
    server_vols: "{{ server_volume_usage.stdout | from_yaml }}"
  become: true

- name: Prepare storage for volumes and database
  ansible.builtin.command:
    cmd: "mgr-storage-server {{ server_disk_volumes }} {{ server_disk_database }}"
  when:
    - server_disk_volumes is defined and server_vols[server_disk_volumes]
    - server_disk_database is defined and server_vols[server_disk_database]
  become: true

- name: Prepare storage for volumes
  ansible.builtin.command:
    cmd: "mgr-storage-server {{ server_disk_volumes }}"
  when:
    - server_disk_volumes is defined and server_vols[server_disk_volumes]
    - server_disk_database is not defined
  become: true

- name: Stage deploy configuration
  ansible.builtin.template:
    src: uyuni.yml.j2
    dest: "/root/uyuni.yml"
    mode: "0644"
    owner: root
    group: root
  become: true

- name: Download air-gapped container image
  community.general.zypper:
    name: suse-manager-{{ server_suma_release }}-{{ ansible_architecture }}-server-image
  notify: Reboot system (if immutable)
  when: server_suma_airgapped
  become: true

- name: Enable netavark workaround
  community.general.ini_file:
    path: /etc/systemd/system/uyuni-server.service.d/netavark.conf
    owner: root
    group: root
    mode: '0640'
    section: Service
    option: Environment
    value: NETAVARK_FW=iptables
    no_extra_spaces: true
    backup: true
  when: ansible_distribution | lower in ['opensuse microos', 'opensuse tumbleweed']
  become: true

- name: Trigger reboot (if necessary)
  ansible.builtin.meta: flush_handlers

- name: Set default FQDN
  ansible.builtin.set_fact:
    server_fqdn: "{{ ansible_fqdn }}"
  when: server_fqdn is not defined

- name: Run installation
  ansible.builtin.command: "mgradm -c /root/uyuni.yml install podman {{ server_fqdn }}"
  args:
    creates: /root/.MANAGER_INITIALIZATION_COMPLETE
  become: true
  notify: Create initialization file

@mhuber-avst
Copy link
Contributor Author

I updated install.yml with your linting, let me know if there's more that needs be done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants