aboutsummaryrefslogtreecommitdiffstats
path: root/roles/ttrss/tasks/main.yml
blob: 13cd9b06c0d7c586c0fb55234aaf0e446e65bdd0 (plain)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
- name: install packages
  dnf:
    name: '{{ ttrss_packages }}'
    state: present

- name: create webroot
  file:
    path: '{{ ttrss_home }}'
    state: directory

- name: clone git repository
  git:
    repo: '{{ ttrss_git_repo }}'
    dest: '{{ ttrss_home }}'
    version: '{{ ttrss_version }}'
    update: yes

- name: set httpd_sys_rw_content_t selinux context for writable directories
  sefcontext:
    target: '{{ ttrss_home }}/{{ item }}(/.*)?'
    setype: httpd_sys_rw_content_t
    state: present
  loop: '{{ ttrss_writable_dirs }}'
  register: ttrss_writeable_sefcontext

- name: apply selinux context to writeable directories
  command: 'restorecon -R {{ ttrss_home }}/{{ item }}'
  when: ttrss_writeable_sefcontext.results[index].changed
  loop: '{{ ttrss_writable_dirs }}'
  loop_control:
    index_var: index

- name: set permissions on writable directories
  file:
    path: '{{ ttrss_home }}/{{ item }}'
    mode: 0775
    owner: root
    group: apache
    setype: httpd_sys_rw_content_t
  loop: '{{ ttrss_writable_dirs }}'

- import_tasks: freeipa.yml
  tags: freeipa

- name: create auth_freeipa plugin directory
  file:
    path: '{{ ttrss_home }}/plugins.local/auth_freeipa'
    state: directory

- name: download auth_freeipa plugin
  get_url:
    url: '{{ ttrss_freeipa_plugin_url }}'
    dest: '{{ ttrss_home }}/plugins.local/auth_freeipa/init.php'

- name: generate config file
  template:
    src: '{{ ttrss_home[1:] }}/config.php.j2'
    dest: '{{ ttrss_home }}/config.php'

- import_tasks: database.yml
  tags: database

- name: generate systemd unit for updating feeds
  template:
    src: etc/systemd/system/ttrss.service.j2
    dest: /etc/systemd/system/ttrss.service
  register: ttrss_unit

- name: reload systemd units
  systemd:
    name: ttrss
    state: restarted
    daemon_reload: yes
  when: ttrss_unit.changed

- name: start background feed updates
  systemd:
    name: ttrss
    enabled: yes
    state: started

- name: generate update script
  template:
    src: 'usr/local/sbin/ttrss-update.sh.j2'
    dest: '/usr/local/sbin/ttrss-update.sh'
    mode: 0555

- name: create ttrss-update timer
  include_role:
    name: systemd_timer
  vars:
    timer_name: ttrss-update
    timer_description: Update ttrss
    timer_after: network.target
    timer_on_calendar: '{{ ttrss_update_on_calendar }}'
    timer_exec: /usr/local/sbin/ttrss-update.sh