# run playbooks in rc.local

**URL:** <https://forum.ansible.com/t/run-playbooks-in-rc-local/21852>\
**Category:** Ansible Project\
**Created:** [June 24, 2016, 3:14am UTC](https://forum.ansible.com/t/run-playbooks-in-rc-local/21852 "2016-06-24T03:14:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xiaohui\_Liu](https://avatars.discourse-cdn.com/v4/letter/x/dec6dc/32.png) [@Xiaohui\_Liu](https://forum.ansible.com/u/Xiaohui_Liu)\
**Post date:** [June 24, 2016, 3:14am UTC](https://forum.ansible.com/t/run-playbooks-in-rc-local/21852/1 "2016-06-24T03:14:43Z")

</div>

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, if run ‘sudo /etc/rc.local’, the playbook is played correctly.

Has anyone tried to run playbook inside rc.local?

Regards

---

<div class="post-metadata">

**Author:** ![sdarwin](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sdarwin/32/2450_2.png) [@sdarwin](https://forum.ansible.com/u/sdarwin)\
**Post date:** [June 30, 2016, 1:31pm UTC](https://forum.ansible.com/t/run-playbooks-in-rc-local/21852/2 "2016-06-30T13:31:05Z")

</div>

Hello Xiaohui ,

No idea if that will work, but here are just some quick ideas anyway: log output to a file, and then check the results. i.e., in rc.local: _the\_command_ \> /tmp/debug.txt 2\>&1 also, in case $PATH isn’t set, specify /the/full/path/to/files/and/commands.

---

<div class="post-metadata">

**Author:** ![Benjamin\_Redling](https://avatars.discourse-cdn.com/v4/letter/b/47e85d/32.png) [@Benjamin\_Redling](https://forum.ansible.com/u/Benjamin_Redling)\
**Post date:** [June 30, 2016, 1:34pm UTC](https://forum.ansible.com/t/run-playbooks-in-rc-local/21852/3 "2016-06-30T13:34:07Z")

</div>

I tried to run something different that depended on networking which  
failed with the same symptoms (manually "yes", on boot "no")

At least on Debian it has/had to do with the transition from classic  
init to systemd.  
If you search the net for "rc.local not working" it seems the rc.local  
stuff is executed too early.  
E.g. [https://www.raspberrypi.org/forums/viewtopic.php?f=66&t=122207](https://www.raspberrypi.org/forums/viewtopic.php?f=66&t=122207)

So you might have to reconfigure it to run after networking is setup.

Regards,  
Benjamin
