Initial commit
This commit is contained in:
commit
c330d87814
2 changed files with 74 additions and 0 deletions
13
defaults/main.yml
Normal file
13
defaults/main.yml
Normal file
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
hedy_base_url: "http://localhost:8080/"
|
||||
|
||||
hedy_user_username: hedy
|
||||
hedy_user_groupname: hedy
|
||||
hedy_base_path: /home/hedy
|
||||
hedy_data_path: /home/hedy/data
|
||||
hedy_docker_src_files_path: /home/hedy/docker-src
|
||||
|
||||
hedy_docker_image: hedy:latest
|
||||
hedy_container_image_self_build: true
|
||||
hedy_container_image_self_build_repo: https://github.com/hedyorg/hedy.git
|
||||
hedy_container_image_self_build_version: main
|
61
tasks/main.yml
Normal file
61
tasks/main.yml
Normal file
|
@ -0,0 +1,61 @@
|
|||
---
|
||||
- include_role: name=system_user
|
||||
vars:
|
||||
the_user: "{{ hedy_user_username }}"
|
||||
the_group: "{{ hedy_user_groupname }}"
|
||||
the_home: "{{ hedy_base_path }}"
|
||||
|
||||
- name: Ensure Hedy paths exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ item.path }}"
|
||||
state: directory
|
||||
mode: 0700
|
||||
owner: "{{ hedy_user_username }}"
|
||||
group: "{{ hedy_user_groupname }}"
|
||||
with_items:
|
||||
- {path: "{{ hedy_base_path }}", when: true}
|
||||
- {path: "{{ hedy_data_path }}", when: true}
|
||||
- {path: "{{ hedy_docker_src_files_path }}", when: "{{ hedy_container_image_self_build }}"}
|
||||
when: "item.when | bool"
|
||||
|
||||
- name: Ensure Hedy repository is present on self-build
|
||||
ansible.builtin.git:
|
||||
repo: "{{ hedy_container_image_self_build_repo }}"
|
||||
dest: "{{ hedy_docker_src_files_path }}"
|
||||
version: "{{ hedy_container_image_self_build_version }}"
|
||||
force: "yes"
|
||||
become: true
|
||||
become_user: "{{ hedy_user_username }}"
|
||||
register: hedy_git_pull_results
|
||||
when: "hedy_container_image_self_build | bool"
|
||||
|
||||
- command:
|
||||
cmd: "pybabel compile -f -d translations"
|
||||
chdir: "{{ hedy_docker_src_files_path }}"
|
||||
#when: "hedy_container_image_self_build | bool and hedy_git_pull_results.changed"
|
||||
|
||||
- name: Ensure Hedy Docker image is built
|
||||
community.docker.docker_image:
|
||||
name: "{{ hedy_docker_image }}"
|
||||
source: build
|
||||
force_source: "{{ hedy_git_pull_results.changed }}"
|
||||
build:
|
||||
dockerfile: Dockerfile
|
||||
path: "{{ hedy_docker_src_files_path }}"
|
||||
pull: true
|
||||
when: "hedy_container_image_self_build | bool"
|
||||
|
||||
- name: Hedy container running
|
||||
community.docker.docker_container:
|
||||
name: "hedy"
|
||||
image: "{{ hedy_docker_image }}"
|
||||
restart_policy: unless-stopped
|
||||
published_ports:
|
||||
- "8080:8080"
|
||||
volumes:
|
||||
#- "{{ hedy_data_path }}:/app"
|
||||
env:
|
||||
BASE_URL: "{{ hedy_base_url }}"
|
||||
# https://github.com/hedyorg/hedy/wiki/Hedy-Development-Process#environment-variables
|
||||
fix_for_weblate: "true"
|
||||
save_snippet_hashes: "true"
|
Loading…
Reference in a new issue