roundcube: First draft of role

This commit is contained in:
Timo Makinen 2023-02-04 18:17:42 +00:00
parent 9a988bf637
commit 42cb1c86c9
7 changed files with 118 additions and 0 deletions

View file

@ -0,0 +1,2 @@
---
roundcube_version: latest

View file

@ -0,0 +1,6 @@
---
- name: Restart roundcube
ansible.builtin.systemd:
name: roundcube-container
daemon_reload: true
state: restarted

View file

@ -0,0 +1,3 @@
---
dependencies:
- {role: podman}

View file

@ -0,0 +1,72 @@
---
- name: Create group
ansible.builtin.group:
name: roundcube
- name: Create user
ansible.builtin.user:
name: roundcube
comment: Podman Roundcube
group: roundcube
shell: /sbin/nologin
- name: Copy host key
ansible.builtin.copy:
dest: "{{ tls_private }}/roundcube.key"
src: "{{ tls_private }}/{{ inventory_hostname }}.key"
mode: 0640
owner: root
group: roundcube
remote_src: true
- name: Create config directory
ansible.builtin.file:
path: /etc/roundcube
state: directory
mode: 0755
owner: root
group: "{{ ansible_wheel }}"
- name: Create local configuration
ansible.builtin.template:
dest: /etc/roundcube/local.php
src: local.php.j2
mode: 0644
owner: root
group: "{{ ansible_wheel }}"
- name: Create service config
ansible.builtin.template:
dest: /etc/sysconfig/roundcube-container
src: roundcube-container.sysconfig.j2
mode: 0600
owner: root
group: "{{ ansible_wheel }}"
notify: Restart roundcube
- name: Create service file
ansible.builtin.template:
dest: /etc/systemd/system/roundcube-container.service
src: roundcube-container.service.j2
mode: 0644
owner: root
group: "{{ ansible_wheel }}"
notify: Restart roundcube
- name: Enable service
ansible.builtin.service:
name: roundcube-container
state: started
enabled: true
- name: Copy nginx config
ansible.builtin.copy:
dest: /etc/nginx/conf.d/{{ inventory_hostname }}/roundcube-container.conf
content: |
location /roundcube/ {
proxy_pass http://localhost:8004/;
}
mode: 0644
owner: root
group: "{{ ansible_wheel }}"
notify: Restart nginx

View file

@ -0,0 +1,6 @@
<?php
$config["domain"] = "{{ mail_domain }}";
$config["product_name"] = "foo.sh - Webmail";
?>

View file

@ -0,0 +1,18 @@
[Unit]
Description=Roundcube Container
Wants=network-online.target
After=network-online.target
[Service]
User=roundcube
EnvironmentFile=/etc/sysconfig/roundcube-container
ExecStart=/usr/bin/podman run \
--rm -p 127.0.0.1:8004:80 \
--name roundcube \
--volume=/etc/roundcube:/var/roundcube/config:ro \
--env=ROUNDCUBEMAIL_* docker.io/roundcube/roundcubemail:{{ roundcube_version }}-apache
ExecStop=/usr/bin/podman stop --ignore roundcube
ExecStopPost=/usr/bin/podman rm -f --ignore roundcube
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,11 @@
ROUNDCUBEMAIL_DEFAULT_HOST=ssl://{{ mail_server }}
ROUNDCUBEMAIL_DEFAULT_PORT=993
ROUNDCUBEMAIL_SMTP_SERVER=tls://{{ mail_server }}
ROUNDCUBEMAIL_SMTP_PORT=587
#ROUNDCUBEMAIL_DB_TYPE=mysql
#ROUNDCUBEMAIL_DB_HOST=sqldb02.home.foo.sh
#ROUNDCUBEMAIL_DB_PORT=3306
#ROUNDCUBEMAIL_DB_USER=roundcube
#ROUNDCUBEMAIL_DB_PASSWORD="{{ roundcube_mysql_pass }}"
#ROUNDCUBEMAIL_DB_NAME=roundcube