How to generate single reusable random password with ansible

Use set_fact to assign permanent fact:

- name: Demo
  hosts: localhost
  gather_facts: False
  vars:
    pwd_alias: "{{ lookup('password', '/dev/null length=15 chars=ascii_letters') }}"
  tasks:
    - set_fact:
        my_pass: "{{ pwd_alias }}"
    - debug:
        msg: "{{ my_pass }}"
    - debug:
        msg: "{{ my_pass }}"
    - debug:
        msg: "{{ my_pass }}"

I've been doing it this way and never had an issue.

- name: Demo
  hosts: localhost
  gather_facts: False 

  tasks:
   - set_fact:
       my_pass: "{{ lookup('password', '/dev/null length=15 chars=ascii_letters') }}"
   - debug:
       msg: "{{ my_pass }}"

Tags:

Ansible