Triggering playbook within rc.local

I met a problem using ansible-playbook today.

I prepared a playbook, and tried to trigger the playbook inside rc.local. The idea is that the machine will be bootstrapped automatically on boot.

But rc.local does not output anything. While, iuf run ‘sudo /etc/rc.local’, the playbook is played correctly.

Has anyone tried to run ansible-playbook in rc.local? Is there any special configuration I should apply?

Regards
Xiaohui