Umgebungsvariablen
AnsibleForms mit Umgebungsvariablen konfigurieren
Für Administratoren, die AnsibleForms bereitstellen: die Umgebungsvariablen, die der Server liest, nach Themen gruppiert.
AnsibleForms wird über Umgebungsvariablen eingestellt, ob es mit Docker Compose, auf Kubernetes oder aus dem Quellcode läuft.
Woher die Werte kommen
Der Server liest jede Variable aus der ersten dieser Quellen, die sie setzt; ein weiter oben stehender Wert gewinnt also immer:
- Die Prozessumgebung:
environment:undenv_file:in docker-compose (die.envdes Projekts wird so übergeben),envundenvFromauf Kubernetes oder die Shell, dienodestartet. persistent/.env, die Datei, die die Einstellungsseiten schreiben (data/.envim docker-compose-Projekt, ein anderer Pfad mitMANAGED_ENV_PATH). Sie wird bei jedem Start gelesen, auch in Produktion, und überschreibt nie eine bereits gesetzte Variable.server/.env.<NODE_ENV>, zum Beispiel.env.development. Wird nur gelesen, wennNODE_ENVnichtproductionist (oder mitFORCE_DOTENV=1), in der Praxis beim Betrieb aus dem Quellcode im Entwicklungsmodus.- Der integrierte Standardwert, in den Tabellen jeder Gruppe angegeben.
Die Einstellungsseiten unter Einstellungen > Allgemein zeigen den geltenden Wert und speichern Änderungen in persistent/.env. Viele Variablen gelten, sobald sie gespeichert sind; die übrigen werden gespeichert, brauchen aber einen Neustart, und die Seite listet sie nach dem Speichern auf. Eine in der Prozessumgebung gesetzte Variable lässt sich dort nicht ändern: Die Seite zeigt sie als In der Umgebung gesetzt und hier nicht änderbar. Einige Variablen, etwa ENCRYPTION_SECRET und ACCESS_TOKEN_SECRET, können nie über die Seite geändert werden.
Die Variablen, die eine RTE liest, etwa AF_ROLE, RTE_MODE, CONTROLLER_URL oder RTE_MAX_JOBS, stehen gar nicht auf den Einstellungsseiten: Der Controller verwendet sie nicht, setzen Sie sie daher in der Umgebung, in der die RTE läuft. Die RTE_*-Variablen, die der Controller selbst liest, RTE_QUEUE_MINUTES und RTE_FILES_MAX_MB, sind die Ausnahme und bleiben auf den Seiten. Vier RTE-Variablen, RTE_MAX_JOBS, RTE_CACHE_MB, RTE_FILES und RTE_DRAIN_SECONDS, lassen sich stattdessen pro RTE auf ihrer Runner-Seite setzen, wo ein Wert die Variable übertrifft (siehe Die Einstellungen einer RTE).
Mit ALLOW_ENV_EDIT=0 zeigen die Seiten die Werte nur an, und das Speichern wird abgewiesen. Verwenden Sie das, wenn die Umgebung in einem Manifest deklariert ist, wie unter Bearbeitung und Audit beschrieben.
Der Config-Seed setzt keine Umgebungsvariablen. Er deklariert Objekte, die in der Datenbank gespeichert werden, und die ${ENV_VAR}-Verweise darin werden aus der Umgebung des laufenden Servers aufgelöst.
Einige Variablen werden nur aus der Umgebung gelesen und stehen nicht in den Tabellen: MANAGED_ENV_PATH und FORCE_DOTENV, oben beschrieben, sowie die System-Proxy-Variablen HTTPS_PROXY und NO_PROXY (auch in Kleinschreibung gelesen). Eine ausgehende RTE wählt sich über HTTPS_PROXY bei der App ein, und eine eingehende RTE sendet ihren Registrierungsaufruf darüber, es sei denn, der Host der App steht in NO_PROXY (Hostnamen, .domain-Suffixe oder * für jeden Host).
Mit Secret markierte Variablen enthalten ein Passwort, Token oder einen Schlüssel: Halten Sie sie aus der Versionsverwaltung heraus, zum Beispiel in einem Kubernetes-Secret oder einer .env-Datei, die nicht committet wird.
In diesem Abschnitt
Die Variablen sind nach Themen gruppiert, mit einer Seite pro Gruppe:
| Seite | Inhalt |
|---|---|
| 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 |
Weitere Variablen
Die folgenden Variablen sind noch keiner Gruppe zugeordnet:
| Variable | Auswahl/Standardwerte | Kommentare |
|---|---|---|
| CONFIG_SEED_RELOAD_ENABLED boolean added in version 7.9.0 | Standard: 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 | Standard: 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 | Standard: 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 | Standard: 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 | Standard: 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 | Standard: 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 | Standard: 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. |