I have not worked much with roles.
site.yml
---
- hosts: user1_checkserverlist
user: user1
roles:
- { role: speed_manager, DNAME: "/u" }
- hosts: oracle_checkserverlist
user: oracle
roles:
- { role: speed_manager, DNAME: "/tmp" }
check.yml
---
- name: ==== Reading Variable ====
ping:
vars:
dn: "{{ diskname }}"
- name: ====Sync to remote hosts ====
synchronize: src="/web/roles/speed_manager/files/" dest="/tmp/mohtt/"
- name: ====Execute shell=============
shell: /tmp/mohtt/fixwebserver.sh {{ dn }} chdir=/tmp/mohtt
Got the following error when tried to execute the playbook:
TASK [check_bk_speed_manager : ====Execute shell=============] *****************
task path: /web/roles/speed_manager/tasks/check.yml:25
fatal: [myserver.com]: FAILED! => {"failed": true, "msg": "'dn' is undefined"}
fatal: [myserver.com]: FAILED! => {"failed": true, "msg": "'dn' is undefined"}
to retry, use: --limit @check_bk_speed.retry