Add simple ci deployment
This commit is contained in:
parent
3ee003f94c
commit
06bb34891e
6 changed files with 162 additions and 0 deletions
|
|
@ -23,6 +23,14 @@
|
|||
become: yes
|
||||
listen: "update gitea upstream"
|
||||
|
||||
- name: Update ci upstream template
|
||||
ansible.builtin.template:
|
||||
src: upstream_ci.json.j2
|
||||
dest: "{{ gitea_upstream_file_dir }}/upstream_ci.json"
|
||||
mode: '0600'
|
||||
become: yes
|
||||
listen: "update gitea upstream"
|
||||
|
||||
# figure out if upstream id exists
|
||||
- name: check {{ stack_name }} upstream
|
||||
community.docker.docker_container_exec:
|
||||
|
|
@ -53,6 +61,36 @@
|
|||
become: yes
|
||||
listen: "update gitea upstream"
|
||||
|
||||
# figure out if upstream id exists
|
||||
- name: check {{ stack_name }}_ci upstream
|
||||
community.docker.docker_container_exec:
|
||||
container: "{{ caddy_container_id }}"
|
||||
command: >
|
||||
curl localhost:2019/id/{{ stack_name }}_ci_upstream/
|
||||
changed_when: False
|
||||
register: result
|
||||
become: yes
|
||||
listen: "update gitea upstream"
|
||||
|
||||
# upstream for ci already exists, patch it
|
||||
- name: remove old {{ stack_name }}_ci upstream
|
||||
community.docker.docker_container_exec:
|
||||
container: "{{ caddy_container_id }}"
|
||||
command: >
|
||||
curl -X DELETE localhost:2019/id/{{ stack_name }}_ci_upstream/
|
||||
become: yes
|
||||
when: (result.stdout | from_json)['error'] is not defined
|
||||
listen: "update gitea upstream"
|
||||
#
|
||||
# upstream for ci has to be created
|
||||
- name: add {{ stack_name }}_ci upstream
|
||||
community.docker.docker_container_exec:
|
||||
container: "{{ caddy_container_id }}"
|
||||
command: >
|
||||
curl -X POST -H "Content-Type: application/json" -d @{{ gitea_upstream_file_dir }}/upstream_ci.json localhost:2019/config/apps/http/servers/{{ (gitea_use_https == True) | ternary(caddy_https_server_name, caddy_http_server_name) }}/routes/0/
|
||||
become: yes
|
||||
listen: "update gitea upstream"
|
||||
|
||||
- name: Ensure upstream directory is gone again
|
||||
ansible.builtin.file:
|
||||
path: "{{ gitea_upstream_file_dir }}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue