Fixed errors in playbook

This commit is contained in:
Jim Martens 2021-11-06 16:14:55 +01:00
parent 5720ea6bce
commit e8fdabc8b5
9 changed files with 70 additions and 52 deletions

View File

@ -1,3 +1,3 @@
--- ---
- name: restart notify_push - name: restart notify_push
ansible.builtin.command: supervisorctl restart notify_push command: supervisorctl restart notify_push

View File

@ -1,21 +1,23 @@
--- ---
- name: install notify_push - name: install notify_push
when: installation.changed
block: block:
- name: install app - name: install app
ansible.builtin.command: command:
chdir: ~/html chdir: ~/html
cmd: php occ app:install notify_push cmd: php occ app:install notify_push
creates: ~/html/apps/notify_push
- name: set permissions - name: set permissions
ansible.builtin.file: file:
path: ~/html/apps/notify_push/x86_64/notify_push path: ~/html/apps/notify_push/bin/x86_64/notify_push
mode: 0744 mode: 0744
- name: create symlink - name: create symlink
ansible.builtin.file: file:
path: ~/bin/notify_push path: ~/bin/notify_push
src: ~/html/apps/notify_push/x86_64/notify_push src: ~/html/apps/notify_push/bin/x86_64/notify_push
state: link state: link
- name: create service - name: create service
ansible.builtin.template: template:
src: notify_push_service.j2 src: notify_push_service.j2
dest: ~/etc/services.d/notify_push.ini dest: ~/etc/services.d/notify_push.ini
mode: 0644 mode: 0644
@ -23,19 +25,21 @@
- reload supervisorctl - reload supervisorctl
- update supervisorctl - update supervisorctl
- name: get backend list - name: get backend list
ansible.builtin.command: uberspace web backend list command: uberspace web backend list
register: backends register: backends
- name: add backend - name: add backend
when: backend.stdout.find('http:7867') == -1 when: backends.stdout.find('http:7867') == -1
ansible.builtin.command: uberspace web backend set /push --http --port 7867 command: uberspace web backend set /push --http --port 7867
- name: get ip route - name: get ip route
ansible.builtin.command: ip route command: /usr/sbin/ip route
register: ip register: ip
- name: set trusted proxies - name: set trusted proxies
ansible.builtin.command: command:
chdir: ~/html chdir: ~/html
cmd: php occ config:system:set trusted_proxies 0 --value="{{ ip.stdout.split().8 }}" cmd: php occ config:system:set trusted_proxies 0 --value="{{ ip.stdout.split().15 }}"
- name: Flush handlers
meta: flush_handlers
- name: configure notify_push app with backend - name: configure notify_push app with backend
ansible.builtin.command: command:
chdir: ~/html chdir: ~/html
cmd: php occ notify_push:setup https://{{ domain }}/push cmd: php occ notify_push:setup https://{{ domain }}/push

View File

