Questions tagged [ansible]
Ansible is an IT automation tool. Use this tag for questions regarding the Ansible IT automation tools.
267
questions
0
votes
0
answers
7
views
In Rocky 9 Cinnamon, how can I change the 'Turn off the screen when inactive for' setting via ansible?
I have an ansible-built system which needs to stay online for 2 hours before the screen locks. However, whatever I try I can't seem to modify the System Settings - Power Options - "Turn off the ...
0
votes
0
answers
16
views
How to use a community.sops encrypted jinja template in ansible?
I am using ansible 2.16.10, sops with gpg 3.8.1 and community.sops 1.8.2
I know how to decrypt a sops-encrypted file in ansible using :
lookup('community.sops.sops', 'foo.sops.txt')
And i know how to ...
0
votes
0
answers
67
views
Ansible TASK [Gathering Facts] fails: empty output and no `Escalation succeeded` message
Environment:
Managed Node:
OS: RedHat 9.4 (custom build)
Bash: 5.1.8(1)-release
Sudo: 1.9.5p2
python: 3.9.18
Control Node (laptop):
Python: 3.12.4
Ansible: core 2.16.8
Interactive ssh to the ...
0
votes
1
answer
228
views
How to solve Ansible venv runtime exception in specific versions?
I want to set up a venv with the following packages as these are specified in a project I'm working on:
ionoscloud==6.1.4
pytest==6.2.5
pytest-cov==3.0.0
ansible==5.0.1
PyYAML==6.0
kubernetes==24.2.0
...
0
votes
0
answers
31
views
Upgraded Ansible with Python 3.8 but playbooks are now way slower that with python2.7, how to address slowdown?
When we were running RHEL7 our playbooks used to complete in about 1 hour with ansible-2.9.27-1.el7.noarch.rpm w/ python 2.7 + mitogen.
Last year we upgraded to RHEL8 w/ python 3.8 and ansible-5.4 + ...
0
votes
0
answers
117
views
Error Ansible setup
Im setting up Ansible AWX on my ubuntu 22.04 machine. When running the install playbook ansible-playbook -i inventory install.yml I get the error below. Any ideas how to solve this error?enter code ...
0
votes
0
answers
89
views
How to setup ssh-agent to persist keys after closing remote connection for use in cron jobs?
I have several cron jobs that require password protected ssh keys. The jobs run each morning and are consistently failing due to the agent not keeping the keys alive after disconnecting from the ...
0
votes
0
answers
17
views
Ansible use connection: local option along with jump ssh
How to make Ansible use jump server ssh when there is the "connection: local" instruction?
Ex:
- name: snmp
hosts: all
gather_facts: false
connection: local
serial: 1
tasks:
- ...
1
vote
1
answer
887
views
Using Ansible how to wait or recover when SSH service restarted?
Using Ansible how to wait or recover when SSH service restarted? I have an ansible playbook that does a few changes to SSH configuration, but of course Ansible loses the SSH connection when ssh is ...
0
votes
0
answers
31
views
Validating Changes to pam.d (like visudo)
I'm working on an Ansible task for setting fingerprint sudo usage in MacOS. This is done through a custom rule in /etc/pam.d/sudo_local.
Is there a method to pre-validate edits to PAM for safer ...
0
votes
1
answer
2k
views
How to print stdout of results variable of previous task
I wrote this task
- name: Enabling the repoistory
shell: subscription-manager repos --enable={{ item }}
register: _repostatus
loop: &...
0
votes
1
answer
381
views
In ansible playbook for role, just call specific task file, other than main.yml
I have simple role to install Weblogic server; And now I want to add a deinstall.yml task file.
At the moment I created a new simple playbook, and want to execute the file tasks/deinstall.yml with it.
...
0
votes
0
answers
336
views
Install a language with ASDF through Ansible on Debian
I'd like to write playbooks to install my development environment. Most steps went well, but I'm struggling to install Ruby through asdf.
Playbooks are splitted and called from a main.yaml. The one ...
0
votes
0
answers
44
views
always fail to set password for an account by using ansible
ansible all -i localhost, -m debug -a "msg={{ 'apassword' | password_hash('sha512', 'mysecretsalt') }}"
output:
$6$mysecretsalt$zBxKrtoLhJ5.ng.yl/...
1
vote
1
answer
581
views
How to handle big files with ansible
While testing ansible, I stumbled over an issue with big files and ansible.
My ansible directory for testing looks something like this:
ansible
|- ansible-testing
| |- .git
| |- big-file-playbook....
0
votes
2
answers
391
views
psycopg.OperationalError: connection failed: password authentication failed for user "awx"
Running into an error with my Ansible AWX local setup. This was working before but, after I recreated the pods when trying to debug another issue, I now get the error psycopg.OperationalError: ...
0
votes
1
answer
451
views
Vagrant in WSL2 unable to run Windows 11 'cmd.exe'
Would appreciate help in using Vagrant and Ansible to spin-up and provision virtual servers managed by Hyper-V on Windows 11. Currently, I have the latest version of Vagrant (2.4.0) installed on both ...
1
vote
1
answer
2k
views
Error when setting up Ansible AWX
Im setting up Ansible AWX on my Windows 10 machine using docker-compose. When running the install playbook ansible-playbook -i inventory install.yml I get the error below. Im able to see the login ...
1
vote
0
answers
361
views
Is it possible for Ansible to reuse the existing SSH connection to the remote host in order to rsync some directories?
Following script is meant to be copied and run on the remote host, i.e. 192.168.1.142, ansible-playbook -u root -i inventory.ini sync-w-ctrl.yml:
#!/usr/bin/bash
au=jimmy
dirs=(
"/home/${au}/...
1
vote
0
answers
117
views
Ansible fails installing IIS Web-Server on virtualbox windows machine
I am trying to install Active Directory Labratory GOAD to practice and get familiar with active directory. I use ansible-core 2.2.16, virtualbox 6.1 and vagrant 2.2.19 to install it.
The lab uses a ...
0
votes
0
answers
125
views
How do I send an email about Windows Update Failure
I have the below playbook which gathers information about only windows VM's from a vcenter_inventory_vmware.yml inventory file and executes the ansible.windows.win_updates module properly. I am ...
1
vote
0
answers
440
views
Kubernetes environment installation with Ansible
I write a ansible playbook for Kubernetes environment (timedata, swap, modules, containerd, kubeadm, kubelet, kubectl, vs). When I run the playbook, all operations in it are successful. But when I ...
0
votes
1
answer
571
views
using ansible to fetch from remote src path to the local same path from a couple hosts
Using copy or fetch, the newer host directory covers the earlier ones. I would like to have each located under the same local path, maybe host specific info used as suffix.
ansile aid -m copy -a "...
0
votes
0
answers
141
views
ansible automatic apt upgrade and all find modified configuration file
With ansible do an automatic apt upgrade from all our servers. That is no problem, but as a result we want to see only the "configuration file" which has kept, so we could check them ...
1
vote
1
answer
4k
views
How to output verbose logging from powershell that is being called by an Ansible playbook
I have an ansible playbook, similar to this:
- name: Run Powershell script with Parameters.
win_shell: MyPS.ps1 -Param1 "{{ Param1 }}"
and within the Powershell script I ...
0
votes
1
answer
2k
views
Linux RHEL 7 - Ansible - Execute command in shell is normal but got file not found/permission denied when run via script
I have an Ansible body as follow
- name: install
command: sh /installScript.sh
args:
chdir: /home/cust/
then I execute my playbook using this
ansible-playbook -i my_inventory....
2
votes
1
answer
2k
views
Update OS Via Ansible Determine What Distrubution Major Version
I've created an Ansible role that consists of no more than tasks and some variables. Probably overkill at this point but I plan to expand on the role sometime in the future. I'm attempting to first ...
2
votes
2
answers
1k
views
Ansible - How to create dynamic inventory that fetches hosts from microsoft AD
I am using Ubuntu as a control-node, and would like to get the hosts from my domain controller (windows server 2022), the LDAP-Inventory Guide & microsoft.ad.ldap inventory – Inventory plugin for ...
1
vote
0
answers
52
views
Map a vagrant disk to ansible host file
I'm trying to create partitions in Vagrant vm and to map them to an ansible host file but the play that i'm running is not recognizing them.
Here's the Vagrantfile configuration:
Vagrant.configure(&...
1
vote
1
answer
293
views
How to assert a specific minimum Java version before running an ansible task?
I would like to ensure Java is installed and the oldest acceptable version is 11.
How can I achieve that in ansible?
I have tried
- name: Fetch Java version
shell: java -version 2>&1 | grep ...
0
votes
0
answers
1k
views
Building wheel for ansible (setup.py) ... error, unable to install ansible
I am trying to install ansible via pip, but installation failed with these errors.
Basicly the core ansible is installed but I have a feeling that not all modules/ ansible_collections are installed
#...
0
votes
0
answers
283
views
Accessing WSL2 filesystem on localhost through WinRM
Is it possible to somehow access WSL2 filesystem (say \\wsl.localhost\Ubuntu\home\foo\bar) when WinRM remoting into localhost using certificate based authentication method?
I am trying to do so from ...
1
vote
1
answer
302
views
How can I start the PF service without interrupting existing connections?
I have an Ansible playbook that starts the PF firewall. It freezes at this point because the SSH connection between the target and the host Ansible is executing on is interrupted as a result of this. ...
0
votes
0
answers
587
views
Vagrant ansible provisioning not working
I have a vagrantfile and am trying to instantiate a final provisioner of type ansible where I intend to do the bulk of the work configuring the vm.
The Vagrantfile works fine without the ansible ...
1
vote
1
answer
2k
views
Ansible Json Query
I got an dictionary output as below from one of the Ansible Task
"
msg": {
"vSwitch0": {
"failback": true,
"failover_active": [
...
2
votes
0
answers
5k
views
Ansible automatic ssh authentication using passphrase protected private key
I can't seem to get ansible to automatically pick up the SSH identity that I've added, and if I am prompted for the passphrase on my private key my passphrase seems to not be accepted, while the same ...
2
votes
0
answers
459
views
Vagrant - Ansible - Install PostgreSQL and Postgis
I'm trying to install PostgreSQL and Postgis with Ansible on a Vagrant VM.
The VM is only use locally for local development, so that's why I grant access to databases.
But I'm reaching some issues to ...
1
vote
1
answer
3k
views
Ansible hosts not working using specified inventory
I have two files
inventory.yaml:
servers:
hosts:
nas:
ansible_host: 10.10.10.27
router:
ansible_host: 10.10.10.1
and playbook.yaml
- name: pylonl playbook
hosts: all
tasks:
...
0
votes
2
answers
14k
views
I want to search for string in a file using ansible
- name: extract a word
ansible.builtin.lineinfile:
path: /file/to/path/file.log
regexp: '^nodeagent stopped: (.*)'
line: '...
2
votes
3
answers
3k
views
Ansible : Configuring a Windows Host
I'm trying to set a windows Host through a VM using mac M1 but I'm having the following issue :
UNREACHABLE! => {"changed": false, "msg": "Failed to create temporary ...
1
vote
0
answers
46
views
configure subnet based on LLDP neighbour
I am looking for some help to configure subnets between the routers
please refer to the diagram1
Diagram:
Router Identification comes from the host variable file
eg.
ansible_host: 10.10.10.1
ID: 1
...
1
vote
0
answers
111
views
Implementing the right conditions for a yum command for centos5 in Ansible
I'm currently working with a centos5 host and I have to install some packages with yum.. unfortunately, as far as I know, centos5 doesn't support Ansible's yum module so I have to use the 'command' or ...
0
votes
1
answer
2k
views
ansible_default_ipv4.address Ip address range
The playbook I'm writing can run on multiple environments and each environment is on a different subnet.
I'm writing a conditional block which will only run if the host IP is of the range I will ...
0
votes
1
answer
659
views
Install ansible 2.5 in Ubuntu 22.04
I'd like to install Ansible 2.5 in Ubuntu 22.04, because our deployment playbook incompatible with Ansible newer version. I tried installing from apt, but ppa doesn't provide 2.5 for 22.04. Installing ...
1
vote
1
answer
775
views
fetching multiple files from a host based on a naming pattern with Ansible
I have a folder on a remote that looks like this.
> ls -la
-rw-rw-r--. 1 postgres postgres 469 15. Aug 12:37 220815.sql
-rwxr-xr-x. 1 postgres postgres 82 30. Dez 2015 client-postgres
-rw-------...
1
vote
1
answer
408
views
How do I convert a VM snapshot creation time to use in a math equation?
[EDIT] I am editing the original question for more clarity
I am trying to build an Ansible script that will delete snapshots over 10 days old. The value that is returned by community.vmware....
8
votes
0
answers
2k
views
Writing toml sections with ansible
I have an Ansible setup for "Gitlab Runners". These use toml as configuration format
[[runners]]
name = "gitlab-runner-1"
url = "https://example.com"
token = "...
1
vote
1
answer
120
views
How do use dictionary variables from two sources in Ansible?
We have an Ansible script that sends an email when a server has been updated. In the script I want to to use variables from two different locations for the send to addresses. The first location is ...
3
votes
2
answers
13k
views
How to install mysql 5.7 on ubuntu 22.04?
I have upgraded server from centos to ubuntu 22.04, but I want to keep mysql 5.7.
I use ansible for provisioning
By default ubuntu 22.04 apt gives mysql 8, so I think I need to add repo, gpg keyring ...
0
votes
0
answers
267
views
Change Virtualbox default VM folder with Ansible
I'm trying to set up a computer that will act as a server using Ansible. Basically this works quite well but I got one command that I cannot get to work. I want to install Virtualbox and change the ...