alvistack / ansible-role-podman

Ansible Role for Podman Installation
Apache License 2.0
57 stars 6 forks source link

support for debian9 #6

Closed dberardo-com closed 1 year ago

dberardo-com commented 2 years ago

in this article i could find installation steps for debian9: https://computingforgeeks.com/how-to-install-podman-on-debian/

however an ansible run gives following output:

image

hswong3i commented 2 years ago

First of all, our Ansible Role for Podman had some huge revamp during last 6 months, so their https://computingforgeeks.com/how-to-install-podman-on-debian/ guideline may no longer valid :-(

Secondly, Ansible Role for Podman now install .deb/.rpm from https://build.opensuse.org/project/show/home:alvistack for supported OS (rather than legacy static binary style). We are now supporting Debian 10/11/Testing, so Debian 9 is not supported.

My recommended procedure:

  1. Bootstrap Ansible and Molecule as similar as https://github.com/alvistack/ansible-collection-kubernetes#bootstrap-ansible-and-roles
  2. Deploy locally with molecule converge (see https://github.com/alvistack/ansible-role-podman/blob/master/molecule/default/converge.yml)
dberardo-com commented 2 years ago

thanks for the quick reply. i am not too experienced with molecule, so i guess i would rather try to upgrade the node to debian 10 first and see if running ansible as a playbook works.

hswong3i commented 2 years ago

Molecule (https://molecule.readthedocs.io/en/latest/) is the testing framework for Ansible.

Here we transform the delegated driver (https://molecule.readthedocs.io/en/latest/configuration.html#delegated) + default scenario (https://molecule.readthedocs.io/en/latest/getting-started.html#molecule-scenarios) as a self installer for simplify deployment procedure with localhost.

Some sample snippet as your reference:

# Test with Debian 10
$ sudo podman run -ti --rm --privileged debian:10

# Install basic packages
echo 'deb http://deb.debian.org/debian buster-backports main' | tee /etc/apt/sources.list.d/buster-backports.list
cat > /etc/apt/preferences.d/buster-backports.pref <<-EOF
Package: *
Pin: release a=buster-backports
Pin-Priority: 500
EOF
apt update
apt install -y curl gpg git

# Install Ansible, see https://software.opensuse.org/download/package?package=ansible&project=home%3Aalvistack
echo 'deb http://download.opensuse.org/repositories/home:/alvistack/Debian_10/ /' | tee /etc/apt/sources.list.d/home:alvistack.list
curl -fsSL https://download.opensuse.org/repositories/home:alvistack/Debian_10/Release.key | gpg --dearmor | tee /etc/apt/trusted.gpg.d/home_alvistack.gpg > /dev/null
apt update
apt install -y ansible

# Install Molecule
apt install -y python3-molecule

# Get the Ansible Role for Podman (develop branch)
mkdir -p /root/.ansible/roles
cd /root/.ansible/roles
git clone -b develop https://github.com/alvistack/ansible-role-podman.git alvistack.podman

# Run deployment with Molecule, it will download any else required roles for you, too
cd /root/.ansible/roles/alvistack.podman
molecule converge

# Check result
podman info
dberardo-com commented 2 years ago

i have upgrade the remote host to debian10 and tried to rerun the playbook using conventional ansbile-playbook command. Now some packages are installed whereas others aren't, do you know why?

image

hswong3i commented 2 years ago

This seems to be APT cache not refreshed yet, after our OBS repo added.

Let's try to debug in this way: manually log into the remote Debian 10 with root and execute as below:

# This should failed
apt install -y podman

# Now update APT cache and retry
apt update
apt install -y podman

If this solve the issue, you may run these playbooks in order (as like as how molecule converge does, where the prepare.yml handle the trick for basic bootstrap a node):

dberardo-com commented 2 years ago

unfortunately i had already done that, with no results: image

the content of the file cat /etc/apt/sources.list.d/home\:alvistack.list is:

deb http://download.opensuse.org/repositories/home:/alvistack/Debian_Testing/ / deb http://download.opensuse.org/repositories/home:/alvistack/Debian_10/ /

hswong3i commented 1 year ago

I give a double check with https://github.com/alvistack/ansible-role-podman/blob/master/CHANGELOG.md#440---2020-06-04 and our initial official support for Debian since 10 (not 9).

Previously the podman file is compile as static binary with Nix for simplicity across multiple OS and platform (but it is now proof as non-efficent as compare with OBS-based deb/rpm packaging), so it could apply for Debian 9. BTW, we no longer support this method here :-(