@ -1,90 +1,95 @@
--- ---
- name: configure email - name: configure email
when: use_sendmail when: use_sendmail and installation.changed
block: block:
- name: mail_domain - name: mail_domain
ansible.builtin.command: command:
chdir: ~/html chdir: ~/html
cmd: php occ config:system:set mail_domain --value="uber.space" cmd: php occ config:system:set mail_domain --value="uber.space"
- name: mail_from_address - name: mail_from_address
ansible.builtin.command: command:
chdir: ~/html chdir: ~/html
cmd: php occ config:system:set mail_from_address --value="{{ uberspace_user }}" cmd: php occ config:system:set mail_from_address --value="{{ uberspace_user }}"
- name: smtp_mode - name: smtp_mode
ansible.builtin.command: command:
chdir: ~/html chdir: ~/html
cmd: php occ config:system:set mail_smtpmode --value="sendmail" cmd: php occ config:system:set mail_smtpmode --value="sendmail"
- name: sendmail_mode - name: sendmail_mode
ansible.builtin.command: command:
chdir: ~/html chdir: ~/html
cmd: php occ config:system:set mail_sendmailmode --value="pipe" cmd: php occ config:system:set mail_sendmailmode --value="pipe"
- name: initialize URL rewriting - name: initialize URL rewriting
when: installation.changed
block: block:
- name: rewrite base - name: rewrite base
ansible.builtin.command: command:
chdir: ~/html chdir: ~/html
cmd: php occ config:system:set htaccess.RewriteBase --value='/' cmd: php occ config:system:set htaccess.RewriteBase --value='/'
- name: update htaccess - name: update htaccess
ansible.builtin.command: command:
chdir: ~/html chdir: ~/html
cmd: php occ maintenance:update:htaccess cmd: php occ maintenance:update:htaccess
- name: initialize cronjob - name: initialize cronjob
when: installation.changed
block: block:
- name: update crontab - name: update crontab
ansible.builtin.cron: cron:
name: nextcloud-cron name: nextcloud-cron
state: present state: present
job: php -f $HOME/html/cron.php > $HOME/logs/nextcloud-cron.log 2>&1 job: php -f $HOME/html/cron.php > $HOME/logs/nextcloud-cron.log 2>&1
minute: */5 minute: "*/5"
- name: use cronjob for background - name: use cronjob for background
ansible.builtin.command: command:
chdir: ~/html chdir: ~/html
cmd: php occ background:cron cmd: php occ background:cron
- name: set up redis - name: set up redis
when: installation.changed
block: block:
- name: set redis host - name: set redis host
ansible.builtin.command: command:
chdir: ~/html chdir: ~/html
cmd: php occ config:system:set redis host --value="/home/{{ uberspace_user }}/.redis/sock" cmd: php occ config:system:set redis host --value="/home/{{ uberspace_user }}/.redis/sock"
- name: set redis port - name: set redis port
ansible.builtin.command: command:
chdir: ~/html chdir: ~/html
cmd: php occ config:system:set redis port --value=0 cmd: php occ config:system:set redis port --value=0
- name: set redis timeout - name: set redis timeout
ansible.builtin.command: command:
chdir: ~/html chdir: ~/html
cmd: php occ config:system:set redis port --value=1.5 cmd: php occ config:system:set redis timeout --value=1.5
- name: enable file locking - name: enable file locking
ansible.builtin.command: command:
chdir: ~/html chdir: ~/html
cmd: php occ config:system:set filelocking.enabled --value='true' cmd: php occ config:system:set filelocking.enabled --value='true'
- name: use Redis for memcache.locking - name: use Redis for memcache.locking
ansible.builtin.command: command:
chdir: ~/html chdir: ~/html
cmd: php occ config:system:set memcache.locking --value='\OC\Memcache\Redis' cmd: php occ config:system:set memcache.locking --value='\OC\Memcache\Redis'
- name: use Redis for memcache.distributed - name: use Redis for memcache.distributed
ansible.builtin.command: command:
chdir: ~/html chdir: ~/html
cmd: php occ config:system:set memcache.distributed --value='\OC\Memcache\Redis' cmd: php occ config:system:set memcache.distributed --value='\OC\Memcache\Redis'
- name: set default phone region - name: set default phone region
ansible.builtin.command: when: installation.changed
command:
chdir: ~/html chdir: ~/html
cmd: php occ config:system:set default_phone_region --value='{{ phone_region }}' cmd: php occ config:system:set default_phone_region --value='{{ phone_region }}'
- name: perform database maintenance - name: perform database maintenance
when: installation.changed
block: block:
- name: add missing indices - name: add missing indices
ansible.builtin.command: command:
chdir: ~/html chdir: ~/html
cmd: php occ db:add-missing-indices --no-interaction cmd: php occ db:add-missing-indices --no-interaction
- name: add missing columns - name: add missing columns
ansible.builtin.command: command:
chdir: ~/html chdir: ~/html
cmd: php occ db:add-missing-columns --no-interaction cmd: php occ db:add-missing-columns --no-interaction
- name: add missing primary keys - name: add missing primary keys
ansible.builtin.command: command:
chdir: ~/html chdir: ~/html
cmd: php occ db:add-missing-primary-keys --no-interaction cmd: php occ db:add-missing-primary-keys --no-interaction
- name: convert filecache bigint - name: convert filecache bigint
ansible.builtin.command: command:
chdir: ~/html chdir: ~/html
cmd: php occ db:convert-filecache-bigint --no-interaction cmd: php occ db:convert-filecache-bigint --no-interaction

View File

@ -1,17 +1,18 @@
--- ---
- name: download Nextcloud and extract archive - name: download Nextcloud and extract archive
ansible.builtin.unarchive: unarchive:
src: https://download.nextcloud.com/server/releases/latest.tar.bz2 src: https://download.nextcloud.com/server/releases/latest.tar.bz2
dest: ~/ dest: ~/
remote_src: yes remote_src: yes
creates: ~/nextcloud creates: ~/nextcloud
register: nextcloud_archive register: nextcloud_archive
- name: copy files to web root - name: copy files to web root
ansible.builtin.copy: copy:
src: ~/nextcloud/ src: ~/nextcloud/
dest: ~/html dest: ~/html
remote_src: yes remote_src: yes
when: nextcloud_archive is successful
- name: remove nocontent.html - name: remove nocontent.html
ansible.builtin.file: file:
path: ~/html/nocontent.html path: ~/html/nocontent.html
state: absent state: absent

View File

@ -1,4 +1,4 @@
--- ---
- name: create MySQL database - name: create MySQL database
community.mysql.mysql_db: community.mysql.mysql_db:
name: "{{ uberspace_user }}"_nextcloud name: "{{ uberspace_user }}_nextcloud"

