15

The question "How do I set register a variable to persist between plays in Ansible?", is in the top of the frequent questions of . It has attracted a lot of views and score, so it is a pretty well established one. I, myself, point or duplicate vote to it, from time to time, as variants of it are coming back.

This said, the code in the question itself has a lot of information and code unrelated to the question itself, although the question title pretty well sums up what the OP is trying to achieve.

The answerers actually didn't even care to take those extraneous information and did build up on an implicit MRE.

So, should I drastically edit the question in order to match the minimal criteria of the MRE?


The question matching an MRE should be in the line of what the first answerer propose as an example:

I have an Ansible playbook, where I would to access a variable I register on one machine to be available on another.

Given the playbook:

- hosts: localhost
  tasks:
    - command: echo "this is a test"
      register: foo

- hosts: main
  tasks:
    - debug:
        msg: "{{ foo }}"

It gives me the error:

The task includes an option with an undefined variable. The error was: 'foo' is undefined

How can I access foo, registered on localhost from main?

2
  • 5
    While you're at it, edit this post as well. Because you're not asking about drastically editing (which is usually quite wrong), you're asking about removing fluff and/or unnecessary padding. There just happens to be a lot of it, that does not really change anything. Probably if you would have put it like that to yourself, you wouldn't even have created this post. Your terminology is a little extreme to the point of harming your cause.
    – Gimby
    Commented Oct 28, 2022 at 8:23
  • It would be awesome if more knowledgeable people helped in cleaning up top-rated questions on SO. Commented Oct 30, 2022 at 2:30

1 Answer 1

15

Should I drastically edit the question

Yes, it improves the quality of the post, doesn't conflict with the author's intent, and more importantly, makes Stack Overflow a better place.

If the purpose of Stack Overflow is to build a high quality repository of questions and answers, denying edits such as these are detrimental to its purpose.

Having said that, I recommend discussing with other gold badge holders/subject matter experts, so that your edit doesn't remove any necessary information.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .