Closed
Description
ISSUE TYPE
- Bug Report
COMPONENT NAME
lookups
ANSIBLE VERSION
2.3.0.0, 2.4.1.0
CONFIGURATION
no custom config
OS / ENVIRONMENT
Linux
SUMMARY
two consecutive facts from password lookup with same length get identical values.
separate tasks or different length result in different values, as expected.
STEPS TO REPRODUCE
- name: Set random passwords for clusters
set_fact:
password1: "{{ lookup('password', '/dev/null length=20') }}"
password2: "{{ lookup('password', '/dev/null length=20') }}"
delegate_to: localhost
delegate_facts: True
- debug:
msg: "{{hostvars['localhost'].password1}} {{hostvars['localhost'].password2}}"EXPECTED RESULTS
two different values
ACTUAL RESULTS
two identical values
changing length for one of these, or using separate tasks, gives different values.
http://docs.ansible.com/ansible/latest/playbooks_lookups.html#the-password-lookup says "A special case is using /dev/null as a path. The password lookup will generate a new random password each time", thus the current behaviour is at least confusing and unexpected.
from irc :
<larsks> Richlv: Whatever is happening seems to be happening at a higher level than the password lookup plugin: as far as I can tell, it's only ever getting called once.