New to Ansible, Linux & GIT. Never used any before and have been put on a course through work.
I am currently using vim as my playbook editor but find it very uncomfortable to use. I have been told that I could use Notepad ++ but in all honesty I wouldn’t know how to execute and don’t see much information online regarding its use with ansible.
Can anyone advise a good editor that I might be able to use with creating playbooks in ansible.
Any further information or help would be greatly appreciated as I am a wintel engineer attempting to get to grips with Linux & Ansible.
Any plain text editor will work, having syntax highlighting for YAML and Jinja2 makes life more pleasant and some of us are so used to it that we can’t live without it.
Assuming you are using git for your code then IDE that comes with the SCM system you are using (eg GitLab or GitHub etc) might work for you also.
Thanks very much for replying to my very first post.
As explained I am a complete and utter novice with all this (Linux, Ansible, Git etc, etc). Not even sure if I am using GIT. All I have a the minute is one Linux control node and an additional 2 Linux boxes. Also, 4 vm Azure servers which I would like to use as test servers.
You kindly responded saying that i could utilise any plain text editor but how would I use that if I am logged into the Linux control node?
Sorry if this is a stupid question I really have no idea what / how to use txt editor with ansible.
If you need to use a console text editor that is easy to start with then nano should be quicker to get going with than vim, it should be available from your distro if not already installed.
If you are using an editor on the Linux node itself, vim or nano - both are widely used, both have pros and cons, you can google to find easy instructions on how to use either.
I personally use VS Code on my machine, and use the Remote-SSH setup to connect to the Linux server and files. I personally can’t stand to use vim or nano for extended coding, but that’s me…
VSCode, that looks interesting. I assume I can install that on my workstation or windows server and create a playbook, which is located on my workstation \ Server. However, what i fail to understand is when I have created a playbook where \ how do I run that on a Linux \ Ansible machine so that it carries out the instructions. Or am i missing something.
Regards jrglynn2 for taking the time out to reply.
VSCode also works natively on Linux, so if you have a DE or X11 + an X-Server setup, you can open VSCode directly on your Ansible node and work there instead.
I am attempting to connect to my sandbox azure server via ssh using vscode. It does not want to connect for some reason. I have installed the vscode app on my desktop started the Linux vm in azure and attempted to connect using ssh xxxxx from my desktop.
Any ideas what might be happening or how I could connect to this linux host?
There are numerous restrictions on our local pc’s I think its better to create a new vm in azure sandbox install vscode from there and then attempt the ssh connection to the linux host which is also part of the sandbox infra.
Not entirely sure where I need to configure or check this. My client machine (Firewall) or somewhere in the vscode application? Sorry I am confused.
I have created a port forwarding on the firewall from where I have installed the vscode application but I am still hitting the same exact problem when I attempt to connect to the Ansible Control Host Linus server.
The screenshot you posted above was the results of trying to connect to 10.102.80.211 so that is the machine that I’d suggest checking for AllowTcpForwarding in /etc/ssh/sshd_config.
I have managed to install vsscode onto my W2022 windows server, and I am able to ping the Linux - Ansible server, and also I can confirm that AllowTcpForwarding is available, however, when I attempt to SSH to the Linux - Ansible server I am getting the below error - I am able to ping the Linux - Ansible server from a cmd line on the W2022 windows server.
[13:27:41.628] Log Level: 2
[13:27:41.700] SSH Resolver called for “ssh-remote+10.108.0.8”, attempt 1
[13:27:41.703] “remote.SSH.useLocalServer”: false
[13:27:41.703] “remote.SSH.useExecServer”: true
[13:27:41.716] “remote.SSH.showLoginTerminal”: false
[13:27:41.716] “remote.SSH.remotePlatform”: {}
[13:27:41.716] “remote.SSH.path”: undefined
[13:27:41.716] “remote.SSH.configFile”: undefined
[13:27:41.716] “remote.SSH.useFlock”: true
[13:27:41.716] “remote.SSH.lockfilesInTmp”: false
[13:27:41.717] “remote.SSH.localServerDownload”: auto
[13:27:41.717] “remote.SSH.remoteServerListenOnSocket”: false
[13:27:41.717] “remote.SSH.showLoginTerminal”: false
[13:27:41.717] “remote.SSH.defaultExtensions”:
[13:27:41.717] “remote.SSH.loglevel”: 2
[13:27:41.718] “remote.SSH.enableDynamicForwarding”: true
[13:27:41.718] “remote.SSH.enableRemoteCommand”: false
[13:27:41.718] “remote.SSH.serverPickPortsFromRange”: {}
[13:27:41.718] “remote.SSH.serverInstallPath”: {}
[13:27:42.060] VS Code version: 1.89.1
[13:27:42.060] Remote-SSH version: remote-ssh@0.110.1
[13:27:42.060] win32 x64
[13:27:42.164] SSH Resolver called for host: 10.108.0.8
[13:27:42.165] Setting up SSH remote “10.108.0.8”
[13:27:42.186] Using commit id “dc96b837cf6bb4af9cd736aa3af08cf8279f7685” and quality “stable” for server
[13:27:42.195] Install and start server if needed
[13:27:48.285] Checking ssh with “C:\Windows\system32\ssh.exe -V”
[13:27:48.290] Got error from ssh: spawn C:\Windows\system32\ssh.exe ENOENT
[13:27:48.290] Checking ssh with “C:\Windows\ssh.exe -V”
[13:27:48.291] Got error from ssh: spawn C:\Windows\ssh.exe ENOENT
[13:27:48.292] Checking ssh with “C:\Windows\System32\Wbem\ssh.exe -V”
[13:27:48.293] Got error from ssh: spawn C:\Windows\System32\Wbem\ssh.exe ENOENT
[13:27:48.293] Checking ssh with “C:\Windows\System32\WindowsPowerShell\v1.0\ssh.exe -V”
[13:27:48.295] Got error from ssh: spawn C:\Windows\System32\WindowsPowerShell\v1.0\ssh.exe ENOENT
[13:27:48.295] Checking ssh with “C:\Windows\System32\OpenSSH\ssh.exe -V”
[13:27:48.390] > OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
[13:27:48.398] Running script with connection command: “C:\Windows\System32\OpenSSH\ssh.exe” -T -D 49856 “10.108.0.8” bash
[13:27:48.403] Terminal shell path: C:\Windows\System32\cmd.exe
[13:28:05.405] Resolver error: Error: Connecting with SSH timed out
at g.Timeout (c:\Users\prfadmin.vscode\extensions\ms-vscode-remote.remote-ssh-0.110.1\out\extension.js:2:499307)
at Timeout._onTimeout (c:\Users\prfadmin.vscode\extensions\ms-vscode-remote.remote-ssh-0.110.1\out\extension.js:2:618713)
at listOnTimeout (node:internal/timers:569:17)
at process.processTimers (node:internal/timers:512:7)
[13:28:05.495] ------
[13:28:06.307] Opening exec server for ssh-remote+10.108.0.8
[13:28:06.653] Initizing new exec server for ssh-remote+10.108.0.8
[13:28:06.660] Using commit id “dc96b837cf6bb4af9cd736aa3af08cf8279f7685” and quality “stable” for server
[13:28:06.667] Install and start server if needed
[13:28:09.858] > ssh: connect to host 10.108.0.8 port 22: Connection timed out
e]0;C:\Windows\System32\cmd.exeaThe process tried to write to a nonexistent pipe.
[13:28:09.859] Got some output, clearing connection timeout
[13:28:11.127] “install” terminal command done
[13:28:11.128] Install terminal quit with output: ssh: connect to host 10.108.0.8 port 22: Connection timed out
[13:30:59.174] getPlatformForHost was canceled
[13:30:59.177] Exec server for ssh-remote+10.108.0.8 failed: Error: Connecting was canceled
[13:30:59.179] Error opening exec server for ssh-remote+10.108.0.8: Error: Connecting was canceled
I wondered if you both might have some clue of what is wrong.