Ansible development environment

11,480

Solution 1

JetBrains-based IDEs have a YAML/Ansible plugin to add some context and syntax highlighting to Ansible playbook structure.

Sublime has a plugin to add syntax highlighting to Ansible files https://github.com/clifford-github/sublime-ansible

Both tools can display folder structure and connect using sftp/ssh to remote servers.

Solution 2

Vim is not considered an IDE by all, but I (work on and) use Rocannon for Ansible every day for its auto-completion, syntax highlighting, built-in help and other IDE-like features.

Vim is not a very quick learn, but it is light. :)

There's a GIF demo on the Rocannon github page to give you a feel for what it offers.

Solution 3

Here is the official list of IDE's or editors: https://docs.ansible.com/ansible/latest/community/other_tools_and_programs.html#popular-editors

Currently it seems your best option is Visual Studio Code since it has auto-completion and syntax highlighting specifically for Ansible.

Solution 4

Ansible SHOULD have an IDE that validates both the YAML lint and the syntactical errors of ansible itself (version dependent). It is such a waste of time to have to run and debug and run into things over and over, the latest example being this: "msg": "unsupported parameter for module: register"}

When all you do is:

- name: gather rds instance facts
  rds:
    command: facts
    instance_name: "{{ wp_db_instance }}"
    register: database_facts

vs:

- name: gather rds instance facts
  rds:
    command: facts
    instance_name: "{{ wp_db_instance }}"
  register: database_facts

Notice the indentation. Which is why YAML is a pain.

Solution 5

I wrote a plugin for IntelliJ-based IDEs that help working with ansible files. it auto-complete all fields and can detect roles and suggest them.

https://plugins.jetbrains.com/plugin/14893-ansible

Share:
11,480
Na Na
Author by

Na Na

Updated on June 28, 2022

Comments

  • Na Na
    Na Na almost 2 years

    Currently I'm developing ansible orchestration system. The project structure is something like this:

    site.yml webservers.yml fooservers.yml roles/ common/ files/ templates/ tasks/ handlers/ vars/ defaults/ meta/ webservers/ files/ templates/ tasks/ handlers/ vars/ defaults/ meta/

    As a result I have to deal with dozens of play-books, roles, subdirectories, tasks, variable files, so on. For now, I use WinSCP as a kind of IDE (I work from Windows dev machine) This solution is far from being perfect but allow me easy navigation among files and folders. In fact I miss Visual Studio (intellisense!) very much. I tried Eclipse installed on my dev machine before but it was too slow. I found shell tools rather uncomfortable. Due to corporate constraints I can not add any more VM-s.

    So, my question is: are there any Windows (or lightweight Ubuntu GUI) tools to deal with complicated structure of files and folders for Linux development?