Variáveis de ambiente

Configure o AnsibleForms com variáveis de ambiente


Para administradores que implementam o AnsibleForms: as variáveis de ambiente que o servidor lê, agrupadas por tema.

O AnsibleForms ajusta-se com variáveis de ambiente, quer corra com Docker Compose, no Kubernetes ou a partir do código-fonte.


De onde vêm os valores

O servidor lê cada variável da primeira destas origens que a define, por isso um valor mais acima na lista ganha sempre:

  1. O ambiente do processo: environment: e env_file: no docker-compose (o .env do projeto é passado desta forma), env e envFrom no Kubernetes, ou a shell que arranca o node.
  2. persistent/.env, o ficheiro que as páginas de definições escrevem (data/.env no projeto docker-compose, outro caminho com MANAGED_ENV_PATH). É lido em cada arranque, também em produção, e nunca se sobrepõe a uma variável que já esteja definida.
  3. server/.env.<NODE_ENV>, por exemplo .env.development. Só é lido quando NODE_ENV não é production (ou com FORCE_DOTENV=1), na prática ao correr a partir do código-fonte em modo de desenvolvimento.
  4. A predefinição integrada, mostrada nas tabelas de cada grupo.

As páginas de definições, em Definições > Geral, mostram o valor em vigor e guardam as alterações em persistent/.env. Muitas variáveis aplicam-se assim que são guardadas; as outras são guardadas mas precisam de um reinício, e a página lista-as depois de guardar. Uma variável definida no ambiente do processo não pode ser alterada aí: a página mostra-a como Definido no ambiente, por isso não pode ser alterado aqui. Algumas variáveis, como ENCRYPTION_SECRET e ACCESS_TOKEN_SECRET, nunca podem ser alteradas a partir da página.

As variáveis que um RTE lê, como AF_ROLE, RTE_MODE, CONTROLLER_URL ou RTE_MAX_JOBS, não estão de todo nas páginas de definições: o controlador não as usa, por isso defina-as no ambiente onde o RTE corre. As variáveis RTE_* que o próprio controlador lê, RTE_QUEUE_MINUTES e RTE_FILES_MAX_MB, são a exceção e ficam nas páginas. Quatro variáveis do RTE, RTE_MAX_JOBS, RTE_CACHE_MB, RTE_FILES e RTE_DRAIN_SECONDS, podem em alternativa ser definidas por RTE na sua página de runner, onde um valor prevalece sobre a variável (consulte As definições de um RTE).

Com ALLOW_ENV_EDIT=0, as páginas só mostram os valores e a gravação é recusada. Use-o quando o ambiente está declarado num manifesto, como descrito em Edição e auditoria.

O config seed não define variáveis de ambiente. Declara objetos que são guardados na base de dados, e as referências ${ENV_VAR} que contém são resolvidas a partir do ambiente do servidor em execução.

Algumas variáveis são lidas só do ambiente e não estão nas tabelas: MANAGED_ENV_PATH e FORCE_DOTENV, descritas acima, e as variáveis de proxy do sistema HTTPS_PROXY e NO_PROXY (também lidas em minúsculas). Um RTE de saída liga-se à aplicação através de HTTPS_PROXY, e um RTE de entrada envia por ele a sua chamada de registo, a menos que o host da aplicação esteja em NO_PROXY (nomes de host, sufixos .domain, ou * para todos os hosts).

As variáveis marcadas como Secreto contêm uma palavra-passe, um token ou uma chave: mantenha-as fora do controlo de versões, por exemplo num Secret do Kubernetes ou num ficheiro .env que não é enviado para o repositório.


Nesta secção

As variáveis estão agrupadas por tema, com uma página por grupo:

Página O que abrange
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

Outras variáveis

As variáveis seguintes ainda não estão atribuídas a nenhum grupo:

Variável Opções/Valores predefinidos Comentários
CONFIG_SEED_RELOAD_ENABLED
boolean
added in version 7.9.0
Predefinição:
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
Predefinição:
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
Predefinição:
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
Predefinição:
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
Predefinição:
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
Predefinição:
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
Predefinição:
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.