Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
e98bf3f3f2 |
@ -1,82 +1,25 @@
|
|||||||
---
|
---
|
||||||
# domain, webroot
|
# domain, webroot
|
||||||
nextcloud_domain: example.com
|
wordpress_domain: example.com
|
||||||
nextcloud_web_root: /
|
wordpress_web_root: /
|
||||||
|
|
||||||
# database
|
# database
|
||||||
nextcloud_db_engine: sqlite
|
wordpress_db_host: localhost
|
||||||
|
wordpress_db_user: wordpress
|
||||||
|
wordpress_db_password: password
|
||||||
|
wordpress_db_name: wordpress
|
||||||
|
wordpress_table_prefix: wp
|
||||||
|
|
||||||
# db name or path (sqlite)
|
# debug: cualquier valor distinto de "" es si
|
||||||
nextcloud_db_name: nextcloud
|
wordpress_debug: ""
|
||||||
|
|
||||||
# mysql, mariadb, postgresql
|
# configuracion extra - va literal al config.php
|
||||||
nextcloud_db_host: localhost
|
wordpress_config_extra: ""
|
||||||
nextcloud_db_user: nextcloud
|
|
||||||
nextcloud_db_password: password
|
|
||||||
nextcloud_table_prefix: ""
|
|
||||||
|
|
||||||
# data dir (inside container)
|
|
||||||
nextcloud_data_dir: /var/www/html/data
|
|
||||||
|
|
||||||
# admin user
|
|
||||||
nextcloud_admin_user: admin
|
|
||||||
nextcloud_admin_password: password
|
|
||||||
|
|
||||||
# space separated trusted domains
|
|
||||||
nextcloud_trusted_domains:
|
|
||||||
- "{{ nextcloud_domain }}"
|
|
||||||
|
|
||||||
# The install and update script is only triggered when a default command
|
|
||||||
# is used (apache-foreground or php-fpm). If you use a custom command
|
|
||||||
# you have to enable the install / update with
|
|
||||||
nextcloud_update: ""
|
|
||||||
|
|
||||||
# The use of Redis is recommended to prevent file locking problems. See
|
|
||||||
# the examples for further instructions.
|
|
||||||
# If you want to use Redis you have to create a separate Redis container
|
|
||||||
# in your setup / in your docker-compose file. To inform Nextcloud about
|
|
||||||
# the Redis container add:
|
|
||||||
nextcloud_redis_host: ""
|
|
||||||
nextcloud_redis_port: "6379"
|
|
||||||
|
|
||||||
# smtp
|
|
||||||
nextcloud_smtp_host: ""
|
|
||||||
nextcloud_smtp_secure: ""
|
|
||||||
nextcloud_smtp_port: ""
|
|
||||||
nextcloud_smtp_authtype: LOGIN
|
|
||||||
nextcloud_smtp_user: ""
|
|
||||||
nextcloud_smtp_password: ""
|
|
||||||
nextcloud_mail_from_address: ""
|
|
||||||
nextcloud_mail_domain: "{{ nextcloud_domain }}"
|
|
||||||
|
|
||||||
# ldap
|
|
||||||
nextcloud_ldap_enable: false
|
|
||||||
nextcloud_ldap_host: "{{ ldap_uri | default('openldap') | regex_replace(':[0-9]+$') }}"
|
|
||||||
nextcloud_ldap_port: "389"
|
|
||||||
#nextcloud_ldap_backup_host: ""
|
|
||||||
nextcloud_ldap_backup_port: "389"
|
|
||||||
#nextcloud_ldap_agent_name: ""
|
|
||||||
#nextcloud_ldap_agent_password: ""
|
|
||||||
nextcloud_ldap_base: "dc={{ openldap_domain | default('example.com') | replace('.', ',dc=') }}"
|
|
||||||
#nextcloud_ldap_base_users: ""
|
|
||||||
#nextcloud_ldap_base_groups: ""
|
|
||||||
#nextcloud_ldap_user_filter_objectclass: ""
|
|
||||||
#nextcloud_ldap_user_filter: ""
|
|
||||||
#nextcloud_ldap_login_filter: ""
|
|
||||||
#nextcloud_ldap_group_filter_objectclass: ""
|
|
||||||
#nextcloud_ldap_group_filter: ""
|
|
||||||
#nextcloud_ldap_gid_number: ""
|
|
||||||
#nextcloud_ldap_user_display_name: ""
|
|
||||||
#nextcloud_ldap_user_display_name_2: ""
|
|
||||||
#nextcloud_ldap_group_display_name: ""
|
|
||||||
#nextcloud_ldap_email_attribute: ""
|
|
||||||
#nextcloud_ldap_group_member_assoc_attr: ""
|
|
||||||
#nextcloud_ldap_expert_username_attr: ""
|
|
||||||
|
|
||||||
# container
|
# container
|
||||||
nextcloud_image: eumau/nextcloud
|
wordpress_image: wordpress
|
||||||
nextcloud_container: nextcloud
|
wordpress_container: wordpress
|
||||||
nextcloud_volume: nextcloud
|
wordpress_volume: wordpress
|
||||||
|
|
||||||
# definido por rol docker
|
# definido por rol docker
|
||||||
docker_network: dockernet
|
docker_network_name: dockernet
|
||||||
|
172
tasks/main.yml
172
tasks/main.yml
@ -1,133 +1,95 @@
|
|||||||
---
|
---
|
||||||
# TODO: postgres support
|
- name: create wordpress database
|
||||||
# - name: create nextcloud database (pg)
|
|
||||||
# postgresql_db:
|
|
||||||
# state: present
|
|
||||||
# name: "{{ nextcloud_db_name }}"
|
|
||||||
# login_host: "{{ postgresql_host }}"
|
|
||||||
# login_port: "{{ postgresql_port }}"
|
|
||||||
# login_user: "{{ postgresql_root_password }}"
|
|
||||||
# login_password: "{{ postgresql_root_password }}"
|
|
||||||
|
|
||||||
# - name: create nextcloud db user (pg)
|
|
||||||
# postgresql_user:
|
|
||||||
# state: present
|
|
||||||
# name: "{{ nextcloud_db_user }}"
|
|
||||||
# password: "{{ nextcloud_db_password }}"
|
|
||||||
# priv: "{{ nextcloud_db_name }}.*:ALL"
|
|
||||||
# login_host: "{{ postgresql_host }}"
|
|
||||||
# login_port: "{{ postgresql_port }}"
|
|
||||||
# login_user: root
|
|
||||||
# login_password: "{{ postgresql_root_password }}"
|
|
||||||
|
|
||||||
- name: create nextcloud database
|
|
||||||
mysql_db:
|
mysql_db:
|
||||||
state: present
|
state: present
|
||||||
name: "{{ nextcloud_db_name }}"
|
name: "{{ wordpress_db_name }}"
|
||||||
login_host: "{{ mariadb_host }}"
|
login_host: "{{ mariadb_host }}"
|
||||||
login_port: "{{ mariadb_port }}"
|
login_port: "{{ mariadb_port }}"
|
||||||
login_user: root
|
login_user: root
|
||||||
login_password: "{{ mariadb_root_password }}"
|
login_password: "{{ mariadb_root_password }}"
|
||||||
when: nextcloud_db_engine in ('mariadb','mysql')
|
|
||||||
|
|
||||||
- name: create nextcloud db user
|
- name: create wordpress db user
|
||||||
mysql_user:
|
mysql_user:
|
||||||
state: present
|
state: present
|
||||||
name: "{{ nextcloud_db_user }}"
|
name: "{{ wordpress_db_user }}"
|
||||||
host: "%"
|
host: "%"
|
||||||
password: "{{ nextcloud_db_password }}"
|
password: "{{ wordpress_db_password }}"
|
||||||
priv: "{{ nextcloud_db_name }}.*:ALL"
|
priv: "{{ wordpress_db_name }}.*:ALL"
|
||||||
login_host: "{{ mariadb_host }}"
|
login_host: "{{ mariadb_host }}"
|
||||||
login_port: "{{ mariadb_port }}"
|
login_port: "{{ mariadb_port }}"
|
||||||
login_user: root
|
login_user: root
|
||||||
login_password: "{{ mariadb_root_password }}"
|
login_password: "{{ mariadb_root_password }}"
|
||||||
when: nextcloud_db_engine in ('mariadb','mysql')
|
|
||||||
|
|
||||||
- name: start nextcloud container
|
- name: start wordpress container
|
||||||
docker_container:
|
docker_container:
|
||||||
image: "{{ nextcloud_image }}"
|
image: "{{ wordpress_image }}"
|
||||||
name: "{{ nextcloud_container }}"
|
name: "{{ wordpress_container }}"
|
||||||
volumes:
|
volumes:
|
||||||
- "{{ nextcloud_volume }}:/var/www/html"
|
- "{{ wordpress_volume }}:/var/www/html"
|
||||||
env:
|
env:
|
||||||
SQLITE_DATABASE:
|
WORDPRESS_DB_HOST: "{{ mariadb_container }}"
|
||||||
"{{ nextcloud_db_name if nextcloud_db_engine == 'sqlite' else '' }}"
|
WORDPRESS_DB_USER: "{{ wordpress_db_user }}"
|
||||||
MYSQL_DATABASE:
|
WORDPRESS_DB_PASSWORD: "{{ wordpress_db_password }}"
|
||||||
"{{ nextcloud_db_name if nextcloud_db_engine in ('mysql','mariadb') else '' }}"
|
WORDPRESS_DB_NAME: "{{ wordpress_db_name }}"
|
||||||
MYSQL_USER:
|
WORDPRESS_TABLE_PREFIX: "{{ wordpress_table_prefix }}"
|
||||||
"{{ nextcloud_db_user if nextcloud_db_engine in ('mysql','mariadb') else '' }}"
|
# (default to unique random SHA1s, but only if other environment
|
||||||
MYSQL_PASSWORD:
|
# variable configuration is provided)
|
||||||
"{{ nextcloud_db_password if nextcloud_db_engine in ('mysql','mariadb') else '' }}"
|
# WORDPRESS_AUTH_KEY:
|
||||||
MYSQL_HOST:
|
# WORDPRESS_SECURE_AUTH_KEY:
|
||||||
"{{ nextcloud_db_host if nextcloud_db_engine in ('mysql','mariadb') else '' }}"
|
# WORDPRESS_LOGGED_IN_KEY:
|
||||||
POSTGRES_DB:
|
# WORDPRESS_NONCE_KEY:
|
||||||
"{{ nextcloud_db_name if 'postgres' in nextcloud_db_engine else '' }}"
|
# WORDPRESS_AUTH_SALT:
|
||||||
POSTGRES_USER:
|
# WORDPRESS_SECURE_AUTH_SALT:
|
||||||
"{{ nextcloud_db_user if 'postgres' in nextcloud_db_engine else '' }}"
|
# WORDPRESS_LOGGED_IN_SALT:
|
||||||
POSTGRES_PASSWORD:
|
# WORDPRESS_NONCE_SALT:
|
||||||
"{{ nextcloud_db_password if 'postgres' in nextcloud_db_engine else '' }}"
|
# (defaults to disabled, non-empty value will enable WP_DEBUG in
|
||||||
POSTGRES_HOST:
|
# wp-config.php)
|
||||||
"{{ nextcloud_db_host if 'postgres' in nextcloud_db_engine else '' }}"
|
WORDPRESS_DEBUG: "{{ wordpress_debug }}"
|
||||||
NEXTCLOUD_TABLE_PREFIX: "{{ nextcloud_table_prefix }}"
|
# (defaults to nothing, non-empty value will be embedded verbatim
|
||||||
NEXTCLOUD_ADMIN_USER: "{{ nextcloud_admin_user }}"
|
# inside wp-config.php -- especially useful for applying extra
|
||||||
NEXTCLOUD_ADMIN_PASSWORD: "{{ nextcloud_admin_password }}"
|
# configuration values this image does not provide by default such
|
||||||
NEXTCLOUD_TRUSTED_DOMAINS: "{{ nextcloud_trusted_domains | join(' ')}}"
|
# as WP_ALLOW_MULTISITE; see docker-library/wordpress#142 for more
|
||||||
NEXTCLOUD_UPDATE: "{{ nextcloud_update }}"
|
# details)
|
||||||
REDIS_HOST: "{{ nextcloud_redis_host }}"
|
WORDPRESS_CONFIG_EXTRA: "{{ wordpress_config_extra }}"
|
||||||
REDIS_HOST_PORT: "{{ nextcloud_redis_port }}"
|
|
||||||
SMTP_HOST: "{{ nextcloud_smtp_host }}"
|
|
||||||
SMTP_SECURE: "{{ nextcloud_smtp_secure }}"
|
|
||||||
SMTP_PORT: "{{ nextcloud_smtp_port }}"
|
|
||||||
SMTP_AUTHTYPE: "{{ nextcloud_smtp_authtype }}"
|
|
||||||
SMTP_NAME: "{{ nextcloud_smtp_user }}"
|
|
||||||
SMTP_PASSWORD: "{{ nextcloud_smtp_password }}"
|
|
||||||
MAIL_FROM_ADDRESS: "{{ nextcloud_mail_from_address }}"
|
|
||||||
MAIL_DOMAIN: "{{ nextcloud_mail_domain }}"
|
|
||||||
LDAP_ENABLE: "{{ 'true' if nextcloud_ldap_enable else 'false' }}"
|
|
||||||
LDAP_HOST: "{{ nextcloud_ldap_host }}"
|
|
||||||
LDAP_PORT: "{{ nextcloud_ldap_port | string }}"
|
|
||||||
LDAP_BACKUP_HOST: "{{ nextcloud_ldap_backup_host | default(omit) }}"
|
|
||||||
LDAP_BACKUP_PORT: "{{ nextcloud_ldap_backup_port | string }}"
|
|
||||||
LDAP_AGENT_NAME: "{{ nextcloud_ldap_agent_name | default(omit) }}"
|
|
||||||
LDAP_AGENT_PASSWORD: "{{ nextcloud_ldap_agent_password | default(omit) }}"
|
|
||||||
LDAP_BASE: "{{ nextcloud_ldap_base }}"
|
|
||||||
LDAP_BASE_USERS: "{{ nextcloud_ldap_base_users | default(omit) }}"
|
|
||||||
LDAP_BASE_GROUPS: "{{ nextcloud_ldap_base_groups | default(omit) }}"
|
|
||||||
LDAP_USER_FILTER_OBJECTCLASS: "{{ nextcloud_ldap_user_filter_objectclass | default(omit) }}"
|
|
||||||
LDAP_USER_FILTER: "{{ nextcloud_ldap_user_filter | default(omit) }}"
|
|
||||||
LDAP_LOGIN_FILTER: "{{ nextcloud_ldap_login_filter | default(omit) }}"
|
|
||||||
LDAP_GROUP_FILTER_OBJECTCLASS: "{{ nextcloud_ldap_group_filter_objectclass | default(omit) }}"
|
|
||||||
LDAP_GROUP_FILTER: "{{ nextcloud_ldap_group_filter | default(omit) }}"
|
|
||||||
LDAP_GID_NUMBER: "{{ nextcloud_ldap_gid_number | default(omit) }}"
|
|
||||||
LDAP_USER_DISPLAY_NAME: "{{ nextcloud_ldap_user_display_name | default(omit) }}"
|
|
||||||
LDAP_USER_DISPLAY_NAME_2: "{{ nextcloud_ldap_user_display_name_2 | default(omit) }}"
|
|
||||||
LDAP_GROUP_DISPLAY_NAME: "{{ nextcloud_ldap_group_display_name | default(omit) }}"
|
|
||||||
LDAP_EMAIL_ATTRIBUTE: "{{ nextcloud_ldap_email_attribute | default(omit) }}"
|
|
||||||
LDAP_GROUP_MEMBER_ASSOC_ATTR: "{{ nextcloud_ldap_group_member_assoc_attr | default(omit) }}"
|
|
||||||
LDAP_EXPERT_USERNAME_ATTR: "{{ nextcloud_ldap_expert_username_attr | default(omit) }}"
|
|
||||||
networks:
|
networks:
|
||||||
- name: "{{ docker_network }}"
|
- name: "{{ docker_network_name }}"
|
||||||
ports:
|
ports:
|
||||||
|
|
||||||
- name: export nginx config
|
- name: template nginx config
|
||||||
set_fact:
|
copy:
|
||||||
nginx_config: >-
|
content: |
|
||||||
{{ nginx_config | default({}) | combine({
|
server {
|
||||||
nextcloud_domain: {
|
listen 80; # para debug
|
||||||
"locations": {
|
listen 443 ssl;
|
||||||
'/': {
|
server_name {{ wordpress_domain }};
|
||||||
"proxy_pass": "https://{}:9010".format(nextcloud_container)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, recursive=True) }}
|
|
||||||
|
|
||||||
- name: inspect nextcloud volume
|
# root /var/www/html;
|
||||||
|
# index index.php index.html;
|
||||||
|
# access_log /dev/stdout;
|
||||||
|
# error_log /dev/stdout info;
|
||||||
|
|
||||||
|
location {{ wordpress_web_root }} {
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_pass http://{{ wordpress_container }};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dest: "{{ nginx_mountpoint_config }}/wordpress.conf"
|
||||||
|
register: ngconf
|
||||||
|
|
||||||
|
- name: restart frontend
|
||||||
|
docker_container:
|
||||||
|
name: "{{ nginx_container }}"
|
||||||
|
restart: yes
|
||||||
|
when: ngconf is changed
|
||||||
|
|
||||||
|
- name: inspect wordpress volume
|
||||||
docker_volume_info:
|
docker_volume_info:
|
||||||
name: "{{ nextcloud_volume }}"
|
name: "{{ wordpress_volume }}"
|
||||||
register: volinfo
|
register: volinfo
|
||||||
|
|
||||||
- name: export variables
|
- name: export variables
|
||||||
set_fact:
|
set_fact:
|
||||||
nextcloud_volume: "{{ lookup('vars','nextcloud_volume') }}"
|
wordpress_volume: "{{ lookup('vars','wordpress_volume') }}"
|
||||||
nextcloud_volume_mountpoint: "{{ volinfo.volume.Mountpoint }}"
|
wordpress_volume_mountpoint: "{{ volinfo.volume.Mountpoint }}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user