Commit b7b63b60 authored by Reto Gantenbein's avatar Reto Gantenbein

Re-group tasks and add Ansible tags

parent f04e18b3
......@@ -6,7 +6,6 @@
state: 'present'
delegate_to: '{{ ansible_local.mariadb.delegate_to }}'
register: roundcube__register_database_status
tags: [ 'role::roundcube:database' ]
- name: Import initial database schema
mysql_db:
......@@ -17,4 +16,3 @@
login_password: '{{ roundcube__database_map[roundcube__database].dbpass }}'
login_host: '{{ ansible_local.mariadb.server }}'
when: (roundcube__register_database_status|d() is defined and roundcube__register_database_status.changed)
tags: [ 'role::roundcube:database' ]
---
- name: Get version of current Roundcube installation
command: sed -n "s/^define('RCMAIL_VERSION', '\(.*\)');/\1/p" \
{{ roundcube__git_checkout }}/program/include/iniset.php
changed_when: False
failed_when: False
register: roundcube__register_version
# this task is necessary, to trigger proper database upgrades after
# updating the role to v0.2.0 because the default installation path
# has changed.
- name: Get version of deprecated Roundcube installation on role upgrade
command: sed -n "s/^define('RCMAIL_VERSION', '\(.*\)');/\1/p" \
/srv/www/roundcube/sites/{{
roundcube__domain if roundcube__domain is string
else roundcube__domain[0] }}/public/program/include/iniset.php
changed_when: False
failed_when: False
register: roundcube__register_version_old
when: (roundcube__register_version.stdout == '') and
(not roundcube__git_checkout == '/srv/www/roundcube/sites/'
+ (roundcube__domain if roundcube__domain is string
else roundcube__domain[0]) + '/public')
# ---- System Account ----
- name: Create Roundcube group
group:
name: '{{ roundcube__group }}'
system: True
state: 'present'
- name: Create Roundcube user
user:
name: '{{ roundcube__user }}'
group: '{{ roundcube__group }}'
home: '{{ roundcube__home }}'
shell: '{{ roundcube__shell }}'
comment: '{{ roundcube__comment }}'
system: True
state: 'present'
# ---- Deployment ----
......
......@@ -6,21 +6,30 @@
# ---- Environment ----
- name: Create Roundcube group
group:
name: '{{ roundcube__group }}'
system: True
state: 'present'
- name: Create Roundcube user
user:
name: '{{ roundcube__user }}'
group: '{{ roundcube__group }}'
home: '{{ roundcube__home }}'
shell: '{{ roundcube__shell }}'
comment: '{{ roundcube__comment }}'
system: True
state: 'present'
- name: Get version of current Roundcube installation
command: sed -n "s/^define('RCMAIL_VERSION', '\(.*\)');/\1/p" \
{{ roundcube__git_checkout }}/program/include/iniset.php
changed_when: False
failed_when: False
register: roundcube__register_version
tags: [ 'role::roundcube:database' ]
# this task is necessary, to trigger proper database upgrades after
# updating the role to v0.2.0 because the default installation path
# has changed.
- name: Get version of deprecated Roundcube installation on role upgrade
command: sed -n "s/^define('RCMAIL_VERSION', '\(.*\)');/\1/p" \
/srv/www/roundcube/sites/{{
roundcube__domain if roundcube__domain is string
else roundcube__domain[0] }}/public/program/include/iniset.php
changed_when: False
failed_when: False
register: roundcube__register_version_old
when: (roundcube__register_version.stdout == '') and
(not roundcube__git_checkout == '/srv/www/roundcube/sites/'
+ (roundcube__domain if roundcube__domain is string
else roundcube__domain[0]) + '/public')
tags: [ 'role::roundcube:database' ]
# ---- Deployment ----
......@@ -35,8 +44,10 @@
- '{{ roundcube__packages }}'
- '{{ roundcube__composer_packages
if not roundcube__composer_phar|bool else [] }}'
tags: [ 'role::roundcube:pkg' ]
- include: deploy_roundcube.yml
tags: [ 'role::roundcube:deployment' ]
# ---- Configuration ----
......@@ -49,9 +60,11 @@
group: '{{ roundcube__group }}'
mode: '0750'
when: roundcube__database_map[roundcube__database].dbtype == 'sqlite'
tags: [ 'role::roundcube:database' ]
- include: configure_mysql.yml
when: roundcube__database_map[roundcube__database].dbtype == 'mysql'
tags: [ 'role::roundcube:database' ]
- name: Configure Roundcube
template:
......@@ -60,6 +73,7 @@
owner: 'root'
group: '{{ roundcube__group }}'
mode: '0640'
tags: [ 'role::roundcube:config' ]
- name: Update database schema
command: 'php bin/updatedb.sh --package=roundcube --dir={{ roundcube__git_checkout }}/SQL'
......@@ -72,6 +86,7 @@
roundcube__git_version | version_compare(roundcube__register_version.stdout, '>')) or
(not roundcube__register_version_old | skipped and
not roundcube__register_version_old.stdout == '')
tags: [ 'role::roundcube:database' ]
- name: Post hooks
include: '{{ lookup("task_src", "roundcube/post_main.yml") }}'
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment