For advanced users with existing Ansible playbooks and greater customisation needs, it is possible to just pick and choose roles you are interested and include them into your own playbooks, instead of running separate playbooks. You can find the URLs for each of the dependant roles in the requirements.yml file. Make sure the necessary roles are installed. For that you may install them with ansible-galaxy either individually or writing your own requirements.yml . See the official Ansible documentation for more details on how to create such file.
No Format |
---|
ansible-galaxy role install -r requirements.yml roles/ | In your playbook, you can - Open your playbook file and include the roles that you are interested in. For example, here is a playbook that includes 3 roles and customises some
variables - variable:
Code Block |
---|
language | yaml |
---|
title | myplaybook.yml |
---|
| ---
- hosts: all
become: yes
vars:
conda_prefix: /opt/conda
tasks:
- name: Mars client
ansible.builtin.include_role:
name: ewc-ansible-role-mars-client
- name: ML basic stack
ansible.builtin.include_role:
name: ewc-ansible-role-ml-basic
- name: Anemoi
ansible.builtin.include_role:
name: ewc-ansible-role-ecmwf-anemoi
|
See the official Ansible documentation for more information on roles and how to include them. - Make sure the necessary roles are available before you run the playbook. For that you may install them with
ansible-galaxy either individually or writing your own requirements.yml . For the example above, this could be a requirements.yaml file:
Code Block |
---|
language | yaml |
---|
title | requirements.yml |
---|
| ---
# Ansible Requirements
roles:
- name: ewc-ansible-role-mars-client
src: https://github.com/ewcloud/ewc-ansible-role-mars-client.git
version: main
- name: ewc-ansible-role-conda
src: https://github.com/ewcloud/ewc-ansible-role-conda.git
version: main
- name: ewc-ansible-role-ml-basic
src: https://github.com/ewcloud/ewc-ansible-role-ml-basic.git
version: main
- name: ewc-ansible-role-anemoi
src: https://github.com/ewcloud/ewc-ansible-role-anemoi.git
version: main |
See the official Ansible documentation for more details on how to create such file. - Install the roles with
ansible-galaxy :
No Format |
---|
ansible-galaxy role install -r requirements.yml roles/ |
- Run the playbook
No Format |
---|
$ ansible-playbook -i inventory myplaybook.yml |
Tip |
---|
title | Further customisation |
---|
| Check each specific role documentation in the URLs above to see all the variables you may customise when running the automation. |
|