summaryrefslogtreecommitdiffstats
path: root/roles/webmail/tasks/roundcube.yml
blob: 4699bdc82729925d44b5a4b54807c268f5d7a4a3 (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 PHP
  apt: pkg={{ item }}
  with_items:
    - php5-fpm
    - php5-ldap
    - php5-gd
    - php5-pspell

- name: Install Roundcube
  apt: pkg={{ item }} default_release={{ ansible_lsb.codename }}-backports
  with_items:
    - roundcube-core
    - roundcube-mysql
    - roundcube-plugins

- name: Copy fripost's logo
  copy: src=var/lib/roundcube/skins/logo_webmail.png
        dest=/var/lib/roundcube/skins/logo_webmail.png
        owner=root group=root
        mode=0644

- name: Configure Roundcube
  lineinfile: dest=/etc/roundcube/main.inc.php
              "regexp=^\\s*\\$rcmail_config\\['{{ item.var }}'\\]\\s*="
              "line=$rcmail_config['{{ item.var }}'] = {{ item.value }};"
              owner=root group=www-data
              mode=0640
  with_items:
    # Logging/Debugging
    - { var: smtp_log,               value: "FALSE" }
    # IMAP
    - { var: default_host,           value: "'localhost'" }
    - { var: imap_auth_type,         value: "'plain'"     }
    - { var: imap_cache,             value: "null"        }
    - { var: messages_cache,         value: "FALSE"       }
    # SMTP
    - { var: smtp_server,            value: "'localhost'" }
    - { var: smtp_port,              value: "2580"        }
    # System
    - { var: force_https,            value: "TRUE"                     }
    - { var: login_autocomplete,     value: "2"                        }
    - { var: skin_logo,              value: "'skins/logo_webmail.png'" }
    - { var: username_domain,        value: "'fripost.org'"            }
    - { var: product_name,           value: "'Fripost'"                }
    # Plugins
    - { var: plugins,                value: "array('additional_message_headers','managesieve','password')" }
    # User Interface
    - { var: skin,                   value: "'classic'" }
    - { var: language,               value: "'sv_SE'"   }
    - { var: create_default_folders, value: "TRUE"      }
    # User Preferences
    - { var: htmleditor,             value: "TRUE"  }
    - { var: skip_deleted,           value: "TRUE"  }
    - { var: check_all_folders,      value: "FALSE" }

- name: Make the logo a hyperlink to the website
  lineinfile: dest=/usr/share/roundcube/skins/{{ item }}/templates/login.html
              regexp='^(<roundcube:object name="logo" src="/images/roundcube_logo.png"[^>]* />)$'
              line='<a href="https://fripost.org">\1</a>'
              backrefs=yes
              owner=root group=root
              mode=0644
  with_items:
    - classic
    - larry

- name: Configure Roundcube plugins
  template: src=usr/share/roundcube/plugins/{{ item }}/config.inc.php.j2
            dest=/usr/share/roundcube/plugins/{{ item }}/config.inc.php
            owner=root group=root
            mode=0644
  with_items:
    - additional_message_headers
    - managesieve
    - password

- name: Start php5-fpm
  service: name=php5-fpm state=started

- name: Copy /etc/nginx/sites-available/roundcube
  copy: src=etc/nginx/sites-available/roundcube
        dest=/etc/nginx/sites-available/roundcube
        owner=root group=root
        mode=0644
  notify:
    - Restart Nginx

- name: Create /etc/nginx/sites-enabled/roundcube
  file: src=../sites-available/roundcube
        dest=/etc/nginx/sites-enabled/roundcube
        owner=root group=root
        state=link force=yes
  notify:
    - Restart Nginx

- meta: flush_handlers