Você não precisa das chaves ao redor do teste. link
Eu modifiquei o seu código, alterei o perl para o nmap e removi chaves para isso:
- name: MCVE
hosts: localhost
tasks:
- name: Install package
yum: name=nmap
register: test
async: 1200
poll: 5
- debug:
var=test
- debug:
var=test.stdout
- debug:
msg: "I was expecting to see the 'yum' output above"
E recebeu a saída:
PLAY [MCVE] *****************************************************************************************************************************************************
TASK [Gathering Facts] ******************************************************************************************************************************************
ok: [localhost]
TASK [Install package] ******************************************************************************************************************************************
changed: [localhost]
TASK [debug] ****************************************************************************************************************************************************
ok: [localhost] => {
"test": {
"ansible_job_id": "985993379134.5246",
"changed": true,
"failed": false,
"finished": 1,
"msg": "",
"rc": 0,
"results": [
"Loaded plugins: fastestmirror\nLoading mirror speeds from cached hostfile\n * base: repo1.ash.innoscale.net\n * extras: centos2.zswap.net\n * updates: centos.mirror.constant.com\nResolving Dependencies\n--> Running transaction check\n---> Package nmap.x86_64 2:6.40-13.el7 will be installed\n--> Finished Dependency Resolution\n\nDependencies Resolved\n\n================================================================================\n Package Arch Version Repository Size\n================================================================================\nInstalling:\n nmap x86_64 2:6.40-13.el7 base 3.9 M\n\nTransaction Summary\n================================================================================\nInstall 1 Package\n\nTotal download size: 3.9 M\nInstalled size: 16 M\nDownloading packages:\nRunning transaction check\nRunning transaction test\nTransaction test succeeded\nRunning transaction\n Installing : 2:nmap-6.40-13.el7.x86_64 1/1 \n Verifying : 2:nmap-6.40-13.el7.x86_64 1/1 \n\nInstalled:\n nmap.x86_64 2:6.40-13.el7 \n\nComplete!\n"
]
}
}
TASK [debug] ****************************************************************************************************************************************************
ok: [localhost] => {
"test.stdout": "VARIABLE IS NOT DEFINED!"
}
TASK [debug] ****************************************************************************************************************************************************
ok: [localhost] => {
"msg": "I was expecting to see the 'yum' output above"
}
PLAY RECAP ******************************************************************************************************************************************************
localhost : ok=5 changed=1 unreachable=0 failed=0
Você não obtém stdout no conjunto de resultados para yum