44 lines
1.1 KiB
YAML
44 lines
1.1 KiB
YAML
---
|
|
- name: Log in to private Docker registry
|
|
community.docker.docker_login:
|
|
registry: "{{ registry }}"
|
|
username: "{{ username }}"
|
|
password: "{{ password }}"
|
|
|
|
- name: Pull Hops n Grains image
|
|
community.docker.docker_image:
|
|
name: "{{ image_name }}"
|
|
source: pull
|
|
state: present
|
|
force_source: true
|
|
|
|
- name: Ensure Host Directory exists
|
|
ansible.builtin.file:
|
|
path: "{{ host_data_path }}"
|
|
state: directory
|
|
mode: "0755"
|
|
|
|
- name: Ensure PocketBase data directory exists
|
|
ansible.builtin.file:
|
|
path: "{{ host_data_path }}/pb_data"
|
|
state: directory
|
|
mode: "0755"
|
|
|
|
- name: Upload the .env file
|
|
ansible.builtin.template:
|
|
src: "files/.env"
|
|
dest: "{{ host_data_path }}/.env"
|
|
mode: "0600"
|
|
|
|
- name: Create and run Hops n Grains container
|
|
community.docker.docker_container:
|
|
name: "{{ container_name }}"
|
|
image: "{{ image_name }}"
|
|
state: started
|
|
restart_policy: "unless-stopped"
|
|
env_file: "{{ host_data_path }}/.env"
|
|
volumes:
|
|
- "{{ host_data_path }}/pb_data:/app/pb_data"
|
|
networks:
|
|
- name: "{{ docker_network }}"
|