diff options
Diffstat (limited to 'roles/services/containers/freshrss')
-rw-r--r-- | roles/services/containers/freshrss/handlers/main.yml | 4 | ||||
-rw-r--r-- | roles/services/containers/freshrss/tasks/main.yml | 101 |
2 files changed, 105 insertions, 0 deletions
diff --git a/roles/services/containers/freshrss/handlers/main.yml b/roles/services/containers/freshrss/handlers/main.yml new file mode 100644 index 0000000..5463835 --- /dev/null +++ b/roles/services/containers/freshrss/handlers/main.yml | |||
@@ -0,0 +1,4 @@ | |||
1 | - name: restart nginx | ||
2 | service: | ||
3 | name: nginx | ||
4 | state: restarted | ||
diff --git a/roles/services/containers/freshrss/tasks/main.yml b/roles/services/containers/freshrss/tasks/main.yml new file mode 100644 index 0000000..26109b3 --- /dev/null +++ b/roles/services/containers/freshrss/tasks/main.yml | |||
@@ -0,0 +1,101 @@ | |||
1 | - name: set image fact | ||
2 | set_fact: | ||
3 | image: freshrss/freshrss:1.21.0 | ||
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 freshrss directory | ||
13 | file: | ||
14 | path: "{{ docker_home }}/freshrss" | ||
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: get freshrss image | ||
32 | become: yes | ||
33 | become_user: "{{ docker_username }}" | ||
34 | environment: | ||
35 | XDG_RUNTIME_DIR: "/run/user/{{ docker_uid }}" | ||
36 | docker_image: | ||
37 | name: "{{ image }}" | ||
38 | repository: "{{ custom_registry }}/{{ repo_tag }}" | ||
39 | push: yes | ||
40 | docker_host: "unix://run/user/{{ docker_uid }}/docker.sock" | ||
41 | source: pull | ||
42 | force_source: yes | ||
43 | |||
44 | - name: create freshrss data directory | ||
45 | file: | ||
46 | path: "{{ docker_home }}/freshrss/data" | ||
47 | state: directory | ||
48 | owner: "{{ docker_username }}" | ||
49 | group: "{{ docker_username }}" | ||
50 | mode: '0755' | ||
51 | |||
52 | - name: create freshrss docker network | ||
53 | docker_network: | ||
54 | name: "{{ freshrss_network_name }}" | ||
55 | docker_host: "unix://run/user/{{ docker_uid }}/docker.sock" | ||
56 | driver: bridge | ||
57 | ipam_config: | ||
58 | - subnet: "{{ freshrss_subnet }}" | ||
59 | gateway: "{{ freshrss_gateway }}" | ||
60 | |||
61 | - name: create and deploy freshrss container | ||
62 | become: yes | ||
63 | become_user: "{{ docker_username }}" | ||
64 | environment: | ||
65 | XDG_RUNTIME_DIR: "/run/user/{{ docker_uid }}" | ||
66 | docker_container: | ||
67 | name: "freshrss" | ||
68 | hostname: "freshrss" | ||
69 | image: "{{ custom_registry }}/{{ repo_tag }}" | ||
70 | docker_host: "unix://run/user/{{ docker_uid }}/docker.sock" | ||
71 | purge_networks: yes | ||
72 | networks: | ||
73 | - name: "{{ freshrss_network_name }}" | ||
74 | ipv4_address: "{{ freshrss_ipv4 }}" | ||
75 | ports: | ||
76 | - "127.0.0.1:8090:80" | ||
77 | state: 'started' | ||
78 | recreate: yes | ||
79 | restart_policy: unless-stopped | ||
80 | volumes: | ||
81 | - "{{ docker_home }}/freshrss/data:/var/www/FreshRSS/data" | ||
82 | env: | ||
83 | "CRON_MIN": "0,15,30,45" | ||
84 | |||
85 | - name: deploy nginx configuration | ||
86 | notify: restart nginx | ||
87 | register: nginx_config | ||
88 | copy: | ||
89 | src: "{{ freshrss_nginx_config }}" | ||
90 | dest: /etc/nginx/sites-available/freshrss.conf | ||
91 | owner: root | ||
92 | group: root | ||
93 | mode: '0644' | ||
94 | |||
95 | - name: symlink site | ||
96 | file: | ||
97 | src: /etc/nginx/sites-available/freshrss.conf | ||
98 | dest: /etc/nginx/sites-enabled/freshrss.conf | ||
99 | owner: root | ||
100 | group: root | ||
101 | state: link | ||