Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LQDN Adminsys
piops-roles
install_nextcloud
Commits
259c14b4
Commit
259c14b4
authored
Feb 06, 2017
by
Marc Crebassa
Committed by
GitHub
Feb 06, 2017
Browse files
Merge pull request #26 from aalaesar/Rework_version_selection_#18
Reworked version selection, fix #18
parents
41ae7a26
2d645ea1
Changes
5
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
259c14b4
...
...
@@ -21,35 +21,119 @@ This role requires root access, so either configure it in your inventory files,
> playbook.yml:
```
YAML
- hosts: dnsserver
become: yes
roles:
- role: aalaesar.install_nextcloud
become: yes
```
## Role Variables
Role's variables (and their default values):
### Installation configuration
> Source location will be calculated following channel, version and branch values.
### Choose the version
An URL will be generated following naming rules used in the nextcloud repository
_Not following this rules correctly may make the role unable to download nextcloud._
#### Repository naming rules:
Some variables changes depending on the channel used and if get_latest is true.
This table summarize the possible cases.
|channel|latest|major&latest|major|full|special|
|---|---|---|---|---|---|
|
**releases**
|yes/no|_null_
\|
9
\|
10
\|
...|_null_|"10.0.3"|_null_|
|
**prereleases**
|_null_|_null_|_null_|"11.0.1"|_null_
\|
"RC(n)
\|
beta(n)"|
|
**daily**
|yes/no|_null_
\|
master
\|
stable9
\|
...|master
\|
9
\|
10
\|
...|_null_|_null_
\|
"YYYY-MM-DD"|
__major&latest__
= major value when latest is true
_null_
= "not used"
#### version variables:
```
YAML
nextcloud_channel: "releases"
nextcloud_
version_
channel: "releases"
# releases | prereleases | daily
```
Defines the version channel you want to use for the installation
Available : releases | prereleases | daily | latest
Specify the main channel to use.
```
YAML
nextcloud_
version: 10.0.2
nextcloud_
get_latest: true
```
Specify the version name for channels
**releases**
,
**prereleases**
and
**daily**
. (it may not be numbers at all)
Specify if the "latest" archive should be downloaded.
```
YAML
nextcloud_
branch: "stable"
#
nextcloud_
version_major: 10
```
Specify the branch name for
**daily**
&
**latest**
channel
Specify what major version you desire.
```
YAML
# nextcloud_version_full: "10.0.3"
```
The full version of the desired nextcloud instance. type
**M.F.P**
_(Major.Feature.Patch)_
```
YAML
# nextcloud_version_special: ""
```
Specify a special string in the archive's filename.
For prereleases: "RCn|beta" | for daily "YYYY-MM-DD"
```
YAML
nextcloud_repository: "https://download.nextcloud.com/server"
```
The Nextcloud's official repository. You may change it if you have the sources somewhere else.
Repository's URL.
```
YAML
nextcloud_archive_format: "zip" # zip | tar.bz2
```
Choose between the 2 archive formats available in the repository.
```
YAML
# nextcloud_full_url:
```
_If you don't like rules..._
Specify directly a full URL to the archive. The role will skip the url generation and download the archive
#### Examples:
-
Download your own archive:
```
YAML
nextcloud_full_url: https://h2g2.com/42/nexcloud.zip
```
-
Choose the latest release (default):
```
YAML
nextcloud_version_channel: "releases"
nextcloud_get_latest: true
```
-
Choose the latest v10 release:
```
YAML
nextcloud_version_channel: "releases"
nextcloud_get_latest: true
nextcloud_version_major: 10
```
-
Choose a specific release:
```
YAML
nextcloud_version_channel: "releases"
nextcloud_get_latest: false
nextcloud_full_version: "10.0.3"
```
-
Get the nextcloud 11.0.1 prerelease 1:
```
YAML
nextcloud_version_channel: "prereleases"
nextcloud_version_full: "11.0.1"
nextcloud_version_special: "RC1"
```
-
Get the latest daily:
```
YAML
nextcloud_version_channel: "daily"
nextcloud_get_latest: true
```
-
Get the latest daily for stable 10:
```
YAML
nextcloud_version_channel: "daily"
nextcloud_get_latest: true
nextcloud_version_major: "stable10"
```
-
Get the daily for master at january 1rst 2017:
```
YAML
nextcloud_version_channel: "daily"
nextcloud_get_latest: false
nextcloud_version_major: "master"
nextcloud_version_special: "2017-01-01"
```
### Main configuration
```
YAML
nextcloud_trusted_domain: ["{{ ansible_default_ipv4.address }}"]
...
...
@@ -235,7 +319,6 @@ The name may not be canon some times. (like *appName-x.y.z** instead of **appNam
-
The role will __not__ update an already enabled application.
-
The configuration is applied only when the app in enabled the first time:
Changing a parameter, then running the role again while the app is already enabled will __not__ update its configuration.
-
for configuration, special characters must be escaped.
-
this post_install process is tagged and can be called directly using the
`--tags install_apps`
option.
## Dependencies
...
...
@@ -264,8 +347,8 @@ You can choose the version channel to download a specific version of nextcloud.
-
hosts
:
server
roles
:
-
role
:
aalaesar.install_nextcloud
nextcloud_channel
:
"
latest
"
nextcloud_
branch
:
"
master"
nextcloud_
version_
channel
:
"
daily
"
nextcloud_
version_major
:
"
master"
```
### Case 2: Using letsencrypt with this role.
...
...
@@ -298,18 +381,24 @@ Here 2 examples for apache and nginx (because they have slightly different confi
nextcloud_tls_cert_key: "/etc/letsencrypt/live/example2.com/privkey.pem"
```
### Case 3: integration to an existing system.
- An Ansible master want to install a new Nextcloud instance at _cloud.example.tld_ on an existing server.
- He already have a valid certificate for the trusted domain in /etc/nginx/certs/ installed
- he wants the following apps to be installed & enabled : files_external, calendar, richdocuments (Collabora)
- He can run the role with the following variables to install Nextcloud accordingly to its existing infrastructure .
- An Ansible master want to install a new Nextcloud instance on an existing Ubuntu 14.04 server with nginx & mariadb installed.
- As is server do not meet the php requirements for Nextcloud 11, he chooses to use the lastest Nextcloud 10 release.
- He wants it to be accessible from internet at _cloud.example.tld_ and from his intranet at _dbox.intra.net_.
- He already have a valid certificate for the intranet domain in /etc/nginx/certs/ installed
- he wants the following apps to be installed & enabled : files_external, calendar, agenda, richdocuments (Collabora)
- The richdocuments app has to be configured to point out to the Collabora domain.
He can run the role with the following variables to install Nextcloud accordingly to its existing requirements .
```
YAML
---
-
hosts: server
roles:
-
role: aalaesar.install_nextcloud
nextcloud_version_major: 10
nextcloud_trusted_domain:
-
"cloud.example.tld"
-
"dbox.intra.net"
nextcloud_websrv: "nginx"
nextcloud_admin_pwd: "secret007"
nextcloud_webroot: "/var/www/nextcloud/"
...
...
@@ -321,11 +410,12 @@ Here 2 examples for apache and nginx (because they have slightly different confi
nextcloud_mysql_root_pwd: "42h2g2"
nextcloud_apps:
files_external: "" #enable files_external which is already installed in nextcloud
calendar: "https://github.com/nextcloud/calendar/releases/download/v1.5.0/calendar.tar.gz" # download and install calendar app
calendar: "https://github.com/nextcloud/calendar/releases/download/v1.5.0/calendar.tar.gz"
contacts: "https://github.com/nextcloud/contacts/releases/download/v1.5.3/contacts.tar.gz"
richdocuments-1.1.25: # the app name is equal to the extracted folder name from the archive
source: "https://github.com/nextcloud/richdocuments/archive/1.1.25.zip"
conf:
wopi_url: 'https:
\/\
/
office.example.tld'
wopi_url: 'https:
/
/office.example.tld'
```
License
...
...
defaults/main.yml
View file @
259c14b4
---
# defaults file for nextcloud
# [CONFIG]
nextcloud_channel
:
"
releases"
# nextcloud_channel: releases | prereleases | daily | latest
nextcloud_version
:
10.0.2
# nextcloud_version for releases, prereleases and daily channel
nextcloud_branch
:
"
stable"
# specified branch for daily & latest channel
nextcloud_repository
:
"
https://download.nextcloud.com/server"
# Domain URL where to download Nextcloud.
# Path will be calculated following channel, version and branch.
# defaults file for nextcloud
# [DOWNLOAD]
# An URL will be generated following naming rules used by nextcloud's repository
# Not following this rules correctly will make the role unable to download nextcloud.
nextcloud_version_channel
:
"
releases"
# mandatory # releases | prereleases | daily
# channel releases requires version_full.
# channel prereleases requires version_full. Optional: version_special.
# channel daily requires requires version_full & version_special.
nextcloud_get_latest
:
true
# mandatory # specify if the latest archive should be downloaded.
# Override generated file name for channels: releases | daily.
# optional : version_major.
# nextcloud_version_major: 10 # (9 | 10 | 11| ..) for releases | for daily : (master | stable9 | stable10 | ...)
# nextcloud_version_full: "10.0.3" # full version string
# nextcloud_version_special: "" # For prereleases: "RCn|beta" | for daily "YYYY-MM-DD"
nextcloud_repository
:
"
https://download.nextcloud.com/server"
# Domain URL where to download Nextcloud.
nextcloud_archive_format
:
"
zip"
# zip | tar.bz2
# nextcloud_full_url: "https://h2g2.com/downloads/42/my_nexcloud.zip" # specify directly a full URL to the archive if you don't like rules.
# [CONFIG]
nextcloud_trusted_domain
:
[
"
{{
ansible_default_ipv4.address
}}"
]
nextcloud_instance_name
:
"
{{
nextcloud_trusted_domain
|
first
}}"
...
...
tasks/nc_download.yml
View file @
259c14b4
---
-
name
:
"
[NC-DL]
-
Unzip
is
installed"
package
:
name=unzip state=installed
when
:
nextcloud_archive_format == "zip"
-
name
:
"
[NC-DL]
-
bunzip2
is
installed"
package
:
name=bzip2 state=installed
when
:
nextcloud_archive_format == "tar.bz2"
-
block
:
-
name
:
"
[NC-DL]
-
Create
the
download
link
for
*latest*."
set_fact
:
nextcloud_full_url
:
"
{{nextcloud_repository}}/{{nextcloud_version_channel}}/{{[nextcloud_dl_file_name.latest,
nextcloud_archive_format]|join('.')}}"
when
:
nextcloud_get_latest and (nextcloud_version_channel != 'prereleases')
-
name
:
"
[NC-DL]
-
Create
the
download
link."
set_fact
:
nextcloud_full_url
:
"
{{nextcloud_repository}}/{{nextcloud_version_channel}}/{{[nextcloud_dl_file_name[nextcloud_version_channel],
nextcloud_archive_format]|join('.')}}"
when
:
(not nextcloud_get_latest) or (nextcloud_version_channel == 'prereleases')
when
:
nextcloud_full_url is not defined
-
block
:
-
name
:
"
Download
&
extract
Nextcloud
to
/tmp."
...
...
tests/test.yml
View file @
259c14b4
...
...
@@ -5,6 +5,7 @@
roles
:
[
../../
]
vars
:
nextcloud_db_backend
:
"
pgsql"
nextcloud_version_major
:
10
nextcloud_apps
:
files_external
:
"
"
#enable files_external which is already installed in nexcloud
calendar
:
"
https://github.com/nextcloud/calendar/releases/download/v1.5.0/calendar.tar.gz"
# download and install calendar app
vars/main.yml
View file @
259c14b4
---
# vars file for nextcloud
nextcloud_dl_path
:
releases
:
"
releases"
prereleases
:
"
prereleases"
daily
:
"
daily"
latest
:
"
daily"
nextcloud_dl_file
:
releases
:
"
nextcloud-{{nextcloud_version}}.zip"
prereleases
:
"
nextcloud-{{nextcloud_version}}.zip"
daily
:
"
nextcloud-{{nextcloud_branch}}-daily-{{nextcloud_version}}.zip"
latest
:
"
latest-{{nextcloud_branch}}.zip"
nextcloud_full_url
:
"
{{nextcloud_repository}}/{{nextcloud_dl_path[nextcloud_channel]}}/{{nextcloud_dl_file[nextcloud_channel]}}"
nextcloud_dl_file_name
:
latest
:
"
{{['latest',
nextcloud_version_major]|reject('undefined')|join('-')}}"
releases
:
"
{{['nextcloud',
nextcloud_version_full]|reject('undefined')|join('-')}}"
prereleases
:
"
nextcloud-{{[nextcloud_version_full,
nextcloud_version_special]|reject('undefined')|join()}}"
daily
:
"
nextcloud-{{nextcloud_version_major|d('')}}-daily-{{nextcloud_version_special|d('')}}"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment