# Deploy via GlpiInventory

## Plugin GLPI Inventory

{% hint style="info" %}
**Information**

&#x20;The GLPI Inventory plugin is available in the menu **`Administration`** > **`GLPI Inventory`**\
If it is not installed, please go to the **marketplace**, and install the GLPI Inventory plugin

\
![Alt text](https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-bebdcd7a6d61d2ae847303ed728a772ad3cbfa14%2Finventaire_pc-1.png?alt=media)
{% endhint %}

Software deployment configuration can be done in three steps:

1. determination of files and / or commands to deploy
2. determination of deployment targets
3. deployment itself

{% hint style="success" %}
**Recommendation**

We recommend using the URL `https://`*`my_instance`*`/marketplace/glpiinventory` for your GLPI agents to ensure proper application deployment.

<img src="https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2FjxGVLPNZM58a5l7D44BA%2Furl_agent.png?alt=media&#x26;token=4fc5d5b5-c51d-46be-8a04-8079f97b42b2" alt="" data-size="original">
{% endhint %}

## Files

* Go to **`Administration`** > **`GLPI Inventory`**
* In the tab **`Deploy`** > **`Package management`**
* Create a new package with **`add`**
* Name it
* **`Add`**

In this newly created package, in the **`Actions on package`** tab we need to configure the four parts that form a package:

* Audits
* Files
* Actions
* User interactions

Each part is configured via small icon

***

### Audits

It is possible to perform checks before starting the package installation process. This part is not essential but may be necessary for optimal deployment.

* Registry check (Windows only)

<div align="left"><img src="https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-0d755385627e06608a34e108d519d6766323d61f%2Fglpiinventory_deploy-2.png?alt=media" alt="Alt text"></div>

* Verification of files (all OS)
* Checking free disk space (all OS)

<div align="left"><img src="https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-869722962a49d92fb5a21119ae227dae423b9030%2Fglpiinventory_deploy-3.png?alt=media" alt="Alt text"></div>

If the audit fails, the following options are available:

* **`stop the process`**: do not continue checking, and skip the deployment process
* **`skip the process`**: do not continue the process and pass the deployment successfully (package already installed)
* **`report information`**: checks continue, failure is reported to the central console
* **`report warning`**: checks continue, a warning appears on the central console

***

### Files

In this part, you have to select the data (files) that will be deployed.

Two possible options:

* Download from your computer (pay attention to the maximum size allowed): if you want to upload larger size, please contact Cloud Support.

The administrator can select the files from his computer.

![Alt text](https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-fb05e94fa721be2a2762659acf87f84947d43ed8%2Fglpiinventory_deploy-4.png?alt=media)

Import options are available for each file:

* **`Unzip`**: the agent can decompress zip or tar.gz archives
* **`P2P`**: indicates whether the file fragments may be available via P2P or only via the server
* **`Retention time`**: during a P2P move, the number of minutes within which the
* Downloaded fragment is available to other agents in the subnet

Download from the server (not available in Cloud environment at the moment)

***

### Actions

Once the files to download are defined, it is necessary to define which actions have to be executed on it or not.

The actions are executed after successful download of the file (s). Here are their types:

* execute an order
* create or delete directory
* move or copy a file

As an example, installation of Firefox :

![Alt text](https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-06711e77dbbf0d8d177141fdd5559a82b1b2804c%2Fglpiinventory_deploy-5.png?alt=media)

A mechanism makes it possible to check whether the execution of command has passed correctly. To do this, you can test:

* the return code of the order
* standard output command

<div align="left"><img src="https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-2ad28de7b4fa257bc064e10662783516bb6ef654%2Fglpiinventory_deploy-6.png?alt=media" alt="Alt text"></div>

***

### User interactions

This feature is not mandatory.

The administrator can decide if to interact with user in deployment process:

* after the execution of audits
* after downloading files
* after the actions
* in case the file download failed
* in case the execution of actions has failed

This functionality is divided into two parts:

* Definition of interaction model

Model records he characteristics of an interaction to be reused next time. It describes both the type of window shown to the user and its behaviour.

The models are accessible via **`Administration`** > **`GLPI Inventory`** > **`Deploy`** > **`user interaction templates`**

Example:

<div align="left"><img src="https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-41caa0b78e66c0fc752c06bb75856c677861c84e%2Fglpiinventory_deploy-7.png?alt=media" alt="Alt text"></div>

Model has :

* a name
* an interaction formation (Windows WTS only)
* a type of interaction: definition of the buttons accessible on the window
* whether or not an icon is displayed
* a number of possible postponements of an interaction
* the time between 2 interaction requests from the user

Then, you must define what would be the behaviour of the system according to the different behaviours adopted by the user, via the Behaviours tab.

![Alt text](https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-0af79b2fff5c9189a83b5268d3b34ec49d5dbedc%2Fglpiinventory_deploy-8.png?alt=media)

Three types of behaviour are possible for each action:

* continue the deployment process
* stop it
* try it again later

Certain events are pre-defined, regardless of the type of choice that the user makes:

* Behaviour in case of no active session
* Behaviour in case of several active sessions (TSE)
* Behaviour in case of the window display time is exceeded (automatic closing)
* Applying the template for package event Once the template is configured, it must be applied.

Going back to our package, select **`Actions on the package`** tab in the **`User Interactions`** section.

The administrator defines the title and content of the window that will be displayed to the user.

