53 lines
1.2 KiB
YAML

- name: Pull Portainer Podman image
containers.podman.podman_image:
name: portainer/portainer-ce
- name: Create Portainer container
containers.podman.podman_container:
name: portainer
image: docker.io/portainer/portainer-ce
state: started
ports:
- "9000:9000"
volumes:
- "portainer_data:/data"
restart_policy: unless-stopped
healthcheck:
test: "curl -f http://localhost:9000 || exit 1"
interval: 5s
timeout: 3s
retries: 3
start_period: 30s
become: false
- name: Ensure Portainer container is running
containers.podman.podman_container:
name: portainer
state: started
become: false
- name: Allow Portainer UI port
ansible.posix.firewalld:
port: 9000/tcp
permanent: true
state: enabled
immediate: true
become: true
- name: Test Portainer UI accessibility
ansible.builtin.shell: curl -f http://localhost:9000
register: portainer_curl_test
changed_when: false
failed_when: portainer_curl_test.rc != 0
become: true # Run as root
tags:
- debug
- name: Display Portainer curl test result
debug:
var: portainer_curl_test.stdout
tags:
- debug