####debug 设置
root@sam:/opt/# cat mktest.yml
---
- hosts: ceph01
vars:
testdir1: weeeeeeweokok!!!
tasks:
- name: touch testfile
file:
path: /opt/testfile
state: touch
###调用自定义变量
- name: debug demo
debug:
msg: adfasdfasddddss{{testdir1}}333
###调用系统变量
- name: debug demo1
debug:
msg: "remote hosts memory infomations, {{ ansible_memory_mb }}"
###输出
root@sam:/opt/# ansible-playbook mktest.yml
PLAY [ceph01] **********************************************************************************
TASK [Gathering Facts] *************************************************************************
ok: [ceph01]
TASK [touch testfile] **************************************************************************
changed: [ceph01]
TASK [debug demo] ******************************************************************************
ok: [ceph01] => {
"msg": "adfasdfasddddssweeeeeeweokok!!!333"
}
TASK [debug demo1] *****************************************************************************
ok: [ceph01] => {
"msg": "remote hosts memory infomations, {u'real': {u'total': 7822, u'free': 7093, u'used': 729}, u'swap': {u'cached': 0, u'total': 8191, u'used': 0, u'free': 8191}, u'nocache': {u'used': 279, u'free': 7543}}"
}
PLAY RECAP *************************************************************************************
ceph01 : ok=4 changed=1 unreachable=0 failed=0
root@sam:/opt/huayun#