Questions tagged [ansible]
Ansible is an open-source software platform for configuring and managing computers. It combines multi-node software deployment, ad-hoc task execution, and configuration management.
1,767
questions
0
votes
1
answer
5k
views
ERROR! couldn't resolve module/action 'community.general.timezone' RH8
I have this error
ERROR! couldn't resolve module/action 'community.general.timezone'
OS is RedHat 8
ansible 2.9.27
Ansible installed via yum
So I installed missing modules via ansible-galaxy, but when ...
1
vote
0
answers
335
views
How can I force ansible (or python for that matter) to use openssl at seclevel 0 in Ubuntu 22.04?
I have ansible installed in a host with Ubuntu 22.04, from which I try to connect to a host with Windows Server 2012 R2 using winrm. The problem is that I get a connection error.
After chasing the ...
0
votes
1
answer
3k
views
Removing brackets ([]) from Ansible string
Code:
- name: Set category info as fact
set_fact:
category_info: "{{ category_info|default([]) + [ {
'category_name': item | json_query(...
0
votes
1
answer
758
views
Ansible trouble while launching an exe through win_command
I'm currently writing a playbook about uninstalling Fusion Inventory Agent and then deploy GLPI agent 1.4 on Windows Server 2016-2022. For all the tests i detail below, i use my domain account which ...
1
vote
1
answer
3k
views
Access value of specified dictionary key within a list of dictionaries in Ansible
I am installing list of packages in ansible registering variable and outputting it with debug:
community.general.homebrew:
name: "{{ package }}"
state: present
register: ...
1
vote
0
answers
397
views
Unable to access the virtual machine configuration (vmware automation) while cloning from template - Ansible version 2.13
I'm wondering whether any of you have encounter similar issue.
I have 2 Ansible machines. One is running on Centos 7, version 2.9.27 (with python 2.7.5) and second on Ubuntu 22 with Ansible 2.13
Using ...
2
votes
1
answer
3k
views
Ansible: How to merge list of dictionary objects with the same key getting one dictionary element with a list of thouse different values grouped?
I have been struggled with Ansible for a time and finally requesting for any help if possible,
Having a set of Nifi policies:
"nifi_raw_policies": [
{
"action": "...
0
votes
0
answers
76
views
How do I remount /home as the ec2-user in Ansible?
I can manually remount /home as the ec2-user by executing these three lines:
$ cd /
$ exec sudo -i
# mount -a
How do I do this in Ansible without rebooting?
Edit:
/home is on a separate volume.
No ...
1
vote
1
answer
540
views
Ansible shell module fails to find kubectl
Running the command from the CLI on the server works perfect, but from playbook using Ansible shell module fails with:
fatal: [localhost]: FAILED! => {"changed": true, "msg": &...
2
votes
2
answers
871
views
Ansible fetch from various hosts various files
I am newbie to ansible. My goal is to fetch files from various servers. Each server has different path where a file is stored. Destination path is always the same.
I have the following:
- name: fetch ...
0
votes
1
answer
2k
views
Ansible: Loop over the items of a host list and execute role
I have an application composed of micro modules distributed on multiple hosts.
inventory:
[moduleA_hostgroup]
host1
host2
[moduleB_hostgroup]
host2
host3
[moduleC_hostgroup]
host1
host4
Each module ...
1
vote
1
answer
138
views
Ansible: Pulling a specifc piece of information from an output
I'm trying to grab some information from the output of a playbook and save in a file for review. tor.j2 is just a list of expected lines in the config: logging , ntp, spanning-tree, etc.
tasks:
- ...
4
votes
4
answers
19k
views
Ansible: "You need to install 'jmespath' prior to running json_query filter", but it is installed
I am using Ansible on top of Python3 and Enterprise Linux 8 (Rocky Linux 8).
When I try to use json_query, I am getting the following error:
fatal: [ansible]: FAILED! => {"msg": "You ...
0
votes
1
answer
438
views
Playbook to extract hosts from /etc/hosts
I need help extracting hosts informations from /etc/hosts file and exporting that content to a predefined file. I created a Ansible's Playbook to this task, but the content is not written on the ...
1
vote
0
answers
70
views
Cannot combine looped variables
I have well over a dozen jobs within AWX, but given the following code only returns one job name:
- name: Set job_name(s) as facts for limiting job rename
set_fact:
job: "{{ job_name|...
1
vote
1
answer
4k
views
How can I loop over files in a directory and move only the unique files using ansible
I’m trying to loop over all files in a directory, these files are named differently but should have the same contents. Is there a way to loop through all these files using ansible and then move the ...
1
vote
0
answers
168
views
Ansible EdgeOS "add" issue
I'm trying to create a playbook to update a few edge routers to current hotfixes, but I cannot find a way to get around the prompted yes/no question with the supported community.network.edgeos_command ...
1
vote
1
answer
937
views
How to handle existing/non existing fact in Ansible?
For inventory purpose due to some business limitation, i wrote a playbook that retrieve content of resolv.conf + ntp.conf + timesyncd.conf and then, write the retrieved content within a CSV file.
...
0
votes
1
answer
532
views
Rolling updates on Ansible using throttle
I am trying to set up rolling OS updates on linux systems using Ansible. My intention is to update the systems together but then reboot individually using the code below which includes a block ...
0
votes
0
answers
429
views
Ansibe to install/update Zabbix agents on hosts listed in Zabbix server
I have a lot of VMs set up by hands during years, so each VM is a bit unique (so to say, you know). Zabbix agents on these VMs are of different versions and maybe differently configured.
The idea is ...
1
vote
1
answer
148
views
Ansible & Jenkins
here is my problem
I run a playbook on jenkins with extra variables, I want to test in my playbook is variables are defined
ansible [core 2.12.1] , jenkins plugin 1.1
here is the command from jenkins :...
0
votes
1
answer
84
views
Setting apache2.conf variables with Ansible issue
i have a simple ansible playbook that sets two ini variables.
- name: set Apache timeout
community.general.ini_file:
path: /etc/apache2/apache2.conf
section: null
option: Timeout
...
0
votes
1
answer
69
views
Is there any way to auto upgrade Ansible roles?
Is there any way to upgrade Ansible version along with the playbooks which are written in older version of Ansible. Any kind of script which would read all the modules in the playbooks and recommend / ...
0
votes
1
answer
555
views
AWX execution environment pip error ResolutionTooDeep: 2000000
I've been building an execution environment for my awx for a while now and never got any kind of problem, but now I am trying to recreate the same EE I created 1 month ago, and it does not work ...
0
votes
0
answers
227
views
Ansible SSH From A -> B -> C using SSH Config on B
There is a very similar question to what I'm asking at SSH from A through B to C, using private key on B
That question does have a solution that works for me, which is
ssh -t B ssh C
However I've ...
0
votes
1
answer
6k
views
Ansible having an unhandled exception occurred while templating with lookup function
I'm currently building a playbook to test if some conf files are existing and then check the contents. Files are the following
/etc/resolv.conf - then check if nameservers are well configured
/etc/...
1
vote
0
answers
37
views
Scripted upload to AWS cloudshell environment
We maintain dozens of developer accounts on AWS and for maintenance purposes it would be amazing if on all cloudshell environments we would have a set of scripts available. It is possible to upload ...
0
votes
1
answer
483
views
How to properly manage Ansible regex for network device
I'm currently testing to retrieve firmware version lists on HP/Aruba switches using arubanetworks.aos_switch collection. Basically i'm just doing :
collections:
- arubanetworks.aos_switch
...
8
votes
1
answer
7k
views
How to get item from list
Given this list:
colors:
red: enabled
yellow: enabled
green: disabled
blue: enabled
purple: disabled
How can I get a list of the colors that are enabled (below doesn't work):
- debug:
...
0
votes
1
answer
303
views
EdgeOS Ansible Issues
I'm getting the following when trying to run a playbook using the edgeos_commandmodule:
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ansible....
1
vote
1
answer
1k
views
Facts cache content not accessible in Ansible playbook
I've successfully enabled fact caching for Ansible and I can verify the content by opening the json files produced to the cache directory, however, when I run a task with playbook level gather_facts ...
0
votes
0
answers
97
views
Ansible Playbook
I'm trying to run a playbook with to upgrade the latest firmware on a few edge routers on my network:
- name: Update External ERX with latest firmware
hosts: externaledgerouters
remote_user: ...
1
vote
1
answer
868
views
Ansible variables across plays without group/host vars
I have a variable that is very specific to a playbook, not necessarily tied to a host or host group.
I would like to declare this variable in the playbook itself, and have it shared between plays ...
1
vote
1
answer
59
views
Redhat Capsule servers Apache config file update suggestion
There are some vulnerability issues reported by a third party software. The issues are mostly related to Apache HTTP server Configuration files. What is the best approach to update the capsule (...
1
vote
0
answers
507
views
Setup ansible module proxmoxer
I got near zero skills with ansible.
I need to setup the proxmoxer module to do verify_ssl=false because i have this kind of error :
requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host='...
3
votes
1
answer
15k
views
How to use loop register results as when condition in ansible?
I want to use a playbook to create profile for multiple users. But it always show me the error list object has no element 2. Here is the playbook:
vars:
users:
- test1
- test2
...
1
vote
1
answer
395
views
Use dnf update based on age of packages
We manage quite a lot of linux servers using ansible VIA an AWX server, and patch these once a week using dnf update. Most of our servers are Alma Linux.
We've had two instances recently where ...
1
vote
1
answer
876
views
Ansible Ping hangs after first machine
I have 3 VMs:
ansible-host: 192.168.0.103
app1: 192.168.0.105
app2: 192.168.0.106
Now I have verified that doing ssh -i ansible_id_rsa [email protected] works for app1 and same for app2.
I ...
0
votes
2
answers
825
views
Using variables within quoted strings in Ansible
Please take this working play example:
- name: Display the URL
hosts: all
gather_facts: false
vars:
- host_domain: "testing.example.com"
- default_url: "http://def....
0
votes
1
answer
791
views
Using variables from task in following loop task
I want to deploy some stored procedures across multiple MSSQL instances on multiple server.
In my playbook I have a task which gathers all the instances on a server which I use in the following tasks ...
2
votes
2
answers
3k
views
Ansible Handlers failing when using with include_tasks
This ansible script works.
---
- name: Create Swap
hosts: serverName
gather_facts: yes
become: true
become_user: root
become_method: sudo
tasks:
- name: Create swap
shell:
...
2
votes
0
answers
924
views
ansible.posix.synchronize fails with unknown rsync option
I am running an ansible playbook with the following task:
- name: Yada Yada Yada
ansible.posix.synchronize:
src: ../foo/bar/
dest: /home/tada/tokio
When i run this using AWX i get the ...
1
vote
1
answer
571
views
Accesing debug values in Ansible
My ansible code looks like this,
¦ - name: Copying Archived File
¦ ¦ unarchive:
¦ ¦ ¦ src: "/home/user/{{ item }}"
¦ ¦ ¦ dest: "/home/user/someLocation"
¦ ¦ ¦ list_files: ...
2
votes
1
answer
210
views
Running Ansible tasks (ex: get_url) within a network namespace
Situation
I have some network gear that must run some commands within a network namespace in order to reach the internet.
In my scenario, it's the mgmt namespace.
For example, to install a pip package,...
1
vote
1
answer
6k
views
Ansible: Get n-th element of list
I have two variables:
assets: holds a list of assets
asset_index: holds the index I am interested in ("0" when printed via debug)
How can I get the asset list entry at the specified ...
0
votes
1
answer
3k
views
Windows update through explicit Squid proxy - 0x80072EE6
I'll try to give a thorough rundown of the environment:
anonymous proxy
proxy must be set for Internet access
2 Squid proxies on RHEL8 behind an f5 - not caching
2 Windows AD DCs, both running 2019 ...
2
votes
1
answer
3k
views
Unable to show available updates with Ansible and dnf check-update
I have the following Ansible code for checking available updates on a Rocky linux server and showing them to user:
- name: Check updates
ansible.builtin.command:
cmd: dnf check-update
register:...
2
votes
1
answer
2k
views
Ansible 'ping' fail - 'session request sent', but 'read header failed: Broken pipe'
I'm a newbie at Ansible and my goal is use this tool to configure Moxa switches by SSH interface. I'm able to connect via SSH from my Ubuntu PC without problems:
[email protected]'s password:
...
0
votes
1
answer
672
views
Microsoft Storage Powershell Module 'Get-Disk' doesn't list disks when Failover-Clustering is installed
I have 10 disks on a Windows 2016 Server. If I have the Windows feature 'Failover-Clustering' installed, the Get-Disk cmdlet only reflects two disks - even when the server is not yet part of a ...
-1
votes
1
answer
205
views
Using ansible to automate machine rebuilds
I'd like to use Ansible to rebuild the machines in my DC environment every X days as referred in the following article.
https://www.ansible.com/1000-windows-servers-on-a-30-day-rebuild
I understand ...