Stelle auf zentrale Instanzen-Verwaltung um

This commit is contained in:
phil 2021-06-26 01:14:24 +02:00
parent 212d7d950c
commit e63c995f11
5 changed files with 28 additions and 27 deletions

View file

@ -13,5 +13,5 @@
lineinfile:
path: /etc/apache2/conf-available/nextcloud_sites.conf
insertafter: "^Ansbile"
line: "Use NCSite {{ nextcloud_domain }} {{ common_name }}"
line: "Use NCSite {{ domain }} {{ user }}"
notify: reload apache

View file

@ -1,7 +1,7 @@
---
- name: "Datenbank einrichten"
mysql_db:
name: '{{ nextcloud_mysql_db }}'
name: "{{ database }}"
state: present
login_unix_socket: "{{ mysql_socket }}"
login_user: root
@ -10,10 +10,10 @@
- name: "Datenbank Benutzer einrichten"
mysql_user:
name: "{{ nextcloud_mysql_user }}"
host: "{{ nextcloud_host }}"
password: "{{ lookup('password', '/tmp/passwordfile chars=ascii_letters') }}"
priv: "{{ nextcloud_mysql_db }}.*:ALL"
name: "{{ database }}"
host: "{{ inventory_hostname }}"
password: "{{ lookup('password', '/tmp/nc_db_password chars=ascii_letters') }}"
priv: "{{ database }}.*:ALL"
state: present
login_unix_socket: "{{ mysql_socket }}"
login_user: root

View file

@ -3,27 +3,27 @@
lineinfile:
path: /etc/dehydrated/domains.txt
insertafter: "^# nextcloud"
line: "{{ nextcloud_domain }}"
line: "{{ domain }}"
# when: dehydrated_installiert
delegate_to: "{{ nextcloud_gateway }}"
delegate_to: "{{ gateway_host }}"
- name: "Gateway Zertifikat erstellen"
command: dehydrated --cron -g
delegate_to: "{{ nextcloud_gateway }}"
delegate_to: "{{ gateway_host }}"
- name: "Gateway Proxy einrichten"
template:
src: nginx_site.j2
dest: "/etc/nginx/sites-available/{{ nextcloud_domain }}"
dest: "/etc/nginx/sites-available/{{ domain }}"
owner: root
group: root
mode: 0644
delegate_to: "{{ nextcloud_gateway }}"
delegate_to: "{{ gateway_host }}"
- name: "Gateway Seite aktivieren"
file:
src: "/etc/nginx/sites-available/{{ nextcloud_domain }}"
dest: "/etc/nginx/sites-enabled/{{ nextcloud_domain }}"
src: "/etc/nginx/sites-available/{{ domain }}"
dest: "/etc/nginx/sites-enabled/{{ domain }}"
state: link
notify: reload nginx
delegate_to: "{{ nextcloud_gateway }}"
delegate_to: "{{ gateway_host }}"

View file

@ -13,40 +13,41 @@
extra_opts:
- "--strip-components=1"
dest: "{{ nextcloud_install_path }}"
owner: "{{ common_name }}"
group: "{{ common_name }}"
owner: "{{ user }}"
group: "{{ user }}"
mode: 0755
- name: "NC Installation"
command: >
php "{{ nextcloud_install_path }}"/occ maintenance:install --database "mysql"
--database-name "{{ nextcloud_mysql_db }}" --database-user "{{ nextcloud_mysql_user }}"
--database-pass "{{ lookup('password', '/tmp/passwordfile chars=ascii_letters') }}" --database-host "{{ nextcloud_database_host }}"
--database-name "{{ database }}" --database-user "{{ database }}"
--database-pass "{{ lookup('password', '/tmp/nc_db_password chars=ascii_letters') }}" --database-host "{{ database_host }}"
--admin-user "{{ nextcloud_admin_user }}" --admin-pass "{{ nextcloud_admin_pw }}"
become: true
become_user: "{{ common_name }}"
become_user: "{{ user }}"
changed_when: true
#todo: Auch auf instances.alias anwenden
- name: "NC trusted domains einrichten"
command: 'php {{ nextcloud_install_path }}/occ config:system:set trusted_domains {{ item.0 }} --value "{{ item.1 }}"'
become: true
become_user: "{{ common_name }}"
become_user: "{{ name }}"
changed_when: true
with_indexed_items:
- '{{ nextcloud_trusted_domains }}'
- name: "NC cron einrichten"
cron:
name: "nextcloud {{ nextcloud_domain }}"
name: "nextcloud {{ domain }}"
minute: "*/5"
user: "{{ common_name }}"
user: "{{ user }}"
job: "php -f {{ nextcloud_install_path}}/cron.php"
cron_file: "nextcloud"
- name: "NC allgemeie Konfiguration"
command: "{{ item }}"
become: true
become_user: "{{ common_name }}"
become_user: "{{ user }}"
changed_when: true
with_items:
- "php {{ nextcloud_install_path }}/occ app:enable encryption"
@ -54,7 +55,7 @@
- 'php {{ nextcloud_install_path }}/occ config:system:set memcache.local --value "\\OC\\Memcache\\APCu"'
- 'php {{ nextcloud_install_path }}/occ config:system:set memcache.distributed --value "\OC\Memcache\Redis"'
- "php {{ nextcloud_install_path }}/occ background:cron"
- 'php {{ nextcloud_install_path }}/occ config:system:set overwrite.cli.url --value https://{{ nextcloud_domain }}'
- 'php {{ nextcloud_install_path }}/occ config:system:set overwrite.cli.url --value https://{{ domain }}'
- 'php {{ nextcloud_install_path }}/occ config:system:set htaccess.RewriteBase --value /'
- 'php {{ nextcloud_install_path }}/occ maintenance:update:htaccess'
- 'php {{ nextcloud_install_path }}/occ config:system:set default_language --value "de"'
@ -92,7 +93,7 @@
- name: "NC trusted proxies einrichten"
command: 'php {{ nextcloud_install_path }}/occ config:system:set trusted_proxies {{ item.0 }} --value "{{ item.1 }}"'
become: true
become_user: "{{ common_name }}"
become_user: "{{ user }}"
changed_when: true
with_indexed_items:
- '{{ nextcloud_trusted_proxies }}'

View file

@ -2,7 +2,7 @@
- name: "PHP FPM-Nutzer anlegen"
user:
name: "{{ common_name }}"
name: "{{ user }}"
create_home: no
password: "!"
groups: redis
@ -12,7 +12,7 @@
- name: "PHP FPM-Pool einrichten"
template:
src: php_fpm_pool.j2
dest: "/etc/php/{{ php_version }}/fpm/pool.d/{{ common_name }}.conf"
dest: "/etc/php/{{ php_version }}/fpm/pool.d/{{ user }}.conf"
owner: root
group: root
mode: 0644