一、需要注意的点
-
分清楚这个是主控节点还是被控节点的操作,有的时候是一个文件从主控到被控节点,还是被控节点的文件到主控节点上面了
剧本执行报错代码
# 仔细看,报错的原因就是ansibel_lvm 未定义,写错了变量名TASK [research not exsist] *********************************************************************
fatal: [node1]: FAILED! => {"msg": "The conditional check 'ansible_hostname=='node1' and 'research' not in ansibel_lvm.vgs' failed. The error was: error while evaluating conditional (ansible_hostname=='node1' and 'research' not in ansibel_lvm.vgs): 'ansibel_lvm' is undefined. 'ansibel_lvm' is undefined\n\nThe error appears to be in '/home/devops/ansible/yml/lvs.yml': line 20, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n when: \"ansible_hostname=='node1' and 'research' in ansible_lvm.vgs\"\n - name: research not exist\n ^ here\n"}