1,869 questions
-6
votes
1
answer
148
views
How can I enable Windows built-in firewall rules independently of localization? [closed]
Windows has a lot of built-in firewall rules. Not all of them are enabled by default. I want to write an Ansible playbook, that can enable specific rules. Unfortunately, the rule names and groups are ...
0
votes
2
answers
664
views
Use ansible-dev-tools with uvx
When installing ansible-dev-tools into venv with
python -m venv .venv
source .venv/bin/activate
pip install ansible-dev-tools
All the provided executables are located at .venv/bin and are executable ...
0
votes
0
answers
34
views
ansible.builtin.git: diff mode together with check mode not showing diff if version is set to commit sha
I have cloned the repository in $HOME using git clone --depth=1 https://github.com/gauravpathak/zynq-zc706-buildroot-webserver.git
I have this directory structure of files for one ansible playbook:
.
├...
0
votes
3
answers
60
views
Why does the result from the shell module in Ansible contain the dictionary twice when I print result?
I'm trying to execute a shell script on a localhost using Ansible and display the output of the script. I've registered the output of the command using the shell module and stored it in the result ...
1
vote
1
answer
38
views
ansible playbook uses group_vars default values instead of the ones defined in the vault
I have the following structure:
|- group_vars/
|- local/
|- local.yml
|- roles/
|- myrole/
|- vars/
|- main.yml
groups_vars/local/local.yml:
myvar: <FIXME>
roles/...
1
vote
0
answers
98
views
How to pass a ansible vault password file while using ansible_runner in a python script
I have a very simple Python script to run an Ansible playbook (A post call to get an access token from the OAuth2 authorization server and save it in a .txt file).
I have secrets stored in ansible-...
2
votes
1
answer
76
views
How to concatenate variable and the string inside filter?
I'm trying to write a role that finds difference between records in DN servers and records in Git. Some of them were added manually via Web interface.
For that purpose in my Ansible playbook I ...
1
vote
1
answer
290
views
Managing Nginx vHost Conf Files with Ansible
I'm new to the automation world and I'm stuck trying to figure out how I can automate and maintain Nginx conf files for the vhost I manage using Ansible.
For example, normally I would create a conf ...
2
votes
1
answer
58
views
Ansible: Regex not working as expected for multiline string
I am working on an Ansible playbook for iOS flash files backup, which shows the flash: of a Cisco router and tries to pick all the filenames from the multiline string into a list. Later it will create ...
0
votes
1
answer
62
views
Ansible, Custom Fact - 'VARIABLE IS NOT DEFINED!: ''ogg_fact_general'' is undefined
Ansible custom facts, defined in /etc/ansible/facts.d. I can get their values manually just fine, like so:
[root@lnx000 templates]# ansible lnx072 -m ansible.builtin.setup | grep ogg_fact
...
1
vote
2
answers
120
views
How to pass a variable list to another play with different hosts
I want to append all the hostnames into a list and pass it to another play with different host-group (remote server) where it searches for a file with a pattern. I am trying an Ansible playbook -
- ...
0
votes
1
answer
234
views
How to Match SSH Configuration Block with Ansible regex
Backstory:
I'm making an Ansible role that creates an SSH key for hosts that need one and automatically updates my configuration file with the latest information; lan ip, username, key, etc. I can't ...
0
votes
1
answer
108
views
How to get multiple hosts output in one file in Ansible playbook?
I have a requirement to collect all my service running status on multiple hosts and get it in one output file.
- name: To check status of services running
hosts: all
tasks:
- name: "...
1
vote
0
answers
52
views
Unable to create AWS Batch Job-Definition of Fargate type
I am referring to aws_batch_job_definition – Manage AWS Batch Job Definitions — Ansible Documentation page in-order to create aws job-definition.
As mentioned, we can create a container type of job-...
0
votes
1
answer
106
views
Ansible project update is failing with error Database Error Saving Job Event
I have ansible in a cluster environment and first server ok the cluster is used for project update, all off a sudden in few days I see that project update is failed with no error in the ansible job ...
0
votes
1
answer
127
views
Ansible debug module : display debug message only once no matter hosts count
I would like to display a debug message in my playbook.
This is my playbook:
[blablabla]
- debug:
msg:
- "######################################################################"
-...
0
votes
1
answer
246
views
LVM using ansible - need to allocate based on size
I need to mount 4 filesystems into sd* devices based on size. If sda- 100, sdb -200 and sdc -50 and sdd -100 GB respectively then I need to mount my app filesystems into these 4 devices based on size.
...
2
votes
1
answer
49
views
Create a list of dictionaries from a list of strings
I'm attempting to pass a list of dictionaries to an Ansible role that expects a variable defined per the below.
var1:
- path: /A/1
state: directory
- path: /B/1
state: directory
Let's say ...
0
votes
1
answer
264
views
Ansible - How to create an archive with extra options?
I'm trying to use the archive module in Ansible but have extra flags I need to use, specifically for tar.
I've used the unarchive module with the parameter extra_opts but I don't see anything like ...
0
votes
1
answer
368
views
ansible run rescue only for instance where task failed
I am trying to run block of tasks and have rescue statement in case the task in block fails.
- block:
- name: Set shell session
shell: xyz
- fail:
msg: shell failed
rescue:
...
0
votes
1
answer
56
views
What is the equivalent for HTTP method LIST in the Ansbile `uri` module?
I am trying to look for the HTTP method equivalent for the following playbook code for method LIST.
- name: List all folders
ansible.builtin.uri:
url: https://{{ My_vault_url }}
method: LIST
...
2
votes
1
answer
116
views
Ansible how to pass result of first task to block of tasks in other file
I have a task as below :
-name : Set-up
shell: abc
register: "{{item }}_result"
loop: {{ setu }}
-name: set of tasks
include_tasks: abc.yml
when "'{{ item }}_result'.rc!=0"
...
0
votes
1
answer
35
views
Ansible issue while running sed command
Trying to run a command in Azure VM via Ansible and Azure cli command but getting template issue
- name: Disable disk expansion
shell: | az vm run-command invoke -g {{ resource_group_name }} ...
2
votes
0
answers
704
views
[WARNING]: No python interpreters found for host
I set up a deployment pipeline using GitHub actions and am experiencing an issue with Ansible seemingly not being able to find the python interpreter.
The step in the job is as follows. I set the ...
0
votes
2
answers
465
views
How to execute Ansible tasks in IF ELSE mode?
I have following code where in I want to implement conditional logic like if-else construct:
- name: Download katello agent package
get_url:
url: "{{ abc_url }}/pub/yyy.rpm"
dest: &...