Skip to content

Commit

Permalink
Merge branch 'ypid-release/v0.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
drybjed committed Sep 19, 2016
2 parents 93b5438 + 72af6ad commit 0a2a9fa
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 66 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ before_install: True
install: True

script:
- 'make --makefile docs/_tests/Makefile check'
- 'git clone --depth 1 https://github.com/nickjj/rolespec'
- 'cd rolespec ; bin/rolespec -r https://github.com/debops/test-suite'

Expand Down
27 changes: 24 additions & 3 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@ new release.
`debops.owncloud master`_ - unreleased
--------------------------------------

.. _debops.owncloud master: https://github.com/debops/ansible-owncloud/compare/v0.2.0...master
.. _debops.owncloud master: https://github.com/debops/ansible-owncloud/compare/v0.3.0...master


`debops.owncloud v0.3.0`_ - 2016-09-17
--------------------------------------

.. _debops.owncloud v0.3.0: https://github.com/debops/ansible-owncloud/compare/v0.2.0...v0.3.0

Added
~~~~~
Expand Down Expand Up @@ -170,10 +176,18 @@ Changed
"from" account is changed from ``owncloud__subdomain`` variable to
``noreply`` string. [drybjed_]

- Use a static filename of the ``nginx`` server configuration file. This might
require manual removal of the old ``nginx`` server configuration file on
- Use a static filename of the :program:`nginx` server configuration file. This might
require manual removal of the old :program:`nginx` server configuration file on
existing installations. [drybjed_]

- Support to use a Redis password as configured by debops.redis_
v0.2.0 automatically. [ypid_]

Deprecated
~~~~~~~~~~

- Deprecated ownCloud 8.0 support which is End of Life as of 8.0.15 (2016-09-20). [ypid_]

Removed
~~~~~~~

Expand Down Expand Up @@ -201,6 +215,8 @@ Removed
If you need support for one of them and can get it to work we will be happy
about your contribution! [ypid_]

- Drop ownCloud 7.0 support which is End of Life as of 7.0.15 (2016-05-12). [ypid_]

Fixed
~~~~~

Expand All @@ -213,6 +229,11 @@ Fixed
Fixes security warnings which occurred with the latest version of
debops.nginx_ about duplicated security headers. [ypid_]

- Fix error when strings handed over to :command:`occ maintenance:install` start with a hyphen.
This only affected the initial setup and the role would have failed previously.
If the role worked for you, then you where not affected by this bug
(occurrence of this bug was random based on the generated passwords). [ypid_]


`debops.owncloud v0.2.0`_ - 2015-11-12
--------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions UPGRADE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ to your setup in order to use a new role release. Refer to the

.. _owncloud__ref_upgrade_nodes_v0.3.0:

Upgrade from v0.2.0 to unreleased
---------------------------------
Upgrade from v0.2.0 to v0.3.0
-----------------------------

All inventory variables have been renamed so you might need to update your
inventory.
Expand Down
55 changes: 31 additions & 24 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ owncloud__base_packages:
#
# List of base PHP packages required by ownCloud.
owncloud__base_php_packages:
- 'apcu'
- '{{ [ "apcu" ] if (owncloud__apcu_enabled|bool) else [] }}'
- '{{ [ "mysql" ] if (owncloud__database in [ "mariadb", "mysql" ]) else [] }}'
- '{{ [ "pgsql" ] if (owncloud__database in [ "postgresql" ]) else [] }}'
- '{{ [ "redis" ] if (owncloud__redis_enabled | bool) else [] }}'
Expand Down Expand Up @@ -244,7 +244,6 @@ owncloud__variant: 'owncloud'
#
# Supported releases:
#
# * ownCloud ``8.0``
# * ownCloud ``8.1``
# * ownCloud ``8.2``
# * ownCloud ``9.0`` (main supported version and used in production by the role maintainers)
Expand Down Expand Up @@ -370,29 +369,43 @@ owncloud__apcu_enabled: True

# .. envvar:: owncloud__redis_enabled
#
# Use Redis for file locking as recommended for small and large organization.
# The default is to auto detect if Redis is selected for installation on the
# remote server and in that case automatically use it for file locking.
# Use Redis for file locking as recommended for small and large installations.
# The default is to auto detect if Redis is enabled on the remote server and in
# that case automatically use it for file locking.
# Note that ownCloud requires version 2.2.5+ of the ``redis`` PHP package. This
# requirement is not meet for Ubuntu trusty (neither in the release repos nor
# in backports) thus Redis will not be enabled automatically by the role.
# Refer to the `official ownCloud Dokumentation <https://doc.owncloud.org/server/9.0/admin_manual/configuration_server/caching_configuration.html#id4>`__ for details.
owncloud__redis_enabled: '{{ True if (
("debops_service_redis" in hostvars[inventory_hostname]["group_names"]) and
(not (ansible_distribution == "Ubuntu" and ansible_distribution_release == "trusty"))
) else False }}'
owncloud__redis_enabled: '{{ ansible_local|d() and ansible_local.redis|d() and
ansible_local.redis.enabled|d() | bool and
(not (ansible_distribution == "Ubuntu" and ansible_distribution_release == "trusty")) }}'


