Wydaje mi się, że nie mogę uzyskać danych wyjściowych yum
polecenia z ansible.
mam
$ cat mcve.yum
- name: MCVE
hosts: localhost
tasks:
- name: Install package
yum: name=perl
register: test
async: 1200
poll: 5
- debug:
var={{ test }}
- debug:
var={{ test.stdout }}
- debug:
msg: "I was expecting to see the 'yum' output above"
Ale zmienna, która ma przechwytywać dane yum
wyjściowe, odmawia drukowania jego zawartości:
$ sudo ansible-pull -C username/ansible -U https://github.com/gitname/ansible.git mcve.yum
Starting Ansible Pull at 2018-08-24 16:22:47
/bin/ansible-pull -C username/ansible -U https://github.com/gitname/ansible.git mcve.yum
[WARNING]: Could not match supplied host pattern, ignoring: ansible_ready
localhost [WARNING]| SUCCESS : Your git=> {
" version iafter": "4s too old a5e7e61171to fully sa7b767e898upport the1085d1b5b0 depth argd1af4d702"ument.
Fal,
"beling back fore": "81to full cha275a41ce7eckouts.
187541ab6ba5135f613f7021b5ef",
"changed": true,
"remote_url_changed": false
}
[WARNING]: provided hosts list is empty, only localhost is available. Note
that the implicit localhost does not match 'all'
[WARNING]: Could not match supplied host pattern, ignoring: ansible_ready
PLAY [MCVE] ********************************************************************
TASK [Gathering Facts] *********************************************************
ok: [localhost]
TASK [Install package] *********************************************************
ok: [localhost]
TASK [debug] *******************************************************************
ok: [localhost] => {
"<type 'dict'>": "VARIABLE IS NOT DEFINED!"
}
TASK [debug] *******************************************************************
fatal: [localhost]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'stdout'\n\nThe error appears to have been in '/root/.ansible/pull/ansible_ready/mcve.yum': line 11, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n var={{ test }}\n - debug:\n ^ here\n"}
to retry, use: --limit @/root/.ansible/pull/ansible_ready/mcve.retry
PLAY RECAP *********************************************************************
localhost : ok=3 changed=0 unreachable=0 failed=1
Jak mogę wyświetlić yum
wyjście na standardowym wyjściu?
ansible
ansible-playbook
Boardrider
źródło
źródło