Sounds like you need to use `changed_when: false` here -
https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_error_handling.html#defining-changed

On Tue, Sep 26, 2023 at 3:09 PM 'Matt Zagrabelny' via Ansible Project <
[email protected]> wrote:

> Greetings,
>
> I currently register some variables via:
>
> cat roles/configure_account_environment/tasks/main.yaml
> ---
> # This playbook contains plays that will be run to configure an account.
>
> -
>     name: get {{ primary_user }} account's home directory
>     shell: getent passwd {{ primary_user }} | cut -d ":" -f 6
>     register: home_directory
>
> ...and when I run the playbook I get:
>
> [...]
> TASK [configure_account_environment : get root account's home directory]
> *********************
> changed: [zed]
>
> PLAY RECAP
> ***********************************************************************************
> zed                        : ok=23   changed=2    unreachable=0
>  failed=0    skipped=1    rescued=0    ignored=0
> [...]
>
> Having variables that get registered show up as "changed" feels misleading
> to me. Nothing is "changing" on the target node, I'm just getting some
> information from that system.
>
> Is there a way to mark registered variables as something other than
> "changed" in the output of the playbook run?
>
> Thanks for any hints and help!
>
> -m
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAOLfK3VTp8dU%3DzBhL%3Dy%3DSuF1ZcQ5wh3gVPEK3xNMc24yvG4kKg%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAOLfK3VTp8dU%3DzBhL%3Dy%3DSuF1ZcQ5wh3gVPEK3xNMc24yvG4kKg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CALF5A-JHVF9_tTRWA71zGOe552VuEpDaJrY55PuOfxK8BH0Pyg%40mail.gmail.com.

Reply via email to