group_vars/all: "become: false" triggers reserved-name warning, is a no-op on current ansible-core #13643

Closed
opened 2026-10-27 11:57:09 +00:00 by praiskup · 2 comments
Member

Description of request

Hi folks,

inventory/group_vars/all:38 defines become: false as a group variable:

# by default set become to false here We can override it as needed.
# Note that if become is true, you need to unset requiretty for
# ssh controlpersist to work.
become: false

Every ansible-core >= 2.14 run that points -i at the inventory directory
emits:

[WARNING]: Found variable using reserved name 'become'.
Origin: inventory/group_vars/all:38:1

(e.g. roles/copr/backend/templates/resalloc/pools.yaml.expand.sh prints
it twice per run).

What I verified:

  • ansible-core 2.16.16 (what batcave01 runs): the var does NOT suppress
    become=True from [privilege_escalation] in ansible.cfg (tested with a
    minimal playbook; sudo is still invoked). It is a no-op there, and the
    warning is not even displayed on 2.16.
  • ansible-core 2.19/2.20: no-op as well (keywords strictly beat
    variables since the templating rewrite), and the warning shows.

It presumably worked as a var->keyword fallback in ancient ansible,
which is why the comment above it says "by default set become to false
here".

Since the default for become is false anyway, the variable looks safe to
drop. If a global default is actually wanted, ansible_become: false
is the sanctioned variable form and does not warn.

Caveat worth a double-check before removing: whether rbac-playbook or
/etc/ansible/ansible.cfg on batcave01 relies on it somehow (could not
check the wrapper from outside).

Affected Service or System

No response

Deadline

No response

Additional Context or Error Logs

No response

### Description of request Hi folks, inventory/group_vars/all:38 defines `become: false` as a group variable: # by default set become to false here We can override it as needed. # Note that if become is true, you need to unset requiretty for # ssh controlpersist to work. become: false Every ansible-core >= 2.14 run that points -i at the inventory directory emits: [WARNING]: Found variable using reserved name 'become'. Origin: inventory/group_vars/all:38:1 (e.g. roles/copr/backend/templates/resalloc/pools.yaml.expand.sh prints it twice per run). What I verified: * ansible-core 2.16.16 (what batcave01 runs): the var does NOT suppress become=True from [privilege_escalation] in ansible.cfg (tested with a minimal playbook; sudo is still invoked). It is a no-op there, and the warning is not even displayed on 2.16. * ansible-core 2.19/2.20: no-op as well (keywords strictly beat variables since the templating rewrite), and the warning shows. It presumably worked as a var->keyword fallback in ancient ansible, which is why the comment above it says "by default set become to false here". Since the default for become is false anyway, the variable looks safe to drop. If a global default is actually wanted, `ansible_become: false` is the sanctioned variable form and does not warn. Caveat worth a double-check before removing: whether rbac-playbook or /etc/ansible/ansible.cfg on batcave01 relies on it somehow (could not check the wrapper from outside). ### Affected Service or System _No response_ ### Deadline _No response_ ### Additional Context or Error Logs _No response_
Owner

Yeah, this was added in the distant mists of time (~10years ago).

I have no problem removing it. I don't think anything depends on it.

That said, perhaps we should wait until after freeze just in case...

Can you do a quick pr so we don't forget to do it after freeze?

Yeah, this was added in the distant mists of time (~10years ago). I have no problem removing it. I don't think anything depends on it. That said, perhaps we should wait until after freeze just in case... Can you do a quick pr so we don't forget to do it after freeze?
Author
Member

PR proposed ^^

PR proposed ^^
kevin closed this issue 2026-11-04 18:50:41 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
infra/tickets#13643
No description provided.