Skip to content

Error on step "Create localhost binary cache path" if "become: true" is set on whole playbook #552

Open
@phidah

Description

@phidah

I have a playbook with become: true for the whole playbook.

I use the prometheus.prometheus.redis_exporter role as so:

- name: Install Prometheus Redis Exporter
      include_role:
        name: prometheus.prometheus.redis_exporter

I, however, get stuck at this step:

TASK [prometheus.prometheus._common : Create localhost binary cache path] ***************************************************************************
task path: /Users/<me>/.ansible/collections/ansible_collections/prometheus/prometheus/roles/_common/tasks/install.yml:59
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: <me>
<localhost> EXEC /bin/sh -c 'echo ~<me> && sleep 0'
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /Users/<me>/.ansible/tmp `"&& mkdir "` echo /Users/<me>/.ansible/tmp/ansible-tmp-1741783842.452032-45768-224007809248663 `" && echo ansible-tmp-1741783842.452032-45768-224007809248663="` echo /Users/<me>/.ansible/tmp/ansible-tmp-1741783842.452032-45768-224007809248663 `" ) && sleep 0'
Using module file /opt/homebrew/Cellar/ansible/11.3.0/libexec/lib/python3.13/site-packages/ansible/modules/file.py
<localhost> PUT /Users/<me>/.ansible/tmp/ansible-local-4568292m01zny/tmp8bchxrh3 TO /Users/<me>/.ansible/tmp/ansible-tmp-1741783842.452032-45768-224007809248663/AnsiballZ_file.py
<localhost> EXEC /bin/sh -c 'chmod u+x /Users/<me>/.ansible/tmp/ansible-tmp-1741783842.452032-45768-224007809248663/ /Users/<me>/.ansible/tmp/ansible-tmp-1741783842.452032-45768-224007809248663/AnsiballZ_file.py && sleep 0'
<localhost> EXEC /bin/sh -c 'sudo -H -S -p "[sudo via ansible, key=qaimkxrkcmfademqqinjnrxbmqtinkj] password:" -u root /bin/sh -c '"'"'echo BECOME-SUCCESS-qaimkxrkcmzfademqqinjnrxbmqtinkj ; /opt/homebrew/Cellar/ansible/11.3.0/libexec/bin/python /Users/<me>/.ansible/tmp/ansible-tmp-1741783842.452032-45768-224007809248663/AnsiballZ_file.py'"'"' && sleep 0'

Even if I try wrapping it in a non-elevated block, it still tries to sudo:

- name: Install Prometheus Redis Exporter without elevated privileges
  block:
    - name: Install Prometheus Redis Exporter
      include_role:
        name: prometheus.prometheus.redis_exporter
  become: false

In #427 an issue causing errors (or an infinite sudo prompt), if "become: true" was set on the whole workbook was fixed. It seems that my issue is the same. Some changes were done in 6209b53 where the become: false statement on the task Create localhost binary cache path moved.

It seems that somehow the become: false set in the "Download binary ..." task of the install.yml file is not being respected.

Is this a bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions