> For the complete documentation index, see [llms.txt](https://docs.ionos.com/cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ionos.com/cloud/ansible/tutorials/05__introducing_roles/part-2.yml.md).

# part-2.yml.md

The source files for this tutorial can be downloaded from its [GitHub repository](https://github.com/ionos-cloud/module-ansible/tree/master/docs/), or cloned into your current working directory using the command `git clone https://github.com/ionos-cloud/module-ansible.git` before changing into the `module-ansible/docs/tutorials/05__introducing_roles` sub-directory.

{% code title="01\_\_create\_jumpbox\_and\_nlb.yml" overflow="wrap" lineNumbers="true" %}

```yml
---
# Unlike main.yml (which communicates with the IONOS CLOUD Ansible module via
# localhost), _this_ playbook is run on / within the VM
- hosts: example-server


  vars:
    # roles that will be applied iterately at the _end_ of this play --- note
    # that 'common/base-server' is explicitly applied below (e.g. to update
    # the system's packages), while the nfs-server and -client roles are also
    # applied explicitly due to their role-specific parameters
    roles_to_apply:
      - common/fail2ban
      - docker-server




  tasks:
    # Perform some basic / preparatory tasks
    - name: Update repositories cache and upgrade the system
      ansible.builtin.apt:
        upgrade: dist
        update_cache: yes
        cache_valid_time: 3600


    - name: Gather the package facts
      ansible.builtin.package_facts:
        manager: auto




    # An example of the simplest way to include a role
    - name: Apply the common 'base-server' role
      include_role:
        name: common/base-server




    # Examples of how variables can be passed to included roles
    - name: Apply the 'nfs-server' role
      include_role:
        name: nfs-server
      vars:
        - export_root: /export
        - export_specifier: "127.0.0.1(ro,sync,no_subtree_check,no_root_squash)"


    - name: Apply the 'nfs-client' role
      include_role:
        name: nfs-client
      vars:
        nfs_mount_point: /mnt
        nfs_server_path: "127.0.0.1:/export"




    # And finally, an example of how one might apply a list of roles
    - name: And apply the remaining roles to target system
      include_role:
        name: "{{ role }}"
      with_items: "{{ roles_to_apply }}"
      loop_control:
        loop_var: role

```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.ionos.com/cloud/ansible/tutorials/05__introducing_roles/part-2.yml.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