View File

@ -1,27 +1,27 @@
--- ---
- name: enable PHP opcache - name: enable PHP opcache
ansible.builtin.template: template:
src: opcache.j2 src: opcache.j2
dest: ~/etc/php.d/opcache.ini dest: ~/etc/php.d/opcache.ini
mode: 0644 mode: 0644
notify: notify:
- restart php - restart php
- name: enable PHP APCu - name: enable PHP APCu
ansible.builtin.template: template:
src: apcu.j2 src: apcu.j2
dest: ~/etc/php.d/apcu.ini dest: ~/etc/php.d/apcu.ini
mode: 0644 mode: 0644
notify: notify:
- restart php - restart php
- name: set PHP memory limit to 512 MB - name: set PHP memory limit to 512 MB
ansible.builtin.template: template:
src: memory_limit.j2 src: memory_limit.j2
dest: ~/etc/php.d/memory_limit.ini dest: ~/etc/php.d/memory_limit.ini
mode: 0644 mode: 0644
notify: notify:
- restart php - restart php
- name: disable PHP output buffering - name: disable PHP output buffering
ansible.builtin.template: template:
src: output_buffering.j2 src: output_buffering.j2
dest: ~/etc/php.d/output_buffering.ini dest: ~/etc/php.d/output_buffering.ini
mode: 0644 mode: 0644

View File

@ -1,11 +1,11 @@
--- ---
- name: create update script - name: create update script
ansible.builtin.template: template:
src: update.j2 src: update.j2
dest: ~/bin/nextcloud-update dest: ~/bin/nextcloud-update
mode: 0744 mode: 0744
- name: create cronjob for updates - name: create cronjob for updates
ansible.builtin.cron: cron:
name: nextcloud-update name: nextcloud-update
state: present state: present
job: $HOME/bin/nextcloud-update > $HOME/logs/nextcloud-update.log 2>&1 job: $HOME/bin/nextcloud-update > $HOME/logs/nextcloud-update.log 2>&1

View File

@ -1,26 +1,34 @@
--- ---
- name: run installation script - name: run installation script
ansible.builtin.command: command:
chdir: ~/html chdir: ~/html
cmd: php occ maintenance:install --admin-user "{{ nextcloud_admin_user }}" --admin-pass "{{ nextcloud_admin_password }}" --database 'mysql' --database-name "{{ uberspace_user }}_nextcloud" --database-user "{{ uberspace_user }}" --database-pass "{{ mysql_password }}" --data-dir "/home/{{ uberspace_user }}/nextcloud_data" cmd: php occ maintenance:install --admin-user "{{ nextcloud_admin_user }}" --admin-pass "{{ nextcloud_admin_password }}" --database 'mysql' --database-name "{{ uberspace_user }}_nextcloud" --database-user "{{ uberspace_user }}" --database-pass "{{ mysql_password }}" --data-dir "/home/{{ uberspace_user }}/nextcloud_data"
creates: ~/nextcloud_data creates: ~/nextcloud_data
register: installation
- name: set domain as trusted - name: set domain as trusted
ansible.builtin.command: command:
chdir: ~/html chdir: ~/html
cmd: php occ config:system:set trusted_domains 0 --value="{{ domain }}" cmd: php occ config:system:set trusted_domains 0 --value="{{ domain }}"
when: installation.changed
- name: set domain as overwrite cli url - name: set domain as overwrite cli url
ansible.builtin.command: command:
chdir: ~/html chdir: ~/html
cmd: php occ config:system:set overwrite.cli.url --value="https://{{ domain }}" cmd: php occ config:system:set overwrite.cli.url --value="https://{{ domain }}"
when: installation.changed
- name: create symlinks for logs - name: create symlinks for logs
when: installation.changed
block: block:
- name: symlink for nextcloud log - name: symlink for nextcloud log
ansible.builtin.file: file:
path: ~/logs/nextcloud.log path: ~/logs/nextcloud.log
src: ~/nextcloud_data/nextcloud.log src: ~/nextcloud_data/nextcloud.log
state: link state: link
- name: touch updater.log
file:
path: ~/nextcloud_data/updater.log
state: touch
- name: symlink for nextcloud updater log - name: symlink for nextcloud updater log
ansible.builtin.file: file:
path: ~/logs/nextcloud-updater.log path: ~/logs/nextcloud-updater.log
src: ~/nextcloud_data/updater.log src: ~/nextcloud_data/updater.log
state: link state: link

View File

@ -1,5 +1,5 @@
[program:redis] [program:redis]
command=redis-server %(ENV_HOME)s/.redis/conf command=redis-server %(ENV_HOME)s/.redis/config
directory=%(ENV_HOME)s/.redis directory=%(ENV_HOME)s/.redis
autostart=yes autostart=yes
autorestart=yes autorestart=yes