Using Non-standard SSH Port

So firstly, I’m on Windows so I’m running ansible commands from the VM.
Secondly, I’m trying to deploy to my Siteground VPS.

Issues already overcome:

ERROR: The file hosts/production is marked as executable, but failed to execute correctly

Copy the /vagrant folder somewhere else on the VM so I could chmod the file

cp -R /vagrant/ /home/
cd /home/vagrant
chmod -x hosts/production

Now I’m trying to run the ansible playback:

 ansible-playbook -i hosts/production deploy.yml --extra-vars="site=______"

I get an SSH connection error:

SSH Error: ssh: connect to host XXX.XXX.XXX.XX port 22: connection timed out

Sitegrounds docs specify that SSH connections must be made using port 18765 so I need to work out how to change the port the script uses.

I tried searching the trellis folder for “22” and edited the file roles/sshd/defaults/main.yml: “sshd_port” but this had no effect.

Anyone else know how I can achieve this?

You just need to specify the port in your hosts/production file.

Either like hostname:port or hostname ansible_ssh_port=port.

Their docs explain this:


Awesome, thanks for that @swalkinshaw

It now looks like the deploy script has successfully ssh’ed into my Siteground VPS.

I now get the error:

Error: ansible requires the stdlib json or simplejson module, neither was found!

Looking at the ansible docs it seems like it’s possible to get around this by adding a ‘raw’ parameter but I have no idea where to put that:

How did you install Ansible? Seems like it might not properly be installed if it can’t find those modules.

I’m using ansible on the VM that was setup by trellis.

I believe that error is because ansible is looking for the modules on the target system and not the system ansible is running from.

Is this a managed or unmanaged VPS? In other words, is it a stock Ubuntu install or has it already been set up by Siteground? Do you have root access?

@kalenjohnson - This is a managed VPS, I do not have root access but have some elevated permissions and can do some sudo tasks.

I don’t think I’m able to install python packages on the VPS especially since yum isn’t installed/available to me.

Trellis probably won’t work with that. It’s made to provision a server, meaning install all apps, configure everything, etc. It requires root access.

Damn, I was really just looking to have it sync the files and/or database to the production server and setup the right wp-config details.

Any suggestions on something I could use/build to achieve this from my trellis dev environment?

You can use Trellis just to deploy it’s just more manual work to find out configuration settings that match your existing VPS server and manual work to maybe add a user, create directories, SSH keys, etc. Unfortunately right now we don’t have a guide for that specifically.

Little info about it here: How to use Ansible only to Deploy

Hi, Im having the same problem as @Grant_Derepas,

Acessed into my VM with SSH correctly ‘cd’ to trellis directory and did: ‘ansible-playbook -i hosts/production server.yml

And received the following error:

ERROR: The file hosts/production is marked as executable, but failed to execute correctly. If this is not supposed to be an executable script, correct this with ‘chmod -x hosts/production’.

Im working on Windows 8.1

Thanks in advance!

@cacskate - The solution to that error was listed in my opening post. You just need to copy the hosts/production folder not shared with the host system so you can chmod it.

@swalkinshaw - I’m a little confused by your answer, I’ve already set up users/database/ssh keys on the VPS and put their info into the relevant trellis files.

It seems like you and the other thread are suggesting there is a different ansible-playbook script that only does the deploy and ignores the provision but I can’t see any reference on what that script is

Well now I’m the one who’s confused looking back at your original post.

You were using: ansible-playbook -i hosts/production deploy.yml which is correct.

deploy.yml is just for deploys and server.yml is for full server provisioning.

So I was already on the right track.

Again, the bit I got stuck with is the error the production server (siteground VPS) is throwing on the deploy command:

Error: ansible requires the stdlib json or simplejson module, neither was found!

which is because neither of those modules are installed on the siteground VPS (and I can’t install them myself).

The ansible docs say that using the raw module should get around this problem however I don’t know how to invoke that raw module.

My impression is that you’d use the raw module in an ansible ad hoc command (one time command, different from playbooks) like demonstrated here, to install a needed json module. Then your remote server would have the necessary modules to be able to receive ansible commands from the Trellis playbook. HOWEVER, you said…

…so maybe you’d have to ask the people you’re paying to manage your servers to install the necessary packages for ansible to run.

Im gonna have to abandon Trellis for the current project I’m working on :frowning:

It took me a lot o time trying and hacking here and there with no success,I feel like deploying to Digital Ocean from Windows even thou the Roots guys where able to give us a lot of documentation and support, still not quite ‘tested enough’ on a Windows machine.

I am really excited about Trellis for the future, but for now Im gonna have to go with the old and painfull way (FTP).

God bless you guys :smile:

That quite possibly is true, not many of us use Windows for development. I know there are many users that do use WIndows and Trellis though, so perhaps one of them can jump in.

1 Like

That would be amazing! If I get it to work I will give a walk throu for Windows users. It looks like many of us are having the exact same problems, I see it everywhere here on the forum. Thank you @kalenjohnson :slight_smile: