# Playbook Editor

**URL:** <https://forum.ansible.com/t/playbook-editor/5902>\
**Category:** Get Help\
**Tags:** playbook, netbox\
**Created:** [May 21, 2024, 8:12am UTC](https://forum.ansible.com/t/playbook-editor/5902 "2024-05-21T08:12:51Z")\
**Posts on this page:** 12\
**Page:** 2

<div class="post-metadata">

**Author:** ![chris](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/chris/32/293_2.png) [@chris](https://forum.ansible.com/u/chris)\
**Post date:** [May 24, 2024, 2:04pm UTC](https://forum.ansible.com/t/playbook-editor/5902/21 "2024-05-24T14:04:43Z")

</div>

I’ve not used Windows since '98, sorry…

---

<div class="post-metadata">

**Author:** ![alainseys](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/alainseys/32/2757_2.png) [@alainseys](https://forum.ansible.com/u/alainseys)\
**Post date:** [May 24, 2024, 5:35pm UTC](https://forum.ansible.com/t/playbook-editor/5902/22 "2024-05-24T17:35:19Z")

</div>

My enviroment is WSL on windows works fine with vscode

Used Plugins:  
ansible  
ansible Core snipets  
indent-rainbow

i test localy inside a virtual envirtoment in python when that works i push the submodule. And my awx controller has a webhook that picks up the changes.

And then i can executte the playbook / roles on a remote machine.

I have used to work on a remote server but that returned me some issues next week i need to pick this back up since a new engineer wil joining the ansible squad.

So i will test the same out vscode on a remote server with ssh signing should work the same.

---

<div class="post-metadata">

**Author:** ![czql5v](https://avatars.discourse-cdn.com/v4/letter/c/e56c9b/32.png) [@czql5v](https://forum.ansible.com/u/czql5v)\
**Post date:** [May 28, 2024, 7:14am UTC](https://forum.ansible.com/t/playbook-editor/5902/23 "2024-05-28T07:14:44Z")

</div>

Hi Alainsyes,

Thanks for the reply. This is my problem I know virtually nothing about wsl, or you mentioned python, I am not even sure how vscode works. For example I can create a small simple Ping playbook but have absolutely no idea how to actually run it from vcode once I have SSH to my Linux server.

Perhaps I don’t even need to ssh to my Linux server - can I create the playbook in vscode save the file, transfer to Linux and then run it from there, or even run directly from vscode.

Any help, guidance would be extremely usefull.

Thanks.

---

<div class="post-metadata">

**Author:** ![utoddl](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/utoddl/32/249_2.png) [@utoddl](https://forum.ansible.com/u/utoddl)\
**Post date:** [May 28, 2024, 11:13pm UTC](https://forum.ansible.com/t/playbook-editor/5902/24 "2024-05-28T23:13:14Z")

</div>

I’m an old curmudgeon, so feel free to ignore me…

… However, I do think there’s value in slogging through your first playbooks with minimal tools, typing in all the keywords and values, messing up and fixing the indentation by hand, etc. True, it forces you to slow down. But that’s the point. It’s important to learn at a low level how all the pieces work together. Then as you add more powerful tools, not only can you better appreciate what they do for you, you’re better able to cope when something’s not right.

There’s a risk that you’ll reach a high-enough plateau to be marginally productive without ever learning to take advantage of all the fancy features of tools like VSCode. [_Looks at mirror; yep, there I am._] That’s a personal decision, though, of when to focus on X vs. Y. Sometimes you have to get stuff done; sometimes you take the time to learn how to do it better tomorrow.

Good luck!

---

<div class="post-metadata">

**Author:** ![alainseys](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/alainseys/32/2757_2.png) [@alainseys](https://forum.ansible.com/u/alainseys)\
**Post date:** [May 29, 2024, 8:41am UTC](https://forum.ansible.com/t/playbook-editor/5902/25 "2024-05-29T08:41:47Z")

</div>

You should have ssh connection to your remote server then you can use the remote server

to test the code first localy you can use some local parameters like you can see bellow

```auto
---
- name: Query netbox test
  hosts: localhost # Local testing parameters - remote server should be here
  connection: local # If remote remove this
  
  tasks:
    - name: GET > available IPS from the specified range
      ansible.builtin.uri:
        url: "{{ NETBOX_API_URL}} ipam/ip-ranges/{{ ip_range_id }}/available-ips/"
        method: GET
        headers:
          Authorization: "Token {{ netbox_api_token }}"
        validate_certs: false

```

How i started with ansible is first local on the server itslef using vi.  
Then moved to vscode on a remote server, then i introduced myself with awx controller.

Then added WSL to my dev stack with git repos to awx and now this is still my development flow (i dont test localy anymore , i test on some development servers where a snapshot is been created before executed).

---

<div class="post-metadata">

**Author:** ![alainseys](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/alainseys/32/2757_2.png) [@alainseys](https://forum.ansible.com/u/alainseys)\
**Post date:** [June 4, 2024, 2:00pm UTC](https://forum.ansible.com/t/playbook-editor/5902/26 "2024-06-04T14:00:00Z")

</div>

> [@czql5v](#):
>
> w virtually nothing about wsl, or you mentioned python, I am not even sure how vscode works. For example I can create a small simple Ping playbook but have absolutely no idea how to actually run it from vcode once I have SSH to my Linux server.
> 
> Perhaps I don’t even need to ssh to my Linux server - can I create the playbook in vscode save the file, transfer to Linux and then run it from there, or even run directly from vscode.

Hy i come back to this again i have tested this out with a remote server the only issues you might run into on a remote server. Is that you need to setup a ssh key and a fixed user to run remotly on the server.

Then you can add ansible & ansible-lint inside a virtual pyhthon enviroment to do your develoment.

I still recomend WSL it takes all of the hasle away from a remote server and if you setup your flow with git, you can easy deploy to a production enviroment with git or with AWX / Tower.

This is my dev stack  
Local:

- WSL (python virtual enviroment with the depencies i need)
- Python Dependencies: ansible, ansible-lint,jmeshpath,pywinrm,pyVim
- VSCODE
- Plugins: Ansible, indent-rainbow, rainbox-csv, YAML
- Git

my flow is :

test code locally , when i am satified with the results is push te code in to the submodule in git.

in my awx controller i have a webhook that pulls in the code from git

---

<div class="post-metadata">

**Author:** ![utoddl](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/utoddl/32/249_2.png) [@utoddl](https://forum.ansible.com/u/utoddl)\
**Post date:** [June 4, 2024, 2:17pm UTC](https://forum.ansible.com/t/playbook-editor/5902/27 "2024-06-04T14:17:39Z")

</div>

> [@alainseys](#):
>
> push t[h]e code in to the submodule in git

I’m intrigued by this bit. How are your projects structured such that git submodules play a part? We had talked about submodules at one point (long ago), and we didn’t see a problem at the time for which submodules looked like the solution - _for us_. I’d happily revisit the idea, though.

---

<div class="post-metadata">

**Author:** ![alainseys](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/alainseys/32/2757_2.png) [@alainseys](https://forum.ansible.com/u/alainseys)\
**Post date:** [June 11, 2024, 4:51pm UTC](https://forum.ansible.com/t/playbook-editor/5902/28 "2024-06-11T16:51:31Z")

</div>

> [@utoddl](#):
>
> m intrigued by this bit. How are your projects structured such that git submodules play a part? We had talked about submodules at one point (long ago), and we didn’t see a problem at the time for which submodules looked like the solution - _for us_. I’d happily revisit the idea, though.

Hy @utoddl ,

my project sturcture is like this

- linux
  - modules
    - unattended-updates (submodule)
    - user-management (submodule)
    - firewall-management (submodule)

- windows
  - modules
    - firewall-managemnt (submodule)
    - …

With cetain submodules i have a webhook attached so if a dev changes a module this triggers the webhook on the awx part and the hosts that are using that role are getting the latest changes.

---

<div class="post-metadata">

**Author:** ![utoddl](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/utoddl/32/249_2.png) [@utoddl](https://forum.ansible.com/u/utoddl)\
**Post date:** [June 12, 2024, 8:25pm UTC](https://forum.ansible.com/t/playbook-editor/5902/29 "2024-06-12T20:25:04Z")

</div>

Interesting. We’re kind of like that, except we’re an all-Linux shop (not judging!), and what you have as submodules are for us each a role – of 51 at the moment – in one mega-project. It’s a small enough team that more granularity didn’t seem necessary. Roles range from `auditd` to `zabbix`; some with single-digit file counts, but four of them have over 80 files each. And we have 189 host\_vars files, 271 group\_vars files in the one project. We do a bunch of name-based variable merging, too.

You don’t see such numbers shared much in public, so I have no idea how that compares to other real-world projects. _[maybe should run a pole… hmm.]_

---

<div class="post-metadata">

**Author:** ![geoffreyvanwyk](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/geoffreyvanwyk/32/995_2.png) [@geoffreyvanwyk](https://forum.ansible.com/u/geoffreyvanwyk)\
**Post date:** [June 13, 2024, 6:19am UTC](https://forum.ansible.com/t/playbook-editor/5902/30 "2024-06-13T06:19:31Z")

</div>

VS Code also has an Ansible extension.

---

<div class="post-metadata">

**Author:** ![alainseys](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/alainseys/32/2757_2.png) [@alainseys](https://forum.ansible.com/u/alainseys)\
**Post date:** [June 13, 2024, 8:12am UTC](https://forum.ansible.com/t/playbook-editor/5902/31 "2024-06-13T08:12:13Z")

</div>

> [@utoddl](#):
>
> ou don’t see such numbers shared much in public, so I have no idea how that compares to other real-world projects. _[maybe should run a pole… hmm.]_

Submodules gives us the flex that we can assign a developer to a specefic role without exposing the full project to him.

It is al depending on how your workflows are setup

---

<div class="post-metadata">

**Author:** ![IPvSean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/ipvsean/32/1153_2.png) [@IPvSean](https://forum.ansible.com/u/IPvSean)\
**Post date:** [June 14, 2024, 5:27pm UTC](https://forum.ansible.com/t/playbook-editor/5902/32 "2024-06-14T17:27:09Z")

</div>

I second this. I highly recommend learning visual studio code! Here is a quick video I made: [https://youtube.com/shorts/UFPpr2L7YDg?si=jQW20TKmAaA22uVB](https://youtube.com/shorts/UFPpr2L7YDg?si=jQW20TKmAaA22uVB)

[Previous page](https://forum.ansible.com/t/playbook-editor/5902.md?page=1)
