Explorar el Código

better configuration management

master
padre
commit
1bded2b59f
Se han modificado 4 ficheros con 35 adiciones y 88 borrados
  1. +31
    -8
      tasks/configure.yml
  2. +3
    -1
      tasks/main.yml
  3. +0
    -79
      templates/config.php.j2
  4. +1
    -0
      vars/main.yml

+ 31
- 8
tasks/configure.yml Ver fichero

@@ -1,13 +1,36 @@
---

- name: nextcloud occ
command: php occ {{item}}
with_items:
- config:system:set trusted_domains 1 --value={{inventory_hostname}}
- maintenance:update:htaccess
- background:cron
args:
chdir: /var/www/nextcloud
- block:

- name: nextcloud list config
command: php occ config:list
args:
chdir: /var/www/nextcloud
register: _nextcloud_config_cmd

- name: nextcloud occ config:app:delete trusted_domains
command: php occ config:system:delete trusted_domains
args:
chdir: /var/www/nextcloud
when: _nextcloud_config.system.trusted_domains != nextcloud_server_names

- name: nextcloud occ config:system:set trusted_domains
command: php occ config:system:set trusted_domains {{ item.0 }} --value={{ item.1 }}
args:
chdir: /var/www/nextcloud
with_indexed_items: "{{ nextcloud_server_names }}"
when: _nextcloud_config.system.trusted_domains != nextcloud_server_names

- name: nextcloud occ maintenance:update:htaccess
command: php occ maintenance:update:htaccess
args:
chdir: /var/www/nextcloud

- name: nextcloud occ background:cron
command: php occ background:cron
args:
chdir: /var/www/nextcloud

become: true
become_user: www-data
become_method: sudo

+ 3
- 1
tasks/main.yml Ver fichero

@@ -1,6 +1,6 @@
---

- include: setup_Debian.yml
- include: setup_{{ansible_os_family}}.yml

- include: php-opcache.yml

@@ -25,6 +25,8 @@

- include: upgrade.yml

- include: certificate.yml

- include: apache2.yml

- include: cron.yml

+ 0
- 79
templates/config.php.j2 Ver fichero

@@ -22,26 +22,6 @@

$CONFIG = array(


/**
* Your list of trusted domains that users can log into. Specifying trusted
* domains prevents host header poisoning. Do not remove this, as it performs
* necessary security checks.
* You can specify:
*
* - the exact hostname of your host or virtual host, e.g. demo.example.org.
* - the exact hostname with permitted port, e.g. demo.example.org:443.
* This disallows all other ports on this host
* - use * as a wildcard, e.g. ubos-raspberry-pi*.local will allow
* ubos-raspberry-pi.local and ubos-raspberry-pi-2.local
*/
'trusted_domains' =>
array (
'localhost',
'{{inventory_hostname}}',
),


/**
* Where user files are stored. The SQLite database is also stored here, when
* you use SQLite.
@@ -50,55 +30,6 @@ $CONFIG = array(
*/
'datadirectory' => '{{nextcloud_data_directory}}',


/**
* Identifies the database used with this installation. See also config option
* ``supportedDatabases``
*
* Available:
* - sqlite (SQLite3)
* - mysql (MySQL/MariaDB)
* - pgsql (PostgreSQL)
*
* Defaults to ``sqlite``
*/
'dbtype' => '{{ nextcloud_database_type }}',

/**
* Your host server name, for example ``localhost``, ``hostname``,
* ``hostname.example.com``, or the IP address. To specify a port use
* ``hostname:####``; to specify a Unix socket use
* ``localhost:/path/to/socket``.
*/
'dbhost' => '{{ nextcloud_database_host }}',

/**
* The name of the Nextcloud database, which is set during installation. You
* should not need to change this.
*/
'dbname' => '{{ nextcloud_database_name }}',

/**
* The user that Nextcloud uses to write to the database. This must be unique
* across Nextcloud instances using the same SQL database. This is set up during
* installation, so you shouldn't need to change it.
*/
'dbuser' => '{{ nextcloud_database_user }}',

/**
* The password for the database user. This is set up during installation, so
* you shouldn't need to change it.
*/
'dbpassword' => '{{ nextcloud_database_password }}',

/**
* Prefix for the Nextcloud tables in the database.
*
* Default to ``oc_``
*/
'dbtableprefix' => '',


/**
* Indicates whether the Nextcloud instance was installed successfully; ``true``
* indicates a successful installation, and ``false`` indicates an unsuccessful
@@ -183,16 +114,6 @@ $CONFIG = array(
*/
'defaultapp' => '{{nextcloud_defaultapp}}',

/**
* Use this configuration parameter to specify the base URL for any URLs which
* are generated within Nextcloud using any kind of command line tools (cron or
* occ). The value should contain the full base URL:
* ``https://www.example.com/nextcloud``
*
* Defaults to ``''`` (empty string)
*/
'overwrite.cli.url' => 'http://{{inventory_hostname}}',

/**
* To have clean URLs without `/index.php` this parameter needs to be configured.
*


+ 1
- 0
vars/main.yml Ver fichero

@@ -0,0 +1 @@
_nextcloud_config: "{{ _nextcloud_config_cmd.stdout | from_json }}"

Cargando…
Cancelar
Guardar