74 questions
1
vote
1
answer
130
views
How can I ensure dependencies in a custom ansible module without having to copy the required libraries manually?
I have created an Ansible module, but I don't want to keep everything in one file, but split it into packages. In this respect, my custom module is dependent on these packages. When I run my playbook. ...
-3
votes
1
answer
164
views
Deploy artifact to multiple azure web apps using Ansible
I have jar file that i want to deploy to diffrent hosts using ansible
so i configured my inventory with the domains of my webapps
[webapps]
domainofwebapp1.com resource_group=RG web_app=WEBAPPname
...
0
votes
0
answers
201
views
How to specify a specific package version in Ansible for apt_rpm module
Target host for Ansible is AltLinux server v10.2.
Now I do not know how to specify a specific package version for installation via apt_rpm module.
In official doc https://docs.ansible.com/ansible/...
3
votes
1
answer
238
views
Ansible - Error when trying to stop a windows service with "$" in it
How to stop Windows services with special characters using Ansible win_service module?
I am facing an error when I try to stop SQL Server services using win_service module when the service has $ in it ...
3
votes
0
answers
115
views
In Ansible Python module, how to differentiate between options passed as argument and options with default value?
How can you differentiate between a non-required module parameter that's passed to an Ansible Python module with a null value, and a non-required module parameter that's not given in the invocation?
E....
3
votes
1
answer
1k
views
After running a SQL query using the ansible mysql_query module, how do I extract the data returned?
I have a playbook that is retrieving data from a test database, but I am unable to figure out how to extract the rows returned from the database.
The whole purpose of the exercise is to pull the value ...
0
votes
0
answers
252
views
Ansible Custom Module: How to implement conditional parameter?
I want to create a Custom Module call API which will take
action: get or search
resource: car/truck/plane/ship
optional parameters - dynamic parameter based on action and resource
For example if ...
2
votes
1
answer
555
views
Using a shared file in multiple ansible modules
I am currently developing a number of Ansible modules using Python.
My directory structure looks like this:
/
playbook.yml
library/
module1.py
module2.py
Using this, I can run the ...
5
votes
1
answer
2k
views
What are Ansible module attributes?
Each Ansible module's documentation page has an "Attributes" section.
For example, here is the one for the command module. It has these attributes: check_mode, diff_mode, platform and raw.
...
0
votes
0
answers
614
views
Ansible-Lint warning for custom module argument exception
I have a custom module to manage Keycloak realms. That module takes a long list of arguments including a sub-dictionary for smtp_server:
def keycloak_argument_spec():
return dict(
...
0
votes
1
answer
977
views
How do I get the latest Amazon LInux 2 ami using Ansible?
I'm using Ansible to provision AWS EC2 instances with the Amazon.Aws collection. On the cli, if I want to get the latest Amazon Linux 2 AMI I may run something like this:
$ aws ec2 describe-images \
...
1
vote
1
answer
350
views
How to use the options `sourcelist`, `sourceparts`, `List-Cleanup` in Ansible `apt` module?
I want to run the following apt command via an Ansible module.
apt-get update -o Dir::Etc::sourcelist="sources.list.d/mypackages.list" -o Dir::Etc::sourceparts="-" -o APT::Get::...
0
votes
1
answer
172
views
How to access tasks parameters from an Ansible task in the Python module code?
Is it possible to access Ansible tasks parameters from the Python module code?
Specifically, I would like to check if there is a register on the task in order to return a more complete info set.
1
vote
1
answer
618
views
Ansible should only print 'FAILED' after completion of all retries in until loop, not for every iteration
I have an Ansible task almost identical to the top answer here: Ansible playbook wait until all pods running
- name: Wait for all control-plane pods become created
shell: "kubectl get po --...
0
votes
0
answers
373
views
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, ...
2
votes
1
answer
774
views
Pass Ansible variables into custom Ansible module
I have a custom module that resides in the library/ directory of my Ansible role. I can call the module from within my playbook, and the code executes correctly, but only if the values it expects are ...
1
vote
1
answer
564
views
How to get args for an ansible module written in bash?
I wrote an ansible module is bash. It is working fine, but if want to pass arguments to that module and read them in the bash module how can I do that .. please help
- name: get top processes ...
0
votes
1
answer
179
views
Ansible modules parameter syntax
Why is it that on the playbook.yml under the command task to be executed, some modules have a quotation mark while some does not?
For example, if you check the syntax below, the module line is with ...
4
votes
1
answer
773
views
Can I specify that an argument can't be used with a specific choice in Ansible module spec?
I'm looking for a way of specifying that a module argument can't be used if another argument has a certain value.
You can specify required_if to require an argument if another argument has a specific ...
4
votes
1
answer
11k
views
Kubernetes Module appears to be missing but looks like it is installed
I get this error:
ERROR! couldn't resolve module/action 'kubernetes.core.k8s'. This often indicates a misspelling, missing collection, or incorrect module path.
However, I thought I installed it and ...
1
vote
0
answers
471
views
Ansible module for Brocade/ICX is misbehaving
I've to perform some network automation in my infra using ansible.
When I'm trying to use ansible module for icx switches it seems to be misbehaving.
Playbook I used
---
- name: ICX switch testing
...
3
votes
2
answers
3k
views
Ansible - Filter Dictionary Values
I have gathered the list of all users using getent_module:
- name: Get user info
getent:
database: passed
This returns this variable as getent_passwd, a dictionary like this:
{
"uuidd&...
3
votes
1
answer
3k
views
Ansible check disk space of a folder
Is there a module that allows me to check disk space of a folder like the command df -h /path/to/folder?
I want to avoid using the shell or command module, I can't believe there is no module for it.
0
votes
1
answer
92
views
Problem while comparing two arrays due to unecessary chars
I have to two array from mysql query and I want to make a host comparison.
For example, the result of mysql result is like list1 & list2.
- name:
set_fact:
list1:
- host: '[\"X....
0
votes
2
answers
218
views
Enhacing a playbook by storing the hostname of the changed machines locally
I am trying to enhance my playbook by storing the hostname of the changed machines locally, and I want to use as much as possible of the ansible module that is why I choosed the usage of th copy ...