How to install Second App server backend from occ command

Hi All

Hopefully someone here has been through the same scenario. I am trying to automate my Nextcloud deployment using ansible and a lot of custom configs. Everything is working well so fat, but a little caveat has me stumped.

During the install with a single APP server in the backend, I can run the following command and it works nicely

/bin/php /var/www/html/nextcloud/occ maintenance:install --database "mysql" --database-host "db_server_ip:3306" --database-name "nextcloud" --database-user "my_db_user" --database-pass "my_db_pass" --admin-user "admin" --admin-pass "admin_pass"

But, I won’t be able to run this command on the second app server, because the DB and the admin pass will already be existing, so it will error. How can I “install” the second app server to use the same admin password? My feeling is I can just copy and paste most of the config.php from the first app server over to the second one (if not the whole one?) and it should work? Can anyone maybe point me in the right direction?

Thanks for any help in advance!


No one have any ideas?

My idea would be to just copy the config.php from the primary to the secondary rather than trying to install the secondary via occ.

This doesn’t work, I tried that. But, what I did in the end was to install on the second server, but only specifying the admin password. Then it installs with sqlite. After that, you can just copy the needed stuff from the first app server. Delete the sqlite line of course, but that worked in the end.