ansible / proposals

Repository for sharing and tracking progress on enhancement proposals for Ansible.
Creative Commons Zero v1.0 Universal
93 stars 19 forks source link

Optional "message" parameter along with "no_log: true" option #145

Open nikitakazantsev12 opened 6 years ago

nikitakazantsev12 commented 6 years ago

Proposal: Optional "message" parameter with "no_log"

Author: Nikita Kazantsev <@nikitakazantsev12>

Date: 2018-09-27

Motivation

If I hide task output with no_log and use with_items loop, I see just a lot of "changed: [...] => (item=None)" output strings.

Problems

If there would be a kind of a "message" parameter in a task, I would be able to print some info associated with each with_items iteration. For example "message: '{{ item.mygooditemname }}'", still hiding all other things, like passwords.

Solution proposal

- name: my good task
  mymodule:
    username: "{{ item.user }}"
    password: "{{ item.password }}"
    filename: "{{ item.file }}"
  no_log: true
  message: "{{ item.file }}"
  with_items: "{{ user_password_file }}"

The target output then will look like "changed: [...] => (message=one_of_these_files)".

bcoca commented 6 years ago

have you looked at 'label'? https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html#loop-control

nikitakazantsev12 commented 6 years ago

have you looked at 'label'? https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html#loop-control

Good idea. However that doesn't help - I'm still getting just "changed: [...] => (item=None)" output.

sandinak commented 6 months ago

+1 on this .. would be really nice to append this data on multi-host task output

ok: [qa42iad-bat-001] "{{ message }}"