# .. envvar:: owncloud__redis_host
#
# Redis server to use when :envvar:`owncloud__redis_enabled` is ``True``.
owncloud__redis_host: 'localhost'
owncloud__redis_host: '{{ ansible_local.redis.host
if (ansible_local|d() and ansible_local.redis|d() and
ansible_local.redis.host|d())
else "localhost" }}'


# .. envvar:: owncloud__redis_port
#
# Network port on which the Redis server is listening on.
owncloud__redis_port: 6379
owncloud__redis_port: '{{ ansible_local.redis.port
if (ansible_local|d() and ansible_local.redis|d() and
ansible_local.redis.port|d())
else "6379" }}'


# .. envvar:: owncloud__redis_password
#
# Redis server authentication password.
owncloud__redis_password: '{{ ansible_local.redis.password
if (ansible_local|d() and ansible_local.redis|d() and
ansible_local.redis.password|d())
else omit }}'

# .. Database configuration [[[1
#
Expand Down Expand Up @@ -565,7 +578,7 @@ owncloud__php_output_buffering: '0'
# .. envvar:: owncloud__php_max_children
#
# Max children processes to run in php fpm.
# FIXME: Check if default of debops.php might be sufficient.
# FIXME: Check if default of debops.php_ might be sufficient.
owncloud__php_max_children: '50'


Expand Down Expand Up @@ -635,6 +648,7 @@ owncloud__role_config:
value:
host: '{{ owncloud__redis_host }}'
port: '{{ owncloud__redis_port|int }}'
password: '{{ owncloud__redis_password }}'

'tempdirectory':
state: '{{ "present" if (owncloud__temp_path != "") else "absent" }}'
Expand Down Expand Up @@ -1268,15 +1282,8 @@ owncloud__theme_active: 'debops'
#
# Directory name where the custom theme generated by this role will be stored under.
# This variable has the same format as the :envvar:`owncloud__theme_active` option.
#
# If you don’t want this role to generate a theme for you, you can set:
#
# .. code-block:: yaml
# :linenos:
#
# owncloud__theme_directory_name: ''
#
# to disable this feature.
# If you don’t want this role to generate a theme for you, you can set this to
# an empty string to disable this feature.
# The generated theme name defaults to ``debops`` to allow enabling it via
# :envvar:`owncloud__theme_active`.
owncloud__theme_directory_name: 'debops'
Expand Down Expand Up @@ -1305,7 +1312,7 @@ owncloud__theme_name_html: '{{ owncloud__theme_name }}'
# .. envvar:: owncloud__theme_entitiy_name
#
# Entity string for your ownCloud. For example the name of your company. This
# string is used for the footer and the copyright.
# string is used in the footer and the copyright.
owncloud__theme_entitiy_name: 'DebOps'


Expand Down Expand Up @@ -1462,7 +1469,7 @@ owncloud__nginx_access_log_assets: True
#
# Defines the directory where Nginx will temporary store files holding client
# request bodies.
# Refer to the `the Nginx Dokumentation <http://nginx.org/en/docs/http/ngx_http_core_module.html#client_body_temp_path>`__ for details.
# Refer to the `the Nginx Dokumentation <https://nginx.org/en/docs/http/ngx_http_core_module.html#client_body_temp_path>`__ for details.
#
# The default (empty string) is to not change the default of the webserver.
# TODO: Confirm that this variable does what it says.
Expand Down Expand Up @@ -1626,7 +1633,7 @@ owncloud__nginx__upstream_php:
type: 'php'
php_pool: 'owncloud'

## Ensure legacy configurations are absent.
## Ensure legacy configuration is absent.
- name: 'php5_owncloud'
state: 'absent'
type: 'php5'
Expand Down
8 changes: 5 additions & 3 deletions docs/getting-started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,15 @@ on the same host as ownCloud or choose a different host:
[debops_service_redis]
hostname
This role will use a Redis server automatically when it is managed by
debops.redis_.

In case you chose a different host, you will need to specify which of your
Redis servers the ownCloud instance should use by setting the Redis
server host as :envvar:`owncloud__redis_host` and setting
:envvar:`owncloud__redis_enabled` to ``True``.

This role will use a locally setup Redis server automatically when it was setup
by putting the host into the ``debops_service_redis`` host group.
Additionally, you will need to set the :envvar:`owncloud__redis_password`.
Refer to debops.redis_ for details.

Example inventory
-----------------
Expand Down
4 changes: 2 additions & 2 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
owner: 'root'
group: 'root'
mode: '0644'
register: php__register_local_facts
register: owncloud__register_local_facts

