Compare commits

..

2 Commits

Author SHA1 Message Date
b77d148e6e testing 2024-03-26 23:46:29 -04:00
6fbd3c53bb
Add Vagrant cache option for dhparams.pem 2024-03-26 21:51:39 -04:00
4 changed files with 26 additions and 18 deletions

View File

@ -44,9 +44,8 @@ traefik:
# nextcloud
nextcloud:
DB_NAME: nextcloud
DB_USER: nextcloud
DB_PASSWD: password
ADMIN_PASSWD: password
# nextcloud
#nextcloud_version: stable

View File

@ -5,17 +5,17 @@
- name: Create Nextcloud database
community.mysql.mysql_db:
name: "{{ nextcloud.DB_NAME }}"
name: "{{ nextcloud.DB_NAME | default('nextcloud') }}"
state: present
login_unix_socket: /var/run/mysqld/mysqld.sock
- name: Create Nextcloud database user
community.mysql.mysql_user:
name: "{{ nextcloud.DB_USER }}"
name: "{{ nextcloud.DB_USER | default('nextcloud') }}"
password: "{{ nextcloud.DB_PASSWD }}"
host: '%'
state: present
priv: "{{ nextcloud.DB_NAME }}.*:ALL"
priv: "{{ nextcloud.DB_NAME | default('nextcloud') }}.*:ALL"
login_unix_socket: /var/run/mysqld/mysqld.sock
- name: Start Nextcloud service and enable on boot
@ -32,9 +32,8 @@
- name: Wait for Nextcloud to become available
ansible.builtin.wait_for:
#debug:
#host: "{{ nextcloud_info.container.NetworkSettings.Networks.traefik.IPAddress }}"
#var: nextcloud_info.container.NetworkSettings
host: "{{ nextcloud_info.container.NetworkSettings.Networks.traefik.IPAddress }}"
delay: 10
port: 80
- name: Check Nextcloud status
@ -43,20 +42,16 @@
register: nextcloud_status
changed_when: false
- name: Check status return
debug:
var: nextcloud_status.stderr[:26]
- name: Install Nextcloud
ansible.builtin.command: 'docker exec --user www-data {{ nextcloud_name }}
php occ maintenance:install
--database "mysql"
--database-host "{{ nextcloud_dbcontainer }}"
--database-name "{{ nextcloud_dbname }}"
--database-user "{{ nextcloud_dbuser }}"
--database-pass "{{ nextcloud_dbpass }}"
--admin-user "{{ nextcloud_admin }}"
--admin-pass "{{ nextcloud_pass }}"'
--database-host "{{ nextcloud.DB_HOST | default(''host.docker.internal'') }}"
--database-name "{{ nextcloud.DB_NAME | default(''nextcloud'') }}"
--database-user "{{ nextcloud.DB_USER | default(''nextcloud'') }}"
--database-pass "{{ nextcloud.DB_PASSWD }}"
--admin-user "{{ nextcloud.ADMIN_USER | default(''admin'') }}"
--admin-pass "{{ nextcloud.ADMIN_PASSWD }}"'
register: nextcloud_install
when: nextcloud_status.stderr[:26] == "Nextcloud is not installed"

View File

@ -0,0 +1 @@
cached_dhparams_pem: /vagrant/scratch/dhparams.pem

View File

@ -10,6 +10,19 @@
state: started
enabled: true
- name: Check for cached dhparams.pem file
ansible.builtin.stat:
path: "{{ cached_dhparams_pem }}"
register: dhparams_file
- name: Copy cached dhparams.pem to /etc/ssl/
ansible.builtin.copy:
src: "{{ cached_dhparams_pem }}"
dest: /etc/ssl/dhparams.pem
mode: "600"
remote_src: true
when: dhparams_file.stat.exists
- name: Generate DH Parameters
community.crypto.openssl_dhparam:
path: /etc/ssl/dhparams.pem