I use Ansible for my server management and I am attempting to use a command to ensure my trunk is online. (Sometimes, a random trunk is offline in the morning and issuing a simple “pjsip qualify TRUNKNAME” fixes it. I use IP based authentication with Flowroute.
So, since I don’t know why it isn’t coming online, and can’t seem to find anything in my logs, I was thinking I could use Ansible to centrally get the trunk back online.
I have used this command before to add an IP to the trusted firewall list on a couple of PBXs:
ansible --become-user=root -m command -a “sudo /usr/sbin/fwconsole firewall trust IPADDRESS” SERVERNAME This works perfect.
Now, I want to use a similar command to run the pjsip qualify command from Ansible. I have tried the following:
ansible --become-user=root -m command -a “/usr/sbin/asterisk -rx pjsip qualifY TRUNK” SERVERNAME
but I get the error “Unable to connect to remote asterisk (does /var/run/asterisk/asterisk.ctl exist?)non-zero return code”
Anyone have any ideas on this one? (I’d like to know why the trunk stopped coming back online after a reboot, AND I’d like to know how to get this command to work, as this could be useful for other tasks as well.)