Executing ansible through SSH

Hi ,

I have 3 servers serverA ,serverB , and serverC.
From serverA , I am trying to execute the playbook on serverB which is the control node(Where ansible is available).

The playbook when run from serverB(login with ssh) with executing as below works fine and got the expected output.

export ANSIBLE_HOST_KEY_CHECKING=False

ansible-playbook /home/ansible/playbook1.yml --limit serverC --key-file /home/ansible/priv_key.file

The playbook has “become: true”

From ServerA , I am executing the below command using a bash script and the script works. But the execution is not happening

#!/bin/bash
ssh -i .ssh/serverb_key root@serverB “export ANSIBLE_HOST_KEY_CHECKING=False; ansible-playbook /home/ansible/playbook1.yml --limit serverC --key-file /home/ansible/priv_key.file”

The requirement is to initiate the script from serverA - which will execute the playbook in serverB and do the changes in serverC.
I even try with the “&” at the end to execute the ansible-playbook in the background …but still the same result. "“export ANSIBLE_HOST_KEY_CHECKING=False; ansible-playbook /home/ansible/playbook1.yml --limit serverC --key-file /home/ansible/priv_key.file &”

Try removing the semi colon after false

Thanks … its working now

If that is true, then you can probably also remove the "export " bit.
So:

ssh -i .ssh/serverb_key root@serverB
"ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook
/home/ansible/playbook1.yml --limit serverC --key-file
/home/ansible/priv_key.file"