Files
git/playbooks/slow.yml
2025-12-22 10:14:58 -05:00

85 lines
2.5 KiB
YAML

- name: Make build artifact.
hosts: localhost
vars_files: ../config/ansible.secret.json
gather_facts: false
vars:
image_name: "service/gitea"
tasks:
- name: Build image.
community.docker.docker_image_build:
name: "{{ image_name }}"
path: ../gitea
nocache: true
rebuild: always
pull: true
- name: Create build directory.
ansible.builtin.file:
path: ../dist
state: directory
mode: '0777'
- name: Push image to archive.
community.docker.docker_image:
name: "{{ image_name }}"
archive_path: ../dist/image.tar
source: local
- name: Compress archive to artifact.
register: compress_image
community.general.archive:
path: ../dist/image.tar
dest: ../dist/image.tar.gz
format: gz
mode: "0644"
- name: Deploy artifact to instance.
hosts: compute
gather_facts: false
tasks:
- name: Create data directory.
ansible.builtin.file:
path: "{{ item }}"
state: directory
mode: '0777'
loop:
- ~/app
- ~/app/gitea
- name: Pull image to remote.
ansible.posix.synchronize:
src: ../dist/image.tar.gz
dest: ~/app/gitea/image.tar.gz
- name: Load image.
containers.podman.podman_load:
path: ~/app/gitea/image.tar.gz
register: image
# - name: Run image.
# community.docker.docker_container:
# name: server
# image: "{{ image.image_names[0] }}"
# state: started
# recreate: true
# restart_policy: unless-stopped
# memory: 425m
# memory_swap: 900m
# ports: [80:80, 2222:2222, 443:443, "22:22"]
# env:
# GITEA__security__INTERNAL_TOKEN: "{{ internal_secret }}"
# GITEA__server__LFS_JWT_SECRET: "{{ lfs_secret }}"
# GITEA__oauth2__JWT_SECRET: "{{ jwt_secret }}"
# GITEA__server__ACME_EMAIL: "{{ email }}"
# GITEA__server__SSH_DOMAIN: "{{ full_domain.value }}"
# GITEA__server__DOMAIN: "{{ full_domain.value }}"
# GITEA__server__ROOT_URL: "https://{{ full_domain.value }}/"
# GITEA__storage__MINIO_ACCESS_KEY_ID: "{{ minio_access_key }}"
# GITEA__storage__MINIO_SECRET_ACCESS_KEY: "{{ minio_secret_key }}"
# labels:
# docker-volume-backup.stop-during-backup: "true"
# volumes:
# - /home/ssm-user/data:/var/lib/gitea
# - /etc/timezone:/etc/timezone:ro
# - /etc/localtime:/etc/localtime:ro