Skip to content

WebService

Aurélien LEQUOY edited this page Jul 12, 2023 · 6 revisions

Ajouter un utilisateur pour le webservice

cat > /tmp/webservice.json << EOF

{
"webservice": [{
    "user": "webservice",
    "host": "%",
    "password": "my_secret_password",
    "organization": "68Koncept"
  }]
}
EOF

then execute the command :

./glial Webservice addAccount /tmp/webservice.json --debug

Une fois excuter vous devez voir la ligne dans la table :


MariaDB [pmacontrol]> SELECT * FROM `webservice_user`;
+----+-----------+------+------+------------------------------------------------------------------------------------------+------------+
| id | id_client | user | host | password                                                                                 | is_enabled |
+----+-----------+------+------+------------------------------------------------------------------------------------------+------------+
|  1 |         2 | salt | %    | 3mVA2E0_DjWzECMA9uRmVMAPiVXdVCIjTfNHOGc3YLSkx8dc83tDZe9wnK3YhJMWTmpkMZMxSnZTVFZrZUV3Mz,, |          1 |
+----+-----------+------+------+------------------------------------------------------------------------------------------+------------+
1 row in set (0.000 sec)


Ajouter automatiquement un server MySQL via le webservice

Le fichier password : /tmp/password.tmp

user=name_uwer:secret_password

Le fichier json : (config.json)

{
        "mysql": [{
                "fqdn": "www.google.com",
                "display_name": "@hostname",
                "port": "3306",
                "login": "pmacontrol",
                "password": "secret_password",
                "tag": ["text","datacenter1"],
                "organization": "68Koncept",
                "environment": "test",
                "ssh_ip": "10.10.1.1",
                "ssh_port": "22"
        }],
        "haproxy": [{
                "fqdn": "my.haproxy.com",
                "port": "3307",
                "organization": "68Koncept",
                "tag": ["text","datacenter1"],
                "environment": "test",
                "stats": {
                        "path": "\/haproxy_stats;csv",
                        "port": "9000",
                        "login": "haproxy",
                        "password": "secret_password"
                }
        }]
}

La commande :

curl -v -K /tmp/password.tmp -F 'conf=@/tmp/config.json' "www.pmacontrol.com/en/webservice/pushServer"

if you are on the server of PmaControl :

pmacontrol webservice importFile config.json




Demo

Clone this wiki locally