Announcement

  •  » Miscellaneous
  •  » Scripted install including db, db-user etc using POST to INSTALL.PHP ?

#1 2023-09-09 13:14:27

dstahlberg
Member
Stockholm, Sweden
2021-12-10
3

Scripted install including db, db-user etc using POST to INSTALL.PHP ?

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

Code:

> 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

 

#2 2023-09-10 08:54:42

dstahlberg
Member
Stockholm, Sweden
2021-12-10
3

Re: Scripted install including db, db-user etc using POST to INSTALL.PHP ?

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:

Code:

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

 
  •  » Miscellaneous
  •  » Scripted install including db, db-user etc using POST to INSTALL.PHP ?

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact