Variables d’environnement
Configurez AnsibleForms avec des variables d’environnement
Pour les administrateurs qui déploient AnsibleForms : les variables d’environnement que lit le serveur, regroupées par thème.
AnsibleForms se règle avec des variables d’environnement, qu’il tourne avec Docker Compose, sur Kubernetes ou depuis les sources.
D’où viennent les valeurs
Le serveur lit chaque variable depuis la première de ces sources qui la définit, si bien qu’une valeur plus haut dans la liste l’emporte toujours :
- L’environnement du processus :
environment:etenv_file:dans docker-compose (le.envdu projet est transmis ainsi),envetenvFromsur Kubernetes, ou le shell qui lancenode. persistent/.env, le fichier qu’écrivent les pages de paramètres (data/.envdans le projet docker-compose, un autre chemin avecMANAGED_ENV_PATH). Il est lu à chaque démarrage, en production aussi, et ne remplace jamais une variable déjà définie.server/.env.<NODE_ENV>, par exemple.env.development. Lu uniquement quandNODE_ENVne vaut pasproduction(ou avecFORCE_DOTENV=1), en pratique lors d’une exécution depuis les sources en mode développement.- La valeur par défaut intégrée, indiquée dans les tableaux de chaque groupe.
Les pages de paramètres, dans Paramètres > Général, affichent la valeur en vigueur et enregistrent les modifications dans persistent/.env. Beaucoup de variables s’appliquent dès leur enregistrement ; les autres sont enregistrées mais nécessitent un redémarrage, et la page les liste après l’enregistrement. Une variable définie dans l’environnement du processus ne peut pas y être modifiée : la page l’affiche comme Définie dans l’environnement, non modifiable ici. Quelques variables, comme ENCRYPTION_SECRET et ACCESS_TOKEN_SECRET, ne peuvent jamais être modifiées depuis la page.
Les variables que lit un RTE, comme AF_ROLE, RTE_MODE, CONTROLLER_URL ou RTE_MAX_JOBS, ne figurent pas du tout sur les pages de paramètres : le contrôleur ne les utilise pas, définissez-les donc dans l’environnement où tourne le RTE. Les variables RTE_* que lit le contrôleur lui-même, RTE_QUEUE_MINUTES et RTE_FILES_MAX_MB, font exception et restent sur les pages. Quatre variables de RTE, RTE_MAX_JOBS, RTE_CACHE_MB, RTE_FILES et RTE_DRAIN_SECONDS, peuvent à la place être définies par RTE sur sa page de runner, où une valeur l’emporte sur la variable (voir Les paramètres d’un RTE).
Avec ALLOW_ENV_EDIT=0, les pages ne font qu’afficher les valeurs et l’enregistrement est refusé. Utilisez-le quand l’environnement est déclaré dans un manifeste, comme décrit dans Modification et audit.
Le seed de configuration ne définit aucune variable d’environnement. Il déclare des objets qui sont stockés dans la base de données, et les références ${ENV_VAR} qu’il contient sont résolues depuis l’environnement du serveur en cours d’exécution.
Quelques variables ne sont lues que depuis l’environnement et ne figurent pas dans les tableaux : MANAGED_ENV_PATH et FORCE_DOTENV, décrites plus haut, et les variables de proxy système HTTPS_PROXY et NO_PROXY (lues aussi en minuscules). Un RTE sortant joint l’application via HTTPS_PROXY, et un RTE entrant y fait passer son appel d’enregistrement, sauf si l’hôte de l’application figure dans NO_PROXY (noms d’hôte, suffixes .domain, ou * pour tous les hôtes).
Les variables marquées Secret contiennent un mot de passe, un jeton ou une clé : gardez-les hors du contrôle de version, par exemple dans un Secret Kubernetes ou un fichier .env qui n’est pas commité.
Dans cette section
Les variables sont regroupées par thème, avec une page par groupe :
| Page | Ce qu’elle couvre |
|---|---|
| Server and database | The web server, trusted proxies, the MySQL connection, the admin account, and what each process runs (controller, worker or RTE) |
| Paths | Where the configuration, forms, playbooks, workflows, uploads and backups live |
| Backups and retention | The backup commands, the backup before an upgrade, and how long backups, jobs and audit records are kept |
| Features | The designer, MCP, chat, launch validation, the jobs list, metrics, the AWX API and query logging |
| Configuration | The config seed, where the configuration is kept, git and ytt |
| Security variables | Sign-in limits, passwords, single sign-on, tokens, encryption, the browser policy, outbound REST and jq limits, masking, and the VAULT_* variables, read once to import a secret store |
| Logging | Log levels, the log format, files and how long they are kept, syslog and console colours |
| System tasks | When the system tasks under Jobs run, from the nightly cleanups and backup to the runner hub’s loops |
Autres variables
Les variables suivantes ne sont pas encore affectées à un groupe :
| Variable | Choix/Valeurs par défaut | Commentaires |
|---|---|---|
| CONFIG_SEED_RELOAD_ENABLED boolean added in version 7.9.0 | Par défaut : true | Config seed reload on
Whether the Config seed reload system task runs on its schedule (CONFIG_SEED_RELOAD_CRON). Turned off, the seed applies at startup only; it replaces CONFIG_SEED_RELOAD_SECONDS=0, deprecated. Turned off, Run now on the task’s page still runs it. false or 0 turns it off. Changed on the task’s own page, Jobs > System > the task > Schedule, which saves it to the managed settings file and applies it at once on every node, without a restart. Set in the real environment (or with ALLOW_ENV_EDIT=0), the page shows it read only. |
| JOB_CLEANUP_ENABLED boolean added in version 7.9.0 | Par défaut : true | Job cleanup on
Whether the Job cleanup system task runs on its schedule (JOB_CLEANUP_CRON). Turn it off to keep every finished job, or where they are cleaned up another way. Turned off, Run now on the task’s page still runs it. false or 0 turns it off. Changed on the task’s own page, Jobs > System > the task > Schedule, which saves it to the managed settings file and applies it at once on every node, without a restart. Set in the real environment (or with ALLOW_ENV_EDIT=0), the page shows it read only. |
| AUDIT_CLEANUP_ENABLED boolean added in version 7.9.0 | Par défaut : true | Audit log cleanup on
Whether the Audit log cleanup system task runs on its schedule (AUDIT_CLEANUP_CRON). Turn it off to keep the audit log forever (shipped to a syslog server, for instance). Turned off, Run now on the task’s page still runs it. false or 0 turns it off. Changed on the task’s own page, Jobs > System > the task > Schedule, which saves it to the managed settings file and applies it at once on every node, without a restart. Set in the real environment (or with ALLOW_ENV_EDIT=0), the page shows it read only. |
| TOKEN_CLEANUP_ENABLED boolean added in version 7.9.0 | Par défaut : true | Expired tokens on
Whether the Expired tokens system task runs on its schedule (TOKEN_CLEANUP_CRON). Only housekeeping: an expired token is refused anyway. Turned off, Run now on the task’s page still runs it. false or 0 turns it off. Changed on the task’s own page, Jobs > System > the task > Schedule, which saves it to the managed settings file and applies it at once on every node, without a restart. Set in the real environment (or with ALLOW_ENV_EDIT=0), the page shows it read only. |
| STORED_JOB_CLEANUP_ENABLED boolean added in version 7.9.0 | Par défaut : true | Stored jobs cleanup on
Whether the Stored jobs cleanup system task runs on its schedule (STORED_JOB_CLEANUP_CRON). Turn it off to keep every stored job until it is deleted. Turned off, Run now on the task’s page still runs it. false or 0 turns it off. Changed on the task’s own page, Jobs > System > the task > Schedule, which saves it to the managed settings file and applies it at once on every node, without a restart. Set in the real environment (or with ALLOW_ENV_EDIT=0), the page shows it read only. |
| NIGHTLY_BACKUP_ENABLED boolean added in version 7.9.0 | Par défaut : true | Nightly backup on
Whether the Nightly backup system task runs on its schedule (NIGHTLY_BACKUP_CRON). Turn it off where the instance is backed up another way (volume snapshots, a managed database with its own backups). Turned off, Run now on the task’s page still runs it. false or 0 turns it off. Changed on the task’s own page, Jobs > System > the task > Schedule, which saves it to the managed settings file and applies it at once on every node, without a restart. Set in the real environment (or with ALLOW_ENV_EDIT=0), the page shows it read only. |
| LOG_VIEW_LINES number added in version 7.7.0 | Par défaut : 1000 | Lines on the Server log page
The number of last lines of today’s server log the Server log page shows and searches, and the most the log endpoint (GET /api/v2/log) answers, whatever a request asks: the whole day’s file is the page’s Download. No upper limit, but the page reads that many lines every 2 seconds, and many lines can make it slow or unresponsive. Takes effect at once, without a restart. |