forked from cloin/eda-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.yml
45 lines (41 loc) · 1.43 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
---
- name: Deploy appication
hosts: appnodes
gather_facts: false
become: true
vars:
# red, green, blue, ansiblue, pink, darkblue
color: "green"
# these vars are populated based on gitea eavents
# if the incoming git event is that of a pull request,
# set the port to 8081 to simulate deployment in dev
host_port: "{{ '8081' if event.etype == 'pull_request' else '8080'}}"
# app runs on 8080 so don't change unless app.py modified and image pushed
container_port: 8080
# if the incoming git event is that of a pull request,
# set the name of the container to reflect a dev deployment
container_name: "{{ 'colors-dev' if event.etype == 'pull_request' else 'colors' }}"
repo_pusher: "{{ event.eauthor }}"
repo_ref: "{{ event.eref }}"
tasks:
- name: Podman install
ansible.builtin.package:
name: podman
state: present
- name: Create a color container
containers.podman.podman_container:
name: "{{ container_name }}"
image: quay.io/acme_corp/eda-app:suncavanaugh
state: started
recreate: true
network: bridge
ports:
- "{{ host_port }}:{{ container_port }}"
env:
APP_COLOR: "{{ color }}"
PUSHER: "{{ repo_pusher }}"
GITREF: "{{ repo_ref }}"
register: container
- name: Print container
debug:
var: container