Sobes.tech
Junior — Middle

What programming languages are used for writing Ansible roles?

sobes.tech AI

Answer from AI

Ansible roles are primarily written in YAML — this is the main language for describing playbooks and roles in Ansible. Additionally, Python can be used to extend the functionality of roles, for example, to write custom modules, filters, or plugins. Thus, the main language is YAML, and for more complex logic — Python.

An example of a simple task in a role using YAML:

- name: Install nginx package
  apt:
    name: nginx
    state: present

If logic is needed, a module can be written in Python.