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: using group vars in tasks

In Ansible, i want to trigger selected tasks based on hosts. My inventory: [appserver] ip1 ip2 [webserver] ip3 ip4 And my main.yml file will be like this - name : Playbook hosts: all user: username become: yes gather_facts: True …
Deepan
  • 119
  • 1
  • 2
  • 8
0
votes
1 answer

Ansible inventory for environment variables within a role

I got an Ansible role that Im wanting to execute a psql script with. The name of the role is "db_scripts" and I will list the contents of respective directories/files below. db_scripts/tasks/mail.yml - name: "Run the SQLS" command: "psql -f \"{{…
bindo
  • 87
  • 3
  • 18
0
votes
2 answers

What is the best way to manage unsupported distros in an Ansible role?

An Ansible role supports Debian Stretch and Buster. It is not able to do the job on Jessie or older versions. Which is the best way to tell the user that the role cannot be used on a given old version? Do nothing in main.yml file (controlling the…
Mat
  • 586
  • 2
  • 10
  • 25
0
votes
1 answer

Can't access json from rhel machine with older ansible version and python 2.x

I am executing the same request/task against an api with the uri module. When I execute from a mac on python 3.7.1 and ansible 2.8.1, it works. When I execute from a red hat linux machine with python 2.7.5 and ansible 2.4.2.0, it doesn't work and I…
Corey
  • 170
  • 2
  • 11
0
votes
1 answer

docker-compose unlink network from child containers when stopping parent containers?

This is a continuation of my journey of creating multiple docker projects dynamically. I did not mention previously, to make this process dynamica as I want devs to specify what project they want to use, I'm using ansible to up local env. Logic…
Bogdan Dubyk
  • 4,756
  • 7
  • 30
  • 67
0
votes
1 answer

ADF deployment is failing if the ADF objects are renamed

We've have renamed our ADF pipelines in the code and tried deploying them using "-role: ansible-role-azure-adf-deploy" role. But, the build is failing as it fails to delete the existing ADF objects. I've tried using the parameter…
Varun
  • 1
  • 1
0
votes
1 answer

What is the junos_install_config replacement module?

When using the junos_instal_config module from the Juniper.junos role for ansible in a playbook such as: --- - name: Send Set Files to Different Devices hosts: all roles: - Juniper.junos connection: local gather_facts: no tasks: -…
Maurio
  • 172
  • 3
  • 13
0
votes
1 answer

Ansible script module 'creates:' not generating file

I am running the script module in a role on a windows machine. I am attempting to use the "args: creates:" parameter. The script runs but the file that 'creates' is supposed to generate never gets created. When I run the playbook again the script…
yammering
  • 126
  • 8
0
votes
3 answers

handlers main.yml showing error handlers/main.yml file must contain list of tasks

I am building some role in handlers/main.yml I had spacified some handler jobs but I was unable to execute them. This is the error message: ERROR! The handlers/main.yml file for role 'sample-mysql' must contain a list of tasks The error appears…
0
votes
1 answer

Checkout the same branch for roles using requirements.yml in awx/ansible

I have a project git repository and a roles git repository both have branches with the same name, my project git repository has the requirements.yml similar to below --- - src: scm: git version: master path:…
Snipzwolf
  • 533
  • 1
  • 8
  • 22
0
votes
1 answer

How to pass a vault(vault-variable) to multiple roles where the roles themselves have multiple dependent-roles?

I'm running ansible 2.7.10 and have a playbook where I "include" different roles in different plays. All the roles I call have common dependent roles. I'm at a stage now where I want all the roles within that playbook to read a vault. This works if…
0
votes
0 answers

How to solve the templating error caused in the ansible role

I have been trying to write a role which has a variable that initiated to null and values are appended based on the Jinja filters applied on the items, But it frequently errors out in { "msg": "template error while templating string: expected…
TR007
  • 47
  • 1
  • 8
0
votes
1 answer

How do I create an Ansible Base Role locally?

Ansible roles for a common sensible base configuration for all machines. Should support RHEL/Debian/SuSE/Solaris/HPUX/Ubuntu Linux. The Base host configuration should perform the following tasks: ntp – configure NTP settings based on common…
user7563278
0
votes
1 answer

How to execute task on all hosts from group when playbook is executed with limited hosts?

Scenario I have a group A in my inventory, where A contains a1,a2,a3 hosts. It does mean that I can write in my playbook X.yml: - hosts: A roles: - role: name: r The problem is about playbook X is started with limited number of hosts,…
Tom
  • 7
  • 6
0
votes
1 answer

How to pass dynamic roles to Ansible playbook

Standard way of defining an Ansible playbook with roles is: --- - hosts: webservers roles: - common - webservers I would like to pass a single command line variable for the Ansible role. I mean to say there should be a single Ansible…
Balajee Venkatesh
  • 1,041
  • 2
  • 18
  • 39