I am trying to run the following playbook to deploy a key to a number of servers
deploy_key.yml:
- hosts: servers
gather_facts: no
user: root
vars:- key_file: /root/.ssh/id_rsa.pub
tasks:- name: add authorized keys
authorized_key: user=root
key=“{{ item }}”
with_file:- “{{ key_file }}”
in ansible.cfg i added the following line:
scp_if_ssh = True
from the command line I am executing the following command:
ansible-playbook -k deploy_key.yml
As expected I am prompted for my password and it seems to authenticate but when the play is run I get the following error:
fatal: [m-vc] => failed to open a SFTP connection (Administratively prohibited)
My understanding was that setting scp_if_ssh=True in the ansible.cfg file would force ansible to transfer files using scp instead of sftp. I tried manually transferring a file on the command line using scp and it works fine. Am I missing something here?