- name: Gather facts if they were modified
action: setup
when: php__register_local_facts|changed
when: owncloud__register_local_facts|changed
# ]]]
34 changes: 6 additions & 28 deletions tasks/setup_owncloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,23 +100,20 @@
- name: Automatically finish setup via the occ tool
command: |
{{ owncloud__occ_bin_file_path | quote }} maintenance:install
--data-dir '{{ owncloud__data_path }}'
--database '{{ owncloud__database_map[owncloud__database].dbtype }}'
--database-name '{{ owncloud__database_map[owncloud__database].dbname }}'
--database-host '{{ owncloud__database_map[owncloud__database].dbhost }}'
--database-user '{{ owncloud__database_map[owncloud__database].dbuser }}'
--database-pass '{{ owncloud__database_map[owncloud__database].dbpass }}'
'--data-dir={{ owncloud__data_path }}'
'--database={{ owncloud__database_map[owncloud__database].dbtype }}'
'--database-name={{ owncloud__database_map[owncloud__database].dbname }}'
'--database-host={{ owncloud__database_map[owncloud__database].dbhost }}'
'--database-user={{ owncloud__database_map[owncloud__database].dbuser }}'
'--database-pass={{ owncloud__database_map[owncloud__database].dbpass }}'
{% if owncloud__admin_username != False %}
'--admin-user={{ owncloud__admin_username }}'
'--admin-pass={{ owncloud__admin_password }}'
{% endif %}
## FIXME: Enable after testing!
# no_log: True
register: owncloud__register_occ_install
when: owncloud__do_autosetup|bool and owncloud__release not in [ '8.0' ]
## Did not work with 8.1.6-2.1 because of https://github.com/owncloud/core/issues/17583
## Falling back to URL auto install method.
## FIXME: [Errno 2] No such file or directory

- name: Install ownCloud autoconfig file
template:
Expand Down Expand Up @@ -198,25 +195,6 @@

# Configure cron job for background tasks [[[

- name: Use cron for background tasks (lib/private/...)
lineinfile:
dest: '{{ owncloud__deploy_path }}/lib/private/backgroundjob.php'
state: 'present'
regexp: 'return OC_Appconfig::getValue'
line: " return OC_Appconfig::getValue( 'core', 'backgroundjobs_mode', 'cron' );"
when: owncloud__config_file is defined and not owncloud__config_file.stat.exists and owncloud__release in [ '7.0' ]
## FIXME(ypid): Not sure if it was 7.0 or if it still works for 8.0. Anyway. Scheduled for removal on 2016-10
## https://github.com/owncloud/core/wiki/Maintenance-and-Release-Schedule

## Does not match/is not needed for ownCloud above version 7.0
- name: Use cron for background jobs (settings/admin.php)
lineinfile:
dest: '{{ owncloud__deploy_path }}/settings/admin.php'
state: 'present'
regexp: "'backgroundjobs_mode', OC_Appconfig::getValue"
line: "$tmpl->assign('backgroundjobs_mode', OC_Appconfig::getValue('core', 'backgroundjobs_mode', 'cron'));"
when: owncloud__release in [ '7.0' ] and not owncloud__config_file

- name: Setup cron service
cron:
name: 'ownCloud Background Jobs'
Expand Down
18 changes: 15 additions & 3 deletions templates/srv/www/sites/config/debops.config.php.j2
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
{# vim: foldmarker=[[[,]]]:foldmethod=marker
#}
<?php
/* {{ ansible_managed }} */

{% macro get_value(item) %}{# [[[ #}
{% set filtered_item = item|to_yaml|from_yaml %}{# Copy dict #}
{% if item is mapping %}
{% for k, v in item.iteritems() if v == omit %}
{% set _ = filtered_item.pop(k, None) %}
{% endfor %}
{% endif %}
{{ filtered_item | to_yaml }}
{% endmacro %}{# ]]]
#}
{% set owncloud__tpl_unchecked_config_dict =
owncloud__role_config
| combine(owncloud__role_recommended_config)
Expand All @@ -10,10 +22,10 @@
{% set owncloud__tpl_active_config_dict = {} %}
{% for config_key, config_item in owncloud__tpl_unchecked_config_dict.iteritems() %}
{% if config_item is mapping and "state" in config_item and config_item.state and "value" in config_item %}
{% if config_item.state == "present" %}
{% set _ = owncloud__tpl_active_config_dict.update({config_key: config_item.value}) %}
{% if config_item.state == "present" and config_item.value %}
{% set _ = owncloud__tpl_active_config_dict.update({config_key: (get_value(config_item.value) | from_yaml) }) %}
{% endif %}
{% else %}
{% elif config_item != omit %}
{# Assume it is not a control structure for Ansible but the raw value for ownCloud #}
{% set _ = owncloud__tpl_active_config_dict.update({config_key: config_item}) %}
{% endif %}
Expand Down

0 comments on commit 0a2a9fa

Please sign in to comment.