bohr
bohr

Reputation: 651

Could not find an ansible playbook when running script using supervisor

I am relatively new to supervisord. I am trying to run my python script as a daemon process using supervisord. The following is my conf file which I put on /etc/supervisor/conf.d

[program:myscript]
command=/usr/bin/python /etc/supervisor/conf.d/main.py
user=ubuntu
autostart=true
autorestart=true
stderr_logfile=/var/log/stagingbot.err.log
stdout_logfile=/var/log/stagingbot.out.log

inside my main.py, there is a subprocess that will call an ansible playbook which is also located in /etc/supervisor/conf.d, named start.yml. However, I got an error saying that the particular yml could not be found. Error: the playbook: start.yml could not be found

On the other hand, when I ran my script using python main.py & it works fine as it can find the ansible playbook.

any helps would be really appreciated. Thank you

Upvotes: 1

Views: 3313

Answers (1)

udondan
udondan

Reputation: 59989

Did you try to chdir into that location?

[program:myscript]
command=/usr/bin/python /etc/supervisor/conf.d/main.py
directory=/etc/supervisor/conf.d
...

Upvotes: 1

Related Questions