- So, what do we have?
We have these playbooks.
There is docker_main.
Okay, let's move docker_main.yaml
to runcontainer.yaml.
Or move, let's just copy it.
Backwards compatibility is always good.
So runcontainer, and there we have podman.yaml,
and I'm going to copy podman.yaml to podman-rh.yaml.
I hope you see what is coming here.
I wanna do something creative here.
So let me start with podman-rh.yaml,
where I am going to make sure that, well,
the hosts is what we are going to do later.
The collections, that is what we need.
So I'm going to use include_playbook.
We haven't done that too often,
but I'm going to use include_playbook
to make that a conditional playbook inclusion.
So I am going to work with the runcontainer,
and in runcontainer,
I'm using include_playbook
podman-rh.yaml.
And when are we going to do that?
Well, we are going to do that when ansible_facts,
and then it's easy to make the mistake.
It's not distribution_family.
It's os_family
equals
Rocky.
Do we care about RedHat?
Okay, okay, we do care about RedHat,
or ansible_facts
os_family
equals RedHat.
This is not going to work.
We need to make sure that we can wrap the argument to when
over multiple lines.
This should be working.
So podman-rh.yaml is going to be included,
and let's go check it out,
ansible-playbook runcontainer.yaml.
And uh-oh, we can see this task include_playbook
has extra parameters which is only allowed in.
Well, if that is not allowed in,
then we go for a different approach.
You know the different approach.
I have information in the playbook header.
I'm not comfortable using Ansible playbook include anyway.
I'm making it ansible_tasks,
and in the ansible_tasks, well,
we are going to use the collections right here.
What was the name again?
I don't remember the name,
but we will find that soon enough in podman-rh.
So cat podman-rh.yaml,
where we can see collections hyphen containers.podman.
So we need hyphen containers.podman.
There we go, containers.podman.
And then we need to tweak the podman-rh.yaml.
So we can delete six lines or so.
This line, as well.
This is falling within the scope of the tasks,
so just a list of tasks should be doing it.
Is that so?
Let's get back to runcontainer.
Yeah, we have a list of tasks
and we have include statements
to include the appropriate tasks whenever that is needed.
So let's check and see if we are doing better this time.
And there we can see it's not too happy about the CentOS 7.
Do we care about the CentOS 7?
I think not.
We care about the fact that the playbook
is running smoothly on all hosts.
So instead of having one different playbook for Podman,
one different playbook for Docker,
we have one playbook taking care of Docker and Podman.
Isn't that nice?