Page 1 sur 1

Déployer Agent GLPI

Posté : 04 août 2023 - 09:17
par SebR
Bonjour,

Je cherche à déployer l'agent GLPI sur notre réseau. Nous avons essayer avec une GPO mais cela n fonctionne pas.
J'ai essayé de créer un paquet via WAPT mais nous n'arrivons pas à insérer les bons arguments (/qn /i RUNNOW=1 SERVER="htt*://serveur/front/inventory.php" ) dans le py.
On a vu qu'il existait un paquet GLPI dans WAPT mais on ne vois pas comment placer les argument (nom du serveur et le type d'installation).
Auriez vous des idées ou est ce que quelqu'un aurait un exemple pour construire le paquet?
Merci d'avance pour votre aide.
Sebastien

Re: Déployer Agent GLPI

Posté : 04 août 2023 - 13:56
par jorico
Hello Seb,

J'ai installé l'agent GLPI de cette manière sur mon parc, mais je n'ai pas utilisé le paquet du dépot , moi non plus je n'ai pas reussi à intégrer les arguments avec le paquet du store.

J'y ai ajouté des fonctions d'audit pour vérifier l'état du service.

Code : Tout sélectionner

# -*- coding: utf-8 -*-
from setuphelpers import *

r"""
Usable WAPT package functions: install(), uninstall(), session_setup(), audit(), update_package()

"""
# Declaring global variables - Warnings: 1) WAPT context is only available in package functions; 2) Global variables are not persistent between calls

uninstallkey = ['{E1BE6C18-6BF4-1014-844A-F1F114E3EA24}']

def install():
    # Declaring local variables

    # Installing the software
    print("Installing: GLPI-Agent-1.4-x64.msi")
    run(r'MsiExec.exe /i GLPI-Agent-1.4-x64.msi /quiet SERVER=https://xxxxxxxxxxx  ADD_FIREWALL_EXCEPTION=1 SCAN_PROFILES=1 RUNNOW=1')
    print("Installation de GLPI-Agent-1.4 terminée")

def audit():

   if service_is_running('glpi-agent'):
    print("Le service GLPI Agent est démarré")
    return "OK"

   else:
    print("Le service GLPI Agent n'est pas démarré !")
    return "WARNING"

Re: Déployer Agent GLPI

Posté : 16 août 2023 - 10:42
par blemoigne
Bonjour,
Ce serait de cette forme :

Code : Tout sélectionner

# -*- coding: utf-8 -*-
from setuphelpers import *


def install():

    install_msi_if_needed(
        glob.glob("*.msi")[0], properties ='RUNNOW=1 SERVER="htt*://serveur/front/inventory.php"'    )
Bertrand

Re: Déployer Agent GLPI

Posté : 22 août 2023 - 15:51
par SeiyaGame
Bonjour,

Je me permet de proposer ma solution qui, tout en regroupant vos idées, apporte également quelques améliorations :D

Code : Tout sélectionner

# -*- coding: utf-8 -*-

import glob
from setuphelpers import *

# Declaring global variables - Warnings: 1) WAPT context is only available in package functions; 2) Global variables are not persistent between calls

# https://glpi-agent.readthedocs.io/en/latest/installation/windows-command-line.html#command-line-parameters
properties = {
    "RUNNOW": 1,
    "ADDLOCAL": "feat_NETINV,feat_DEPLOY,feat_COLLECT", # ALL Or feat_AGENT,feat_NETINV,feat_DEPLOY,feat_COLLECT,feat_WOL
    "ADD_FIREWALL_EXCEPTION": 1,
    "AGENTMONITOR": 1,
    "SERVER": "http://URL_SERVER/marketplace/glpiinventory/",
}

def install():
    # Declaring local variables
    exe_file = glob.glob("*.msi")[0]

    # Installing the software
    print(f"Installing: {exe_file}")
    install_msi_if_needed(exe_file, properties=properties)

def audit():
    if service_installed("glpi-agent") and service_is_running("glpi-agent"):
        print("Service installed and started!")
        return "OK"
    else:
        print("Service is not installed and started !")
        return "ERROR"