Files
demolamp/roles/demolamp/tasks/main.yml

46 lines
1.0 KiB
YAML

---
- name: show remote host
debug:
msg: "the remote server is {{ ansible_host }}"
- name: create build dir if not exists
file:
path: "{{ build_root_abspath }}"
state: directory
- name: git clone
git:
repo: "https://pvggitea.duckdns.org/GiteaTeam/demolamp.git"
dest: "{{ build_root_abspath }}"
remote: "origin"
version: "main"
- name: Undeploy the demolamp
community.docker.docker_container:
name: "demolamp"
state: absent
- name: Remove the docker image for demolamp if exists
community.docker.docker_image:
name: "demolamp"
tag: "{{ demobackend_version }}"
state: absent
- name: Build demolamp image
community.docker.docker_image:
name: demolamp
source: build
build:
path: "{{ build_root_abspath }}"
pull: false
tag: "{{ demobackend_version }}"
- name: run docker
community.docker.docker_container:
name: demolamp
state: started
recreate: yes
image: "demolamp:{{ demobackend_version }}"
ports:
- "80:80"