Variables d’entorn

Configura AnsibleForms amb variables d’entorn


Per a administradors que despleguen AnsibleForms: les variables d’entorn que llegeix el servidor, agrupades per tema.

AnsibleForms s’ajusta amb variables d’entorn, tant si s’executa amb Docker Compose, a Kubernetes o des del codi font.


D’on surten els valors

El servidor llegeix cada variable de la primera d’aquestes fonts que la defineix, així que un valor més amunt a la llista sempre guanya:

  1. L’entorn del procés: environment: i env_file: a docker-compose (el .env del projecte es passa així), env i envFrom a Kubernetes, o la shell que arrenca node.
  2. persistent/.env, el fitxer que escriuen les pàgines de configuració (data/.env al projecte docker-compose, un altre camí amb MANAGED_ENV_PATH). Es llegeix a cada arrencada, també en producció, i mai no sobreescriu una variable que ja està definida.
  3. server/.env.<NODE_ENV>, per exemple .env.development. Només es llegeix quan NODE_ENV no és production (o amb FORCE_DOTENV=1), a la pràctica quan s’executa des del codi font en mode de desenvolupament.
  4. El valor predeterminat integrat, que apareix a les taules de cada grup.

Les pàgines de configuració, a Configuració > General, mostren el valor vigent i desen els canvis a persistent/.env. Moltes variables s’apliquen tan bon punt es desen; les altres es desen però necessiten un reinici, i la pàgina les llista després de desar. Una variable definida a l’entorn del procés no s’hi pot canviar: la pàgina la mostra com a Definit a l’entorn, així que no es pot canviar aquí. Algunes variables, com ara ENCRYPTION_SECRET i ACCESS_TOKEN_SECRET, no es poden canviar mai des de la pàgina.

Les variables que llegeix un RTE, com ara AF_ROLE, RTE_MODE, CONTROLLER_URL o RTE_MAX_JOBS, no són a les pàgines de configuració: el controlador no les utilitza, així que defineix-les a l’entorn on s’executa l’RTE. Les variables RTE_* que llegeix el mateix controlador, RTE_QUEUE_MINUTES i RTE_FILES_MAX_MB, són l’excepció i continuen a les pàgines. Quatre variables de l’RTE, RTE_MAX_JOBS, RTE_CACHE_MB, RTE_FILES i RTE_DRAIN_SECONDS, es poden definir per a cada RTE a la seva pàgina de runner, on un valor guanya a la variable (vegeu La configuració d’un RTE).

Amb ALLOW_ENV_EDIT=0 les pàgines només mostren els valors i el desament es rebutja. Fes-lo servir quan l’entorn es declara en un manifest, tal com es descriu a Edició i auditoria.

La llavor de configuració no defineix cap variable d’entorn. Declara objectes que es desen a la base de dades, i les referències ${ENV_VAR} que conté es resolen a partir de l’entorn del servidor en execució.

Algunes variables només es llegeixen de l’entorn i no són a les taules: MANAGED_ENV_PATH i FORCE_DOTENV, descrites més amunt, i les variables de proxy del sistema HTTPS_PROXY i NO_PROXY (també es llegeixen en minúscules). Un RTE sortint truca a l’aplicació a través de HTTPS_PROXY, i un RTE entrant hi envia la seva crida de registre, tret que el host de l’aplicació sigui a NO_PROXY (noms de host, sufixos .domain, o * per a tots els hosts).

Les variables marcades amb Secret contenen una contrasenya, un token o una clau: mantén-les fora del control de versions, per exemple en un Secret de Kubernetes o en un fitxer .env que no es faci commit.


En aquesta secció

Les variables s’agrupen per tema, amb una pàgina per grup:

Pàgina Què hi trobaràs
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

Altres variables

Les variables següents encara no estan assignades a cap grup:

Variable Opcions/Valors per defecte Comentaris
CONFIG_SEED_RELOAD_ENABLED
boolean
added in version 7.9.0
Valor per defecte:
true

Config seed reload on
true, false

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
Valor per defecte:
true

Job cleanup on
true, false

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
Valor per defecte:
true

Audit log cleanup on
true, false

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
Valor per defecte:
true

Expired tokens on
true, false

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
Valor per defecte:
true

Stored jobs cleanup on
true, false

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
Valor per defecte:
true

Nightly backup on
true, false

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
Valor per defecte:
1000

Lines on the Server log page
a whole number of at least 1

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.