suppress "changed" for register'ed variables

Greetings,

I currently register some variables via:

cat roles/configure_account_environment/tasks/main.yaml

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

Thanks for the help Richard!

Any ideas on changing “skipped” to “ok”:

[…]

TASK [common : set editor to vim] ************************************************************************************************************************************************************
skipping: [zed]

[…]

PLAY RECAP ***********************************************************************************************************************************************************************************
zed : ok=23 changed=0 unreachable=0 failed=0 skipped=1 rescued=0 ignored=0

Again, thank you for the great assistance.

Cheers,

-m

Check the when: condition on the skipped task. Why is the condition false?

Here are the two tasks:

Here are the two tasks:

name: get editor realpath
shell: realpath /usr/bin/editor

Use command here instead of shell

register: editor_realpath
changed_when: False
tags:

  • vim

name: set editor to vim
command: update-alternatives --set editor /usr/bin/vim.nox
when: editor_realpath.stdout != ‘/usr/bin/vim.nox’
tags:

  • vim

I guess I’d like the “set editor to vim” task to be “OK” if it is already set to vim, but it is showing up as “skipped”.

Not sure how to do that

Here are the two tasks:

name: get editor realpath
shell: realpath /usr/bin/editor

Use command here instead of shell

Sure thing.

register: editor_realpath
changed_when: False
tags:

  • vim

name: set editor to vim
command: update-alternatives --set editor /usr/bin/vim.nox
when: editor_realpath.stdout != ‘/usr/bin/vim.nox’
tags:

  • vim

I guess I’d like the “set editor to vim” task to be “OK” if it is already set to vim, but it is showing up as “skipped”.

Not sure how to do that

Fair enough. You’ve been very helpful, Richard. Thanks again for all the help!

-m