diff options
author | Sam Chudnick <sam@chudnick.com> | 2023-06-25 09:52:36 -0400 |
---|---|---|
committer | Sam Chudnick <sam@chudnick.com> | 2023-06-25 09:52:36 -0400 |
commit | 95b73daa36b23565a8566f71f9b202d3459b685f (patch) | |
tree | cb17b021be70e7868d0ec235a761f0ecdc80f3f2 /roles/services/containers/renovate |
Diffstat (limited to 'roles/services/containers/renovate')
-rw-r--r-- | roles/services/containers/renovate/tasks/main.yml | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/roles/services/containers/renovate/tasks/main.yml b/roles/services/containers/renovate/tasks/main.yml new file mode 100644 index 0000000..bbbfe11 --- /dev/null +++ b/roles/services/containers/renovate/tasks/main.yml | |||
@@ -0,0 +1,87 @@ | |||
1 | - name: set image fact | ||
2 | set_fact: | ||
3 | image: renovate/renovate:35.141.3-slim | ||
4 | |||
5 | - name: set other facts | ||
6 | vars: | ||
7 | array: "{{ image.split('/', 1) }}" | ||
8 | set_fact: | ||
9 | repo_tag: "{{ array.1 }}" | ||
10 | custom_registry: "{{ docker_registry_url + '/' + docker_registry_username }}" | ||
11 | |||
12 | - name: create renovate directory | ||
13 | file: | ||
14 | path: "{{ docker_home }}/renovate" | ||
15 | state: directory | ||
16 | owner: "{{ docker_username }}" | ||
17 | group: "{{ docker_username }}" | ||
18 | mode: '0755' | ||
19 | |||
20 | - name: login to docker registry | ||
21 | become: yes | ||
22 | become_user: "{{ docker_username }}" | ||
23 | environment: | ||
24 | XDG_RUNTIME_DIR: "/run/user/{{ docker_uid }}" | ||
25 | docker_login: | ||
26 | docker_host: "unix://run/user/{{ docker_uid }}/docker.sock" | ||
27 | registry_url: "{{ docker_registry_url }}" | ||
28 | username: "{{ docker_registry_username }}" | ||
29 | password: "{{ docker_registry_password }}" | ||
30 | |||
31 | - name: create renovate docker network | ||
32 | become: yes | ||
33 | become_user: "{{ docker_username }}" | ||
34 | docker_network: | ||
35 | name: "{{ renovate_network_name }}" | ||
36 | docker_host: "unix://run/user/{{ docker_uid }}/docker.sock" | ||
37 | driver: bridge | ||
38 | ipam_config: | ||
39 | - subnet: "{{ renovate_subnet }}" | ||
40 | gateway: "{{ renovate_gateway }}" | ||
41 | |||
42 | - name: pull and push renovate image | ||
43 | become: yes | ||
44 | become_user: "{{ docker_username }}" | ||
45 | environment: | ||
46 | XDG_RUNTIME_DIR: "/run/user/{{ docker_uid }}" | ||
47 | docker_image: | ||
48 | name: "{{ image }}" | ||
49 | repository: "{{ custom_registry }}/{{ repo_tag }}" | ||
50 | docker_host: "unix://run/user/{{ docker_uid }}/docker.sock" | ||
51 | source: pull | ||
52 | force_source: yes | ||
53 | push: yes | ||
54 | |||
55 | - name: create and deploy renovate container | ||
56 | become: yes | ||
57 | become_user: "{{ docker_username }}" | ||
58 | environment: | ||
59 | XDG_RUNTIME_DIR: "/run/user/{{ docker_uid }}" | ||
60 | docker_container: | ||
61 | name: "renovate" | ||
62 | image: "{{ custom_registry }}/{{ repo_tag }}" | ||
63 | pull: yes | ||
64 | recreate: yes | ||
65 | docker_host: "unix://run/user/{{ docker_uid }}/docker.sock" | ||
66 | purge_networks: yes | ||
67 | networks: | ||
68 | - name: "{{ renovate_network_name }}" | ||
69 | ipv4_address: "{{ renovate_ipv4 }}" | ||
70 | env: | ||
71 | "RENOVATE_ENDPOINT": "{{ renovate_endpoint }}" | ||
72 | "RENOVATE_PLATFORM": "gitea" | ||
73 | "RENOVATE_TOKEN": "{{ renovate_token }}" | ||
74 | "RENOVATE_AUTODISCOVER": "true" | ||
75 | "LOG_LEVEL": "debug" | ||
76 | "RENOVATE_GIT_AUTHOR": "{{ renovate_author }}" | ||
77 | restart_policy: "no" | ||
78 | state: 'started' | ||
79 | |||
80 | |||
81 | - name: create cron job to run renovate container daily | ||
82 | cron: | ||
83 | name: "run renovate" | ||
84 | job: "docker start renovate" | ||
85 | user: "{{ docker_username }}" | ||
86 | minute: "0" | ||
87 | hour: "6" | ||