My fact:
$ head /etc/ansible/facts.d/my.fact
[greeting]
message="Hi, Brian"
ansible_local is empty when accessed from role:
$ ansible-playbook -c local -i localhost, test-ansible-local.yml -v
No config file found; using defaults
PLAY [Why is ansible_local lost] *****************************************************************************************************************************************************************
TASK [Gathering Facts] ***************************************************************************************************************************************************************************
ok: [localhost]
TASK [debug] *************************************************************************************************************************************************************************************
ok: [localhost] => {
"ansible_local": {
"my": {
"greeting": {
"message": "\"Hi, Brian\""
}
}
},
"changed": false
}
TASK [roles/role1 : debug] **********************************************************************************************************************************************************************$
ok: [localhost] => {
"ansible_local": {},
"changed": false
}
PLAY RECAP **************************************************************************************************************************************************************************************$
localhost : ok=3 changed=0 unreachable=0 failed=0