source: darkpeak-services/roles/trac/tasks/main.yml @ 30ef5ea3

ansiblekeycloakmatrixpleroma
Last change on this file since 30ef5ea3 was 30ef5ea3, checked in by Caolan McMahon <caolan.mcmahon@…>, 19 months ago

Move all passwords into prod-playbook.yml and encrypt with ansible vault

  • Property mode set to 100644
File size: 2.7 KB
Line 
1- name: Install dependencies for Trac
2  apt:
3    name: "{{ item }}"
4    state: present
5    update_cache: yes
6    cache_valid_time: 10800   # 3 hours
7  with_items:
8    - trac
9    - python-psycopg2
10    - libapache2-mod-wsgi
11
12- name: Enable wsgi apache module
13  apache2_module:
14    name: wsgi
15    state: present
16  notify:
17    - reload apache2
18
19# We are using apache to front the Trac WSGI application
20- name: Configure SAML2 authentication for Trac
21  include: ../../apache2/tasks/configure-apache-saml.yml
22- name: Configure Apache for Trac
23  include: ../../apache2/tasks/configure-apache-site.yml
24
25- name: Add group
26  group:
27    name: "{{ service_name }}"
28    system: yes
29
30- name: Add user
31  user:
32    name: "{{ service_name }}"
33    groups: "{{ service_name }}"
34    comment: "Account to run Trac service"
35    shell: /usr/sbin/nologin
36    home: "{{ data_dir }}"
37    system: yes
38    createhome: no
39
40- name: Add postgresql user
41  include: ../../community/geerlingguy.postgresql/tasks/users.yml
42
43- name: Add postgresql database
44  include: ../../community/geerlingguy.postgresql/tasks/databases.yml
45
46- name: Create the Trac environment directory
47  file:
48    state: directory
49    path:  "{{ data_dir }}"
50    owner: "{{ service_name }}"
51    group: "{{ service_name }}"
52    mode:  0755
53
54- name: Initialise a new Trac environment
55  command: "trac-admin {{ data_dir }} initenv 'Dark Peak' 'postgres://trac:{{ trac_postgresql_password }}@/trac?host=/var/run/postgresql'"
56  args:
57    creates: "{{ data_dir }}/VERSION"
58  become: true
59  become_user: "{{ service_name }}"
60
61- name: Grant admin powers to the admin user
62  command: "trac-admin {{ data_dir }} permission add admin TRAC_ADMIN"
63  become: true
64  become_user: "{{ service_name }}"
65
66- name: Grant powers to authenticated users
67  command: "trac-admin {{ data_dir }} permission add authenticated {{ item }}"
68  with_items:
69    - MILESTONE_ADMIN
70    - REPORT_ADMIN
71    - ROADMAP_ADMIN
72    - TICKET_ADMIN
73  become: true
74  become_user: "{{ service_name }}"
75
76- name: Install Trac configuration
77  template:
78    src: trac.ini.j2
79    dest: "{{ data_dir }}/conf/trac.ini"
80    owner: "{{ service_name }}"
81    group: "{{ service_name }}"
82    mode: 0600
83  notify:
84    - reload apache2
85
86- name: Create the web root directory
87  file:
88    state: directory
89    path:  "{{ web_root }}"
90    owner: "{{ service_name }}"
91    group: www-data
92    mode:  0750
93
94- name: Install custom Dark Peak branding
95  copy:
96    src: "{{ item }}"
97    dest: "{{ data_dir }}/htdocs/{{ item }}"
98    group: "{{ service_name }}"
99    owner: "{{ service_name }}"
100    mode: 0644
101  with_items:
102    - favicon.ico
103    - darkpeak-logo.png
104
105- name: Redeploy Trac environment
106  shell: "trac-admin {{ data_dir }} deploy {{ web_root }}"
107  become: true
108  become_user: "{{ service_name }}"
109  notify:
110    - reload apache2
111
Note: See TracBrowser for help on using the repository browser.