This repository provides Ansible playbooks for managing the deployment of the Mario Brothers game container using Podman.
- hosts: localhost
collections:
- containers.podman
tasks:
- name: Entering Mario Land
containers.podman.podman_container:
name: mario_game
image: "docker.io/kaminskypavel/mario:latest"
state: started
ports: "4545:8080"
register: mario
- debug:
msg: "Go down the tube here: http://127.0.0.1:4545"
when: mario.container.State.ExitCode == 0
- debug:
msg: "Tube is blocked"
when: mario.container.State.ExitCode == 1
Usage:
-
Install Ansible:
-
Linux (Red Hat):
sudo yum install -y ansible
-
Mac (via Brew):
brew install ansible
-
-
Create the directory in your user space:
mkdir -p ~/ansible/ cd ~/ansible
-
Create the
ansible.cfg
file:vim ansible.cfg
Add the following configuration and save:
[defaults] inventory=./inventory
-
Create the
inventory
file:vim inventory
Add the following, replacing
your-local-ip
with your actual local IP:[localhost] your-local-ip ansible_connection=local
Example:
[localhost] 192.168.101.214 ansible_connection=local
-
Run
ansible --version
to verify if the configuration file has been picked up. -
Install Podman:
-
Red Hat (RHEL):
sudo yum install -y podman
-
Mac (via Brew):
brew install podman
-
-
Run the Ansible playbook to start the Mario Brothers container:
ansible-playbook mario_pod.yml
-
After successful execution, access Mario Land through the provided URL.
-
Run the Ansible playbook to stop and remove the Mario Brothers container:
ansible-playbook mario-pod-rm.yml
- Customize the playbooks according to your specific requirements.
- Ensure proper network configurations and permissions for successful execution.
- A big thank you to kaminskypavel for providing the Mario Brothers container image.