playbooks/echo.yml

27 lines
737 B
YAML
Raw Normal View History

2025-09-01 15:13:47 +03:30
- name: Pull and run private GHCR image
hosts: all
become: true
tasks:
- name: Ensure community.docker collection is installed
ansible.builtin.ansible_galaxy_collection:
name: community.docker
- name: Log in to GitHub Container Registry
community.docker.docker_login:
registry_url: ghcr.io
username: "{{ ghcr_username }}"
password: "{{ ghcr_token }}"
- name: Pull image from GHCR
community.docker.docker_image:
name: "{{ image_name }}"
source: pull
- name: Run container from image
community.docker.docker_container:
name: echo
image: "{{ image_name }}"
restart_policy: always
ports:
- "3000:3000"