ansible-playbook-static-sit.../roles/static-server/tasks/install.yml

37 lines
1.1 KiB
YAML
Raw Normal View History

2023-11-10 13:21:47 +00:00
---
2023-11-10 13:47:57 +00:00
- name: Ensure static network is created in Docker
community.docker.docker_network:
name: "{{ static_container_network }}"
driver: bridge
- name: Ensure SWS path exists
ansible.builtin.file:
path: "{{ item.path }}"
state: directory
2023-11-15 10:45:28 +00:00
mode: 0755
2023-11-10 13:47:57 +00:00
with_items:
- {path: "{{ static_site_server_base_path }}", when: true}
- name: Ensure docker-compose file is installed
ansible.builtin.template:
2023-11-10 14:00:16 +00:00
src: "{{ role_path }}/templates/docker-compose.yml.j2"
2023-11-10 13:47:57 +00:00
dest: "{{ static_site_server_base_path }}/docker-compose.yml"
mode: 0640
- name: Ensure SWS container image is pulled
community.docker.docker_image:
2023-11-10 14:00:16 +00:00
name: "{{ sws_container_image }}"
2023-11-10 13:47:57 +00:00
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
- name: Ensure Static Sites are setup
2023-11-10 13:21:47 +00:00
ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_site.yml"
with_items: "{{ static_sites }}"
loop_control:
loop_var: site
2023-11-10 13:47:57 +00:00
no_log: true
- name: Start from docker compose file
community.general.docker_compose:
project_src: "{{ static_site_server_base_path }}/"