summaryrefslogtreecommitdiff
path: root/roles/bugzilla/tasks/main.yml
blob: eed703c6269ccf285954950e68016c81cf6128ca (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
---
- name: Install required packages
  apt: pkg={{item}} state=installed
  with_items: bugzilla_deps
  tags:
    - install
    - update

- name: Enable mod_perl
  command:  a2enmod {{ item }}
            creates=/etc/apache2/mods-enabled/{{ item }}.load
  with_items: apache_modules
  notify: restart-apache
  tags:
    - install

- name: Install CPAN requirements
  when: cpan_modules is defined
  apt: pkg={{item}} state=installed
  with_items:
  - cpanminus
  - gcc
  - make

- name: Install CPAN modules
  when: cpan_modules is defined
  with_items: cpan_modules
  cpanm: name={{item}}

- name: Checkout application code
  git: repo={{git_repo}}
       dest={{install_base}}/{{hostname}}
       version={{git_tag}}
       update=yes
  notify: restart-apache
  tags:
    - install
    - update

- name: Copy favicon.ico if enabled
  when: favicon is defined
  copy: src=files/{{favicon}} dest={{install_base}}/{{hostname}}/images/

# bugzilla overwrites localconfig, so we can't manage the file.
# we copy the file over, and overwrite "localconfig" when this changes and
# then run checksetup.pl
- name: Deploy initial localconfig
  register: localconfig
  template: src=localconfig
            dest={{install_base}}/{{hostname}}/localconfig.orig
            mode=0640 owner=root group=www-data

- name: localconfig hack
  when: localconfig.changed
  command: cp {{install_base}}/{{hostname}}/localconfig.orig {{install_base}}/{{hostname}}/localconfig

- name: Deploy answers file to populate localconfig
  register: answers_file
  template: src=answers.pl
            dest={{install_base}}/{{hostname}}/answers.pl
            mode=0600 owner=root group=www-data

- name: Run checksetup.pl to validate config
  when: answers_file.changed or localconfig.changed
  changed_when: false
  command: "{{install_base}}/{{hostname}}/checksetup.pl {{install_base}}/{{hostname}}/answers.pl"

- name: Setup data directory for next step
  file: path={{install_base}}/{{hostname}}/data
        state=directory owner=root group=www-data mode=0770

- name: Copy configuration
  template: src=templates/{{hostname}}-params.json
            dest={{install_base}}/{{hostname}}/data/params.json
            mode=0660 owner=root group=www-data

- name: Setup inbound email user
  user: name=bugs shell=/bin/bash group=www-data

- name: Setup inbound email
  template: src=templates/procmail.rc
            dest=/home/bugs/.procmailrc
            owner=bugs

- name: Setup custom templates if needed
  when: bugzilla_variables is defined
  file: path={{install_base}}/{{hostname}}/template/en/custom/global/
        state=directory owner=root group=www-data

- name: Setup customized bugzilla variables if defined
  when: bugzilla_variables is defined
  copy: src={{bugzilla_variables}}
        dest={{install_base}}/{{hostname}}/template/en/custom/global/variables.none.tmpl
        owner=root group=www-data