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

Calling an Ansible task in a parent role with different values

I've created two very simple Ansible roles called base and web. web is dependent on base and this dependency is defined in web/meta/main.yml. base has the following task defined in base/tasks/main.yml: - name: install required packages apt: …
pwaring
  • 3,032
  • 8
  • 30
  • 46
0
votes
1 answer

How to call a taggued tasks on only one role in a playbook?

I have a playbook than lauches multiple rôles, one of them manage the install and the uninstall of sophos antivirus. It can handle the installation or the unistallation using tags but musn't obviously do booth a the same time. So my question is how…
Junn Sorran
  • 317
  • 2
  • 4
  • 12
0
votes
0 answers

Unable to run command using Sudo in Ansible

I’m running an Ansible job wherein I’m switching the user to a Service Account to run a certain command. I am able to switch the user and confirm the same using the become method and then a raw: whoami. When in the same scenario post the become…
0
votes
1 answer

How to loop through dict of lists and pass variables into Ansible role?

I have an Ansible role that uses the variables: connection_name, connection_ip, etc. in order to create a connection. In my hosts files, I could have numerous "connections" and have defined it as a dictionary of lists: host_file: hosts: …
hotcheetos
  • 29
  • 1
  • 6
0
votes
1 answer

Ansible - running playbook on specific host group with same naming convention in inventory

Lets say I have this type of inventory which consists similar names for subgroups under the main group but with different server ip's at the end. The names are similar because thats the naming convention that I would like to use and I want only the…
rivar_
  • 334
  • 1
  • 4
  • 17
0
votes
1 answer

Managing a large amount of Ansible roles

We are working on converting our project to Ansible. Due to the scale of the project, we will need a large amount of roles (30+). Where we're running into problems is how to store and manage these roles. Things we have considered: 1) Github repo per…
pasquers
  • 772
  • 1
  • 8
  • 24
0
votes
3 answers

Update Ansible Galaxy Page

I've committed a role to galaxy.ansible.com Now I've pushed some changes to the README files on Github. How do I tell galaxy.ansible.com to re-read the Github repositories?
A. Gardner
  • 571
  • 2
  • 7
  • 17
0
votes
0 answers

Passing in a single variable to a list of variables defined in an Ansible Role

I have an Ansible role with a list of variables. In my playbook I need to change one item in that list. How can I pass just the single list item to the role rather than another list? roles/updatexmlData/defaults/main.yml --- xmldata: - field1:…
Wanderer
  • 544
  • 1
  • 7
  • 23
0
votes
1 answer

Ansible No Content Found in Repository

I'm trying to import a role into Ansible galaxy but getting the error: No content found in repository Using: ansible-galaxy import Dynatrace-Adam-Gardner Dynatrace-Plugin-Development-Ansible This also fails via the galaxy website. I don't see…
A. Gardner
  • 571
  • 2
  • 7
  • 17
0
votes
1 answer

Run a subtask of a role in an Ansible playbook breaks relative paths

I am looking for a way to run a role, or a part of a role included in a playbook, from the root of my project. What I need it to be able to run a part of a role, as a playbook, so that I don't need to run something like (see example…
matt
  • 1,046
  • 1
  • 13
  • 26
0
votes
1 answer

Second role execution overrides default parameter value

I have an ansible role that defines two parameters and a default for the second one. roles/upstream/tasks/main.yml: --- - debug: msg: "Parameter in upstream is {{param}} and param2 is {{param2}}" roles/upstream/defaults/main.yml: --- param2:…
languitar
  • 6,554
  • 2
  • 37
  • 62
0
votes
1 answer

Creating Ansible role for services addition to nagiosXI

I am trying to add a service to the NagiosXI with the below CURL command. curl -k -XPOST "https://16.231.22.60/nagiosxi/api/v1/config/service?apikey=qfOQpKFORCNo7HPunDUsSjW7f2rNNmrdVv3kvYpmQcNdSS2grV2jeXKsgbv3QgfL&pretty=1" -d "host_name=***{{ item…
user9698169
0
votes
1 answer

Ansible: import_role doesn't expose variables to a playbook

My ultimate goal is to load some hashes (or dictionaries) with variables used as constants. A dedicated role seems perfect for that purpose as it can be reused in many playbooks. The Using Roles chapter in Ansible docs says: If…
gadamiak
  • 179
  • 2
  • 10
0
votes
1 answer

In ansible how to initialise a variable from another variable?

In an Ansible role, how to define a variable depending on another one? I am designing a role and want its interface to understand a playbook variable like framework_enable_java = yes or framework_enable_java = mysql tomcat and want to write a…
Michaël Le Barbier
  • 6,103
  • 5
  • 28
  • 57
0
votes
1 answer

Ansible roles workflow issue

I want to (step1) change postgresql configuration file, (step2) restart service and then (step3) add db user. ../roles/postgres/tasks/main.yml - name: change postgre pg_hba.conf template: src=pg_hba.conf.j2…
Roy Zeng
  • 511
  • 7
  • 10