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 to a mapped variable

I have an ansible tomcat role defaults/main.yml tomcat_http: port: "8080" protocol: "HTTP/1.1" connectionTimeout: "120000" URIEncoding: "UTF-8" I have another role (app) which uses tomcat role as a dependency and looks like…
harnex
  • 953
  • 1
  • 7
  • 8
0
votes
2 answers

Ansible: How do you populate a variable with the value of a pattern/substring on a line in a remote file?

I have a remote server with a file on it. One line in that file is the following: authorizationToken= I'd like to set a variable in a role to the value of whatever's after the equals sign on that line, if anything (it might be…
iLikeDirt
  • 606
  • 5
  • 17
0
votes
1 answer

How to add a role dependency outside of galaxy?

I'm creating a company set of Ansible roles. One of them relies upon another. All of these roles are hosted on their specific Gitlab repositories (one per role, obviously). Instead of messing up with requirements.yml, I do prefer to use the…
Riduidel
  • 22,052
  • 14
  • 85
  • 185
0
votes
1 answer

Can't install python, pip related apps through Ansible

I am using below ansible yml file to install python, pip, etc. roles/python/main.yml: --- - name: python apt: pkg: python - name: python-pip apt: pkg: python-pip - name: mongopy pip: pkg: mongopy - name: mtools pip: pkg:…
Joey Yi Zhao
  • 37,514
  • 71
  • 268
  • 523
0
votes
1 answer

Passing variable as tags to ansible roles does not work

I pass a variable ACTION to site.yml as below. ansible-playbook -v -i sslhost.txt -e "APP_NAME=ssl-perf ACTION=renewal, gen_cert" site.yml My site.yml has ansible role called "manager" to which i m passing ACTION variable as tags. See below. more…
shifahim
  • 127
  • 1
  • 7
  • 19
0
votes
2 answers

Check Multiple conditions in Ansible include

My ansible role has this main.yml more tasks/main.yml --- - include: ssl_pull.yml when: ACTION == 'renewal' - include: ssl_gen.yml when: ACTION == 'generate' - include: ssl_push.yml when: ACTION == 'install' - include: ssl_install.yml …
shifahim
  • 127
  • 1
  • 7
  • 19
0
votes
1 answer

Ansible - Create multiple config files using the same template in a role

I have found a similar question: Creating multiple times the same role, but with different items but I do not know how I can use it with the group_vars directory structure. My Question How can I use a role with a template inside of it to create…
camdixon
  • 852
  • 2
  • 18
  • 33
0
votes
1 answer

How to give role dependencies path in Ansible?

I want to include role dependency. However looks like it downloads from galaxy. I already have a role in pc. How do I provide a path to it in "meta" file. Say, I want to install a ROLE_B which is dependent on ROLE_A. Here is the structure I…
MMA
  • 408
  • 3
  • 7
  • 19
0
votes
1 answer

Store Ansible variables in Jenkins

We recently integrated Ansible deployment with Jenkins. All looks good and the next step is to find a way to store all playbook variables. What is the best practice for that? We want to have different set of variables for each environment (Dev, QA,…
ADS
  • 11
  • 2
0
votes
3 answers

Variable is undefined error when passing argument to Ansible roles

I am new to ansible roles here is what i am doing. more site.yml --- - hosts: user1_checkserverlist user: user1 roles: - { role: speed_manager, DNAME: "/u" } - hosts: oracle_checkserverlist user: oracle roles: - { role:…
0
votes
1 answer

Handler dependencies for Ansible

I have a role which configures /etc/network/interfaces.d/ethX. It has handler 'restart interface' which is called through notifications. But there are few programs which are listen on that interface and should be restarted if I changed anything in…
George Shuklin
  • 6,952
  • 10
  • 39
  • 80
0
votes
2 answers

Ansible: include_role on a loop running unexpected number of times

I am trying to use include_role with items --- - hosts: cluster tasks: - block: - name: Execute test role include_role: name: testrole with_items: - 'one' ... My role is --- - name: Just debugging …
Alberto Rivera
  • 3,652
  • 3
  • 19
  • 33
0
votes
1 answer

Generate ansible role variable locally

We have a new open source ansible role that automates compilation of some custom router (OpenWRT) images called openwisp2-image-generator The root password of the root user can be defined in the playbook YAML, but the process to do so is…
nemesisdesign
  • 8,159
  • 12
  • 58
  • 97
0
votes
1 answer

Set Ansible role defaults conditionally

Pseudocode: If env is de, set variable name to hello else if env is prod, set variable name to bye. I tried https://serverfault.com/questions/715769/ansible-change-default-value-according-to-a-condition - name: setting variable set_fact:…
unknown
  • 15
  • 3
0
votes
1 answer

Ansible executing all includes in role

I have the following includes in a old role by a colleague. --- - name: deploy include: deploy.yml when: deploy is defined and deploy == 'True' - name: undeploy include: undeploy.yml when: undeploy is defined and undeploy == 'True' -…
Carl Wainwright
  • 328
  • 5
  • 18
1 2 3
14
15