<div align="left"><img src="https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-394a210ea999289d25880348c10c0593047a7c73%2Fglpiinventory_deploy-9.png?alt=media" alt="Alt text"></div>

***

### Deployment targets

Once the package is defined, you must define on which workstation (s) it will be installed.

GLPI Inventory offers several types of targets:

* a particular computer
* a computer group based on GLPI group
* a group of GLPI Inventory computers

Usually we mainly use GLPI Inventory groups, which are either static or dynamic.

This configuration is carried out from the **`Administration`** > **`GLPI Inventory`** > **`General`** > **`Computer group`** menu.

***

#### Static groups

A static group contains machines that have been selected by the administrator. It does not change over time, unless the administrator adds / removes machines.

***

**Create a static group**

* From **`Administration`** > **`GLPI Inventory`** > **`General`** > **`Computer groups`**
* Click on **`Add`**
* Name your group
* Choose **`Static group`**
* In the **`Criteria`** tab, select the information you want in the search (here we will indicate all jobs located in Paris)
* You can add as many criteria as you like, paying attention to the logical operator (and, or, and not, or not). You can create global rules (entity criteria, user criteria, application criteria, etc.) and/or create groups of criteria (for example, all PCs whose name is Microsoft, whose name contains commerce, with an active status, connected to the switch on the 3rd floor. All these criteria must be met for the PC to be included in the dynamic group).
* Click on **`Preview`** to see the list of workstations appear
* Select the workstations concerned
* Use the **`Actions`** button to add them to the static group
* The search results will appear in **`Associated Items`**.

***

#### Dynamic groups.

A dynamic group is the result of a search engine query. The machines in the group are calculated and the list varies over time.

***

**Create a dynamic group**

* From **`Administration`** > **`GLPI Inventory`** > **`General`** > **`Computer groups`**
* Click on **`Add`**
* Name your group
* Choose **`Dynamic Group`**
* In the **`Criteria`** tab, select the desired information in the search (here we will indicate all workstations whose OS name contains Microsoft and are located in Barcelona).
* You can add as many criteria as you like, paying attention to the logical operator (and, or, and not, or not). You can create global rules (entity criteria, user criteria, application criteria, etc.) and/or create groups of criteria (for example, all PCs whose name is Microsoft, whose name contains commerce, with an active status, connected to the switch on the 3rd floor. All these criteria must be met for the PC to be included in the dynamic group).
* Click on **`Save`**.
* The results of the search will appear in **`Associated items`**.

![Alt text](https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-f7c3140b277dd3d36c179d19d2f04b84c6eb0930%2Fglpiinventory_deploy-10.png?alt=media)

Your group is created. If you wish, you can transform it into a static group using the **`Actions`** menu.

![Alt text](https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-16f248a813aa78d1c662c37461fdfdb784cc0669%2Fglpiinventory_deploy-10bis.png?alt=media)

{% hint style="success" %}
**Dynamic groups <-> static groups**

You can change the group type from dynamic to static at any time by modifying it directly in the group parameters

![Alt text](https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-50a7f0f3cabee6a105f0f611d637c31aa5358baf%2Fglpiinventory_deploy-10ter.png?alt=media)
{% endhint %}

## Deployment

***

### Tasks

Package deployment is done by adding dedicated tasks. Tasks are accessible via **`Administration`** > **`GLPI Inventory`** > **`Tasks`** > **`Task management`**.

A deployment task can contain several jobs, which are several actions that agent will execute one after the another.

A task is divided into 3 stages:

* **`preparation`**: it is the stage of calculation of targets for which the task must be executed
* **`execution`**: it is the stage of sending deployment order from the server to the agent
* **`the follow-up`**: it is the stage of display of the follow-up of deployment After creating a task, make it active and define its execution.

It is possible to indicate range of validity of task:

* **`scheduled start time`**: start preparation actions from this date
* **`scheduled end time`**: stop the validation of task after this date

![Alt text](https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-bcdc3b0c00714eb0e76d662b1dbbfea3f820ec5a%2Fglpiinventory_deploy-11.png?alt=media)

{% hint style="warning" %}
**Automatic actions**

Check if **`Taskscheduler`** automatic action is correctly configured
{% endhint %}

***

### Jobs

In the task, in the **`Job configuration tab`**.

A job is an action to deploy a package to computer or a set of computers.

{% hint style="warning" %}
**Information**

Make sure that the remote deployment module is activated for each agent. It is possible to activate the module by default in the general configuration of GLPI Inventory
{% endhint %}

A job contains:

* **`Method`** (package deployment here)
* **`Targets`** (package to deploy)
* **`Actors`** (target groups)

![Alt text](https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-a882c3c2e1c9ee5d7fad2f1f967a0333d4d1a1db%2Fglpiinventory_deploy-12.png?alt=media)

{% hint style="info" %}
**Information**

The task is triggered when the agent on the target PC contacts the server. The server then sends its deployment task and performs the programmed actions
{% endhint %}

![Alt text](https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-c83cf3621679dc18ff6a16a74375879fa260da69%2Fglpiinventory_deploy-13.png?alt=media)

Deployment is monitored either in the **`Job execution tab`** of a task, or via the **`Administration`** > **`GLPI Inventory`** > **`Tasks`** > **`Monitoring / Logs`** menu.

![Alt text](https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-c5d1e79dd5ad2bae6798dd269de99b6eb1d6d38e%2Fglpiinventory_deploy-14.png?alt=media)
