Git initial commit

This commit is contained in:
lhahn committed 2023-08-20 10:31:11 +02:00
commit 43fa522fa6
11 files changed
+371

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
---
- name: install coturn server
apt:
update_cache: yes
state: "{% if cloud_update | bool %}latest{% else %}present{% endif %}"
install_recommends: yes
pkg:
- "coturn"
- name: enable coturn server
lineinfile:
path: "/etc/default/coturn"
regexp: '^#?TURNSERVER_ENABLED='
line: "TURNSERVER_ENABLED=1"
notify: restart coturn
- name: enable coturn server
lineinfile:
path: "/etc/turnserver.conf"
regexp: '^#?{{ configline.split("=")[0] }}{% if configline.split("=") | length > 1 %}={% endif %}'
line: "{{ configline }}"
loop: "{{ coturn_configs }}"
loop_control:
loop_var: configline
label: "{{ configline }}"
notify: restart coturn
- name: set coturn capabilities for port setting
capabilities:
path: /usr/bin/turnserver
capability: cap_net_bind_service=+ep
state: present
+44
View File
@@ -0,0 +1,44 @@
---
- name: install notify_push
command:
chdir: "{{ ncloud_dir }}"
creates: "{{ ncloud_dir }}/apps/notify_push"
cmd: php occ app:install notify_push
become: yes
become_user: "{{ www_group }}"
notify: setup notify_push
register: notify_push
- name: enable notify_push
command:
chdir: "{{ ncloud_dir }}"
creates: "{{ ncloud_dir }}/apps/notify_push"
cmd: php occ app:enable notify_push
become: yes
become_user: "{{ www_group }}"
when: notify_push.changed
- name: configure trusted proxies
blockinfile:
marker: "// {mark} ANSIBLE MANAGED BLOCK"
path: "{{ ncloud_dir }}/config/config.php"
block: |
'trusted_proxies' =>
array (
{% for proxy in ncloud_notify_trusted_proxies %}
{{ loop.index - 1}} => '{{ proxy }}',
{% endfor %}
),
insertbefore: "\\);"
- name: setup notify_push systemd unit
template:
src: etc/systemd/system/notify_push.service.j2
dest: /etc/systemd/system/notify_push.service
- name: enable notify_push systemd unit
systemd:
name: notify_push
enabled: yes
daemon_reload: yes
state: started
Executable
+46
View File
@@ -0,0 +1,46 @@
---
- name: setup nextcloud group
group:
name: "{{ ncgrp }}"
state: "present"
- name: setup nextcloud user
user:
name: "{{ ncusr }}"
group: "{{ ncgrp }}"
groups:
- "{{ ncgrp }}"
comment: Virtual Nextcloud User
shell: /sbin/nologin
state: present
- name: setup nextcloud storage folder
file:
path: "{{ ncloud_data_location }}"
state: directory
owner: "{{ www_group }}"
group: "{{ ncgrp }}"
mode: "o="
- name: install nextcloud recommendations
apt:
update_cache: yes
state: "{% if cloud_update | bool %}latest{% else %}present{% endif %}"
install_recommends: yes
pkg:
- "libxml2"
- "openssl"
- "ffmpeg"
- "libreoffice"
- "redis-server"
- "unzip"
- name: install basic nextcloud
include_tasks: nextcloud.yml
- name: install notify_push (file high-performance-backend)
include_tasks: file_hpb.yml
- name: install coturn server
include_tasks: coturn.yml
+111
View File
@@ -0,0 +1,111 @@
---
- name: download nextcloud and unarchive
unarchive:
src: "https://download.nextcloud.com/server/releases/nextcloud-{{ nextcloud_version }}.zip"
dest: "{{ cloud_apps }}"
remote_src: yes
owner: "{{ www_group }}"
group: "{{ ncgrp }}"
mode: "o="
creates: "{{ ncloud_dir }}"
- name: install nextcloud
command:
chdir: "{{ ncloud_dir }}"
creates: "{{ ncloud_data_location }}/index.html"
cmd: >
php occ maintenance:install
--database '{{ ncloud_db.type }}'
--database-name '{{ ncloud_db.name }}'
--database-user '{{ ncloud_db.user }}'
--database-pass '{{ ncloud_db.pass }}'
--admin-user '{{ ncloud_admin_user }}'
--admin-pass '{{ ncloud_admin_pass }}'
--data-dir '{{ ncloud_data_location }}'
become: yes
become_user: "{{ www_group }}"
register: ncloud_installation
- name: set nextcloud folder permission
file:
path: "{{ ncloud_data_location }}"
owner: "{{ www_group }}"
group: "{{ ncusr }}"
mode: "o="
recurse: yes
- name: configure php cron jobs
cron:
name: nextcloud-php
minute: "*/5"
job: "php -f {{ ncloud_dir }}/cron.php"
user: "{{ www_group }}"
- name: configure local memory caching APCu
lineinfile:
path: "{{ ncloud_dir }}/config/config.php"
regexp: "\\s*'memcache.local' => "
line: " 'memcache.local' => '\\OC\\Memcache\\APCu',"
insertbefore: "\\);"
when: ncloud_installation.changed
- name: configure redis conig
lineinfile:
path: "/etc/redis/redis.conf"
regexp: "(# |){{ item.key }} "
line: "{{ item.key }} {{ item.value }}"
loop:
- key: unixsocket
value: "{{ redis_socket }}"
- key: unixsocketperm
value: 775
- key: bind
value: 127.0.0.1
- key: daemonize
value: !unsafe yes
- key: stop-writes-on-bgsave-error
value: !unsafe no
- key: rdbcompression
value: !unsafe yes
- key: maxmemory
value: 50M
- key: maxmemory-policy
value: allkeys-lru
when: redis_remote_url | length == 0
notify: restart redis
- name: configure distributed memory caching APCu
lineinfile:
path: "{{ ncloud_dir }}/config/config.php"
regexp: "\\s*'{{ item.key }}' => "
line: " '{{ item.key }}' => {{ item.value }},"
insertbefore: "\\);"
loop:
- key: memcache.locking
value: "'\\OC\\Memcache\\Redis'"
# - key: memcache.distributed
# value: "'\\OC\\Memcache\\Redis'"
# - key: redis
# value: "['host' => '{% if redis_remote_url | length > 0 %}{{ redis_remote_url }}{% else %}{{ redis_socket }}{% endif %}','port' => {% if redis_remote_url | length > 0 %}{{ redis_port }}{% else %}0{% endif %}]"
loop_control:
label: "{{ item.key }}"
when: ncloud_installation.changed
- name: configure other settings
lineinfile:
path: "{{ ncloud_dir }}/config/config.php"
regexp: "\\s*'{{ item.key }}' => "
line: " '{{ item.key }}' => {{ item.value }},"
insertbefore: "\\);"
loop: "{{ ncloud_config }}"
loop_control:
label: "{{ item.key }}"
when: ncloud_installation.changed
- name: configure nextcloud domain
replace:
path: "{{ ncloud_dir }}/config/config.php"
regexp: "^\\s*'trusted_domains'\\s*=>\\s*array\\s*\\((.*\\n)+\\s*\\),$"
replace: " 'trusted_domains' => \\n array ({% for domain in ncloud_domain %}\\n {{ loop.index - 1}} => '{{ domain }}',{% endfor %}\\n ),"
when: ncloud_installation.changed