This repository has been archived on 2023-04-26. You can view files and clone it, but cannot push or open issues or pull requests.
max/roles/blog/tasks/main.yml

34 lines
984 B
YAML

- name: Create service directory
file:
path: "{{ service_dir }}"
state: directory
- name: Clone git repo
git:
repo: "{{ git_origin }}"
dest: "{{ service_dir }}/git"
register: repo
- name: Add open permissions for git repo
file:
path: "{{ service_dir }}/git"
state: directory
mode: 0757
- name: Generate static files
command:
cmd: "docker run --rm --volume=\"{{ service_dir }}/git:/srv/jekyll:Z\" -it jekyll/minimal jekyll build"
chdir: "{{ service_dir }}"
when: repo.changed
- name: Copy docker compose file
template:
src: "{{ role_path }}/templates/docker-compose.yml.j2"
dest: "{{ service_dir }}/docker-compose.yml"
- name: Copy nginx config
copy:
src: "{{ role_path }}/files/nginx.conf"
dest: "{{ service_dir }}/nginx.conf"
register: nginx_conf
- name: Start docker compose
docker_compose:
project_src: "{{ service_dir }}"
pull: true
remove_orphans: true
restarted: "{{ nginx_conf.changed }}"