Hello friends of Piwigo!
I'm trying to do a complete scripted installation of Piwigo using Ansible. As the last step I would like to set the database, db-user, webmaster and so on that you normally set in the first installation screen from the script.
I have found that install.php presents a form, accepts input and then calls itself using POST to process the data collected. Would it be possible and/or advisable to perform this call in my script, e.g. using
> wget --post-data=xx&xxx&yyy http://my.piwigo.site/install.php
(I'm on Linux).
Thanks in advance for any tips, comments or answers :)
Dan
Offline
Turns out that Ansible has a module, ansible.builtin.uri that can be used to do this. This is some code that seems to work:
tasks: - name: Call script INSTALL.PHP to configure Piwigo ansible.builtin.uri: url: "http://mysite.fake/install.php" method: POST body_format: form-urlencoded body: - ['language', 'en_GB'] - ['dbhost', 'localhost'] - ['dbuser', 'somedbuser'] - ['dbpasswd', 'somesecretdbpassword'] - ['dbname', 'somedbname'] - ['prefix', 'piwigo_'] - ['admin_name', 'someadminname'] - ['admin_pass1', 'anothersecretpassword'] - ['admin_pass2', 'anothersecretpassword'] - ['admin_mail', 'bogus@fakemail.nowhere'] - ['install', 'Start+installation'] status_code: 200
In reality I use variables for the values of course. You can probably use curl or wget to get the same effect.
Dan
Last edited by dstahlberg (2023-09-10 08:57:49)
Offline