Questions tagged [ansible-role]

Ansible role is a set of tasks to configure a host to serve a certain purpose like configuring a service, whereby they are defined using YAML files with a predefined directory structure, as part of the provisioning, configuration management, and application-deployment tool Ansible. Use this tag for questions related to the role tasks in Ansible.

Ansible role is a set of tasks to configure a host to serve a certain purpose like configuring a service, whereby they are defined using YAML files with a predefined directory structure, as part of the provisioning, configuration management, and application-deployment tool Ansible. Use this tag for questions related to the role tasks in Ansible.

224 questions
0
votes
1 answer

Ansible - passing a var if it exists

I am running an ansible playbook like this: ansible-playbook -i inventory/inventory1.yml playbooks/playbook1.yml --extra-vars "environment=my_env var=my_var" My inventory1.yml looks like this: ... children: env1: …
fr0zt
  • 733
  • 4
  • 12
  • 30
0
votes
0 answers

How do I download a specific file from GitHub in an Ansible role?

I have a YAML file filled with variables that I need to download with an Ansible role and this file lives within GitHub. In a temporary hacky way I first run a curl command to get the download URL using this URL:…
agw2021
  • 266
  • 2
  • 22
0
votes
1 answer

Install a specific version of a role with Ansible Galaxy

I'm installing an ansible role with: ansible-galaxy install geerlingguy.java But this command install the latest version. I need to install an old version like: ansible-galaxy install geerlingguy.java:1.10.0 But this command launches this…
Manel
  • 1
  • 2
0
votes
0 answers

Ansible - recursive argument_spec

I'm trying to create a role with argument validation via the meta/arguments_spec.yml file, and I'd like a user to be able to pass in a tree of arbitrary depth as one of the arguments. In other words, a valid family_tree argument might look…
user3781737
  • 932
  • 7
  • 17
0
votes
2 answers

Ansible can't find roles from collection

I got collection that has structure namespace/ ── collectionA/ ├── docs/ ├── galaxy.yml ├── README.md └── roles/ ├── roleA/ | └── tasks/ | ├──taskA.yml | ├──taskB.yml └──…
darvark
  • 314
  • 3
  • 15
0
votes
1 answer

How can I avoid getting a .travis.yml file automatically created inside my ansible role?

I have created several roles with ansible-galaxy init my_role and after a while I realized a .travis.yml file was created automatically for a basic syntax testing. I am not planning to use Travis CI, so this .travis.yml file is useless. I am sure…
RicHincapie
  • 3,275
  • 1
  • 18
  • 30
0
votes
2 answers

run ansible role with specific playbook

I have one ansible role with this structure: ── prepare-workstation.yaml ── group_vars └── roles ├── build-nginx-proxy │   ├── defaults │   ├── tasks │   └── templates │ └── nginx.yml │ ├── ca │   ├── defaults …
pyramid13
  • 266
  • 1
  • 5
  • 21
0
votes
1 answer

Sorting of strings variable in ansible playbook and display result in asending order

I have list of variable like, item-1, item-22, item-3, item-99 i need to display as result of ansible playbook in following form item-1, item-3, item-22, item-99. I tried with below syntax but no luck. - set_fact: sorted_list_values: "{{…
omankame
  • 59
  • 5
0
votes
1 answer

How to create a mail profile in my remote windows machine using ansible

I'm unable to create a mail profile in my remote windows machine which has Outlook 2016. I havw to create it using ansible. I tried this: - name: Manage windows server hosts: win tasks: - name: Setting up default account …
user8153380
0
votes
1 answer

How to check if a directory exists in Ansible playbook level(not in host) from within a role?

I have 2 ansible roles. rundeck_install rundeck_app rundeck_install role install the rundeck community edition. rundeck_app role installs jdk, mysql and rundeck(by using therundeck_install role) rundeck_install role has a task to copy all the…
anunaki
  • 989
  • 9
  • 16
0
votes
1 answer

Unable to set multiple conditions in when clause for ansible roles

My ENV is DEV while the instance_name is myapp44 Thus, i want the role for myapp7 to skip as the when condition fails. Below is my role that works fine and skips as the when clause fails. - { role: myapp7, ENV: "{{ENV}}", ACTION: "{{ACTION}}", when:…
Ashar
  • 2,942
  • 10
  • 58
  • 122
0
votes
1 answer

About enable/disable by conditional values in ansible yaml manifest

I want a variable on Ansible to be active or passive depending on the condition. I am using the role "davidwittman.redis". I'm setting up a redis cluster. I need to run a single yml file by deploying it to 3 servers at the same time. I can't…
spala
  • 85
  • 1
  • 2
  • 7
0
votes
1 answer

ansible roles split tasks/main.yml in multiple files

I want to split my tasks/main.yml into different files in my Ansible role. With defaults/ and vars/, Ansible supports the creation of a main directory instead of the main.yml, from which all *.yml files are included. Unfortunately, I can't find…
FDo
  • 17
  • 3
0
votes
1 answer

Ansible Role Structuring

I'm new to Ansible and currently building out a few plays to perform common tasks such as performing pre & post installs for our software in dev/test. A scenario I’m working on is configuring a server once spun up from TF using Ansible. Ansible…
0
votes
1 answer

Ansible collection with role-scope custom modules

I am trying to convert my pile of Ansible playbooks, roles, tasks, etc into a formalized Ansible Collection to better support re-use and modularity. The TL;DR is that I am having issues packaging a collection that includes a role that includes a…
enpaul
  • 246
  • 4
  • 13