228 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
0
votes
1
answer
56
views
How to run an Ansible role for different hosts and parameters
I have an Ansible role to install Nginx config files, and I want to use it to install different files on different sets of hosts. Here's the playbook:
- name: Deploy centralised Nginx services
...
0
votes
0
answers
54
views
Combining rescuse-handlers and run_once in roles
I came across something interesting while refactoring an existing Ansible playbook.
Here is a reduced version of it:
|_ showcase.yml
\_ sc_role
\_ tasks
|_ main.yml
\_ block-with-...
1
vote
2
answers
192
views
Can't update properties in Ansible role for Prometheus
I am trying to use Prometheus Role: https://github.com/prometheus-community/ansible
I created a playbook - playbook.yaml, with the following content:
---
- hosts: prometheus-server
become: true
...
0
votes
1
answer
697
views
ansible include vars from folder different that vars folder for roles
In ansible project I have a folder with multiple yaml files with variables. I am fetching these variables to playbook using include_vars module. But now I have to fetch these variables from roles used ...
1
vote
1
answer
226
views
Ansible: build shell command depending on variables set
Let's say I would like to run the following task from ansible:
- name: dns-cloudflare | Request certificate
ansible.builtin.shell:
cmd: certbot certonly \
--dns-...
2
votes
1
answer
714
views
Is there a way to specify the roles path in an ansible requirements.yaml?
I'm installing an ansible plugin with the following command
ansible-galaxy install -f -p /usr/share/ansible/plugins/lookup git+https://github.com/kemcon/ansible-modules-bitwarden
I would like to add ...
0
votes
1
answer
137
views
Execute handler as idempotent approach
I struggle with the following issue:
- name: Mount installer iso (Debian)
become: true
block:
- name: Create mnt dir
ansible.builtin.file:
path: "/mnt/{{ package }}"
...
-2
votes
1
answer
508
views
Why can't this ansible role (geerlinguy.postgresql) find the variables?
I have the following Ansible Playbook:
- hosts: vdtreportlive
vars_files:
- ./vars/postgresql.yml
- ./vars/postgresql_report.yml
roles:
- role: geerlingguy.postgresql
When I run this, ...
-1
votes
1
answer
654
views
Ansible role with a loop on variables
I have a role called application_management. In the tasks folder the main.yml contains :
---
- name: "{{ item }}"
include_tasks: '{{ item }}.yml'
loop: "{{ role_actions }}"
...
1
vote
2
answers
396
views
How to create custom type (or validator) in ansible role argument specification?
I want to write role about network configuration, in my role many variable exist that only accept IP value. so I want to check this constraint in role argument specification. but I do not know how to ...
1
vote
0
answers
1k
views
Filter plugin can no longer be found when using ansible collections
I have a repository I am using to host an ansible collection, it contains an example task within the t1 role, using a custom filter plugin I have created:
---
# tasks file for t1
- name: "...
0
votes
1
answer
1k
views
Ansible: best way to handle default variables in a collection
I've written an ansible script to install a web application made of several components. While I've originally written it as a collection of several roles, I'm wondering whether this is the best way to ...
1
vote
2
answers
2k
views
Ansible role to filter host based on host variables
I am trying to create a ansible role which filter out host based on dictionary(passed to role) in comparison with host variables. If host variables contains key:value from dictionary it will added to ...
2
votes
2
answers
722
views
How to mark an Ansible Role in a Collection as deprecated?
I manage an Ansible Collection on Ansible Galaxy with multiple roles in it and want to mark some of those roles as deprecated. How can I do this?
In the Ansible documentation there is only a solution ...
1
vote
0
answers
132
views
Ansible: idiomatic way to expose different functionalities with one role
I'm writing Ansible roles, one role per 'service' / part of infrastructure that I'm managing. Let's say that' I'm managing some webserver, which is a part of a larger system. The whole system is ...