I’m not an expert in ansible but with my current experience I believe this works for you because you are logging in as root which is the owner of /var/ folder. ansible_user is a default variable.
Typically for other modules like lineinfile I add ansible_beome: yes, which means run the file as sudo. my ansible_beocme_password is defined as a variable so I guess you can try doing that.
become_user only tells ansible what user to become - not that it use
privilege escalation.
Also, become_user is default 'root', so that directive is redundant.
Instead simply use:
become: yes
But when i use this task just before :
- set_fact:
ansible_user: root
My directory is create with success !! WHY ?
This means that ansible will sign in to the server as root, so then no
permission issues.