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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
342 views

How can I make Ansible Playbook to Continue after IP Change?

I have a playbook which configures Static IP Address and reboots the Server. However, the playbook is resulting in an error. Even the following code also doesn't seems working - name: Creating ...
UME's user avatar
  • 111
0 votes
1 answer
556 views

How to replace shell module with command module in Ansible?

I need one small help. In below example I need to replace shell with command module. But I am confused as command is not working with pipe. So please give me the solution of this task. E.g: - name: ...
Rupam Sabale's user avatar
0 votes
0 answers
157 views

Virtual Media it's not ejected on the Dell iDRAC9 after the installation using Ansible it's completed

I have this code but unfortunately it's not ejecting the ISO after installing the CentOS and I don't know what to do, can someone please give me a hint on how I can treat this? I can't use Ansible ...
bicanul123's user avatar
0 votes
1 answer
656 views

How can I boot using Ansible on an Dell iDRAC9 server from an iso that's located on a remote server?

I have this playbook that what I'm trying to do it's to install CentOS using Ansible and Redfish, I don't want to use any modules, I'll install the CentOS on multiple Dell iDRAC9 servers and I'm ...
bicanul123's user avatar
0 votes
1 answer
580 views

Generate SSL certificate with let's encrypt (dns-01 challenge)

I'm trying to generate an SSL certificate with Ansible for *.rasp.example.com and rasp.example.com. I already have a "working" solution (No errors when deploying), but when I try to compare ...
tholeb's user avatar
  • 29
0 votes
2 answers
449 views

Ansible 'command' task missing 'stdout' for 'nginx' config verification

After deploy new configuration of Nginx, I would like to verify configuration before Nginx handler for reload is applied. This is output of command line: nginx -t && echo $? nginx: the ...
dorinand's user avatar
  • 359
0 votes
2 answers
1k views

Ansible :: Am I not using the `cisco.ios.ios_facts` module?

I'm trying to build a simple POC ansible playbook that logs into a Cisco router and pulls the config. About my environment: My Ubuntu is Ubuntu 18.04.5 LTS My Ansible is version ansible 2.10.7 (...
Pete's user avatar
  • 133
1 vote
2 answers
484 views

Ansible to a Cisco Router :: Password Message Messing Up the Connection?

When I manually SSH from my Ansible server to a Cisco router, I see this on the command line: me@ubuntu01:~/ansible$ me@ubuntu01:~/ansible$ ssh [email protected] Password: ####################### ...
Pete's user avatar
  • 133
0 votes
2 answers
3k views

Ansible playbook: download a file from a repository only if it was not changed on a target machine

I am setting up an autoinstall environment with PXE boot. To install Linux this way, one basically needs to download linux and initrd.gz files which are buried deeply in the repository structure and ...
Nikita Kipriyanov's user avatar
2 votes
1 answer
2k views

How to parse and filter on dict values on Ansible?

I'm currently working on a playbook to create a K8s cluster on Nutanix Prism Central. Everything run smoothly but i face an issue while a VLAN exists on one or more clusters. In my case, a VLAN is ...
motorbass's user avatar
  • 353
0 votes
1 answer
107 views

Ansible copy overlays

Given the tree on the controller shell> tree /tmp/test/ /tmp/test/ ├── override │   ├── dir1 │   │   └── file_B.txt │   ├── file_2.txt │   └── file_4.txt └── template ├── dir1 │   ├── ...
Vladimir Botka's user avatar
1 vote
1 answer
504 views

Validate all public keys in authorized_file

In my authorized_file i have multiple public keys against one private key. Now i want to add a task in ansible which will validate that all public keys are valid keys and good for connection. My aim ...
Sakshi Arora's user avatar
0 votes
0 answers
393 views

Store ansible vault password in azure keystore

At my company we use Azure cloud services. For our local department we want to setup a set of Linux servers. These servers are used to form a test setup. To setup and maintain these servers we chose ...
Jan Jaap's user avatar
  • 101
0 votes
2 answers
733 views

How can I skip an async task that is already running?

(Credit @Kerrick Staley) I would like to create an Ansible playbook with an async task followed by an async_status task that lets me do the following: I run the playbook on my laptop. It starts the ...
Vladimir Botka's user avatar
3 votes
2 answers
343 views

Vmware tags and Ansible , empty out in Ansible but VMs have tags

I am trying to filter out the list of VMs with specific tags. The sample playbook is as follows : - hosts: localhost gather_facts: false become: false vars: vcenter_hostname: ...
uozzyy's user avatar
  • 33
1 vote
0 answers
152 views

Error deploying Ceph Quincy using ceph-ansible 7 on Rocky 9

I am trying to deploy Ceph Quincy using ceph-ansible on Rocky9. I am getting some problems and I don't know where to search for the reason. PS : I did the same deployment on Rocky8 using ceph-ansible ...
Wodel's user avatar
  • 71
2 votes
1 answer
100 views

Limit CPU usage Ansible J2 loop

I have an Ansible task that formats a list of VLANs. However, when I run the task with multiple forks, it causes my CPU usage to spike to 100% for a long time. How can I optimize the task to reduce ...
raw's user avatar
  • 91
0 votes
2 answers
761 views

In ansible, with win_shell (Powershell), how to force the job status into failed

I'm new to Ansible. I created a playbook that uses PowerShell to reset your password of your admin account. The script has a check that only resets the password IF the account is enabled. When the ...
Snak3d0c's user avatar
  • 101
1 vote
1 answer
269 views

Ansible working with ec2 tags

I have a playbook with dynamic ec2 inventory, below is the graph. $ ansible-inventory -i inventory/dynamic_inventory/uat_aws_ec2.yaml --graph @all: |--@aws_ec2: | |--xx.xxx.xx.xx | |--xx.xxx....
Vicky Ingle - Mint's user avatar
0 votes
1 answer
496 views

Ansible file check and send mail

I am trying to create file check using ansible . basically in specific folder every day some job copy some files. I want to receive an email if there are no new files. I try something like this : ---...
zaca011's user avatar
0 votes
2 answers
1k views

AWX SSH connection not establishing when running playbook

I am trying to run my first playbook. Running AWX on CentOS8,trying to connect to remote device using SSH. On my remote device I have run ssh-genkey on my device and added the .pub key to ...
leonardf2001's user avatar
3 votes
1 answer
3k views

How to handle network changes and restart with Ansible?

I'm currently developping a network configuration role used by Ansible to customize our fresh new virtual machine that came from our Debian 11 template. The following role changes from DHCP to static ...
motorbass's user avatar
  • 353
-2 votes
2 answers
486 views

Lineinfile sometimes doesn't replace lines

I have nginx upstream with multiple backends. I use pre_tasks in playbook for disabling backends in the upstream config during deployment: - name: Deploy hosts: '{{ list_hosts }}' serial: 4 ...
artful's user avatar
  • 31
0 votes
0 answers
717 views

Deploying VM from VM template on vmware vCenter with Ansible makes network unreachable

OS: Oracle Linux 8.7 vCenter: 7.0.3 build 20051473 hypervisor: VMware ESXi, 7.0.3, 19193900 ansible-playbook [core 2.13.5] python version = 3.8.10 (default, Nov 14 2022, 12:59:47) [GCC 9.4.0] jinja ...
BraveAdmin's user avatar
0 votes
2 answers
5k views

Running a local script on local host with Ansible

I have a python script which is able to retrieve the IP adress of my remote node, and as a pre-task of my ansible playbook I would like to run this script and set the IP adress. Is there a command in ...
hugo2410's user avatar
0 votes
1 answer
801 views

ansible print folder path from register variable

I'm trying to print just the path of a register var that has multiple values, however I can only print a specific value. how can I print multiple values? --- - name: find directories find: ...
rigged's user avatar
  • 1
0 votes
2 answers
1k views

conditional statements should not include jinja2 with dictionary list

How do I get rid of this warning? The task works as expected but I would like to do it correctly I have tried to fish out the value for ansible_facts.services["{{ component }}.service"]....
Nifle's user avatar
  • 377
2 votes
1 answer
327 views

Ansible: stdout of commands that end with reboot

I have the following problem. I use Ansible to run an installation script on remote servers, and the script reboots the server in the end. As a result, the task ends with "Failed to connect to ...
Vlad Nikiforov's user avatar
0 votes
1 answer
108 views

ansible logrotate issues with postrorate script

Below is my ansible role > defaults/main.yaml $cat roles/logrotate/defaults/main.yml logrotate_conf_dir: "/etc/logrotate.d/" logrotate_scripts: - name: test ...
Vicky Ingle - Mint's user avatar
0 votes
1 answer
825 views

Ansible: read csv file line by line and render it to template with loop

I am using a csv file to get data and render it to template and copy to remote servers. I am facing issue that CSV file read twice for same server and this results in loop to copy last line in each ...
Lucky Ameta's user avatar
3 votes
1 answer
420 views

How to debug Ansible dict for failed ports with wait_for module?

I have written the below playbook to fetch the failed port status. - name: Check port status wait_for: host: 127.0.0.1 port: "{{ item }}" timeout: 2 state: started ...
Kamal's user avatar
  • 31
0 votes
1 answer
1k views

How to start netcat listening server in Ansible?

I'm working on larger Ansible playbook. One of the tasks I'd like to use is to do "TCP ping" using netcat. On one of the hosts, I'd like to start a netcat 'server', and then start the '...
zbro's user avatar
  • 27
1 vote
2 answers
762 views

I cannot download MySQL ConnectorJ with ansible anymore

I have a task that looks like this: - name: Download {{ mysql_connector_download_url }} ansible.builtin.get_url: url: '{{ mysql_connector_download_url }}' dest: '{{ ...
koenig's user avatar
  • 145
1 vote
1 answer
177 views

Ansible : host variable reference confusion

I'm new to Ansible, and found it a great tool, but I've stumbled upon a problem that I find very confusing. In my inventory, there's just: host1 host2 host3 host1 and host2 both have two network ...
zbro's user avatar
  • 27
2 votes
0 answers
115 views

How can I assign a vSphere Tanzu license to a Supervisor Cluster programmatically?

I have a vSphere Tanzu license already available in my vCenter Server. Now I want to assign that license to a Supervisor Cluster. It works through the vSphere Webclient manually, but I need to do it ...
stackprotector's user avatar
0 votes
1 answer
68 views

Supplying variables to an Ansible script for upgrading Payara

I'm attempting to write an Ansible script to upgrade a Payara instance to a newer one, by taking a backup of the domains on the current installation, nuking it, installing the new version of Payara ...
Chris Douglas's user avatar
-2 votes
1 answer
2k views

How to write Ansible playbook to commit and push my new updates on gitlab repository

How to write Ansible playbook to commit and push a gitlab repository? I have Ansible tower template to launch my playbook, then playbook must do commit and push on different git repo. This git repo on ...
Aniket's user avatar
  • 1
0 votes
1 answer
314 views

Ansible playbook to read vars from plaintext file and log file checksums

In the process of learning ansible I am trying to create a playbook to run on some email hosts to gather sha1 hashes of the files. I have a plaintext file with the path and filenames the playbook ...
dj423's user avatar
  • 23
0 votes
1 answer
834 views

How to remove few strings from a whole line in ansible? [closed]

rem par str how to remove few strings I need to remove rem, par, str from the whole line
Anagha 's user avatar
0 votes
0 answers
97 views

Add Ansible Template as RPC dependancy for Privilege Vault/Secret Server

We're running Delinea/Thycotic Privilege Vault in our environment. We're trying to onboard all credentials into Privilege Vault as much as possible, so that we can leverage Auto-Change, where the ...
user1913559's user avatar
0 votes
2 answers
2k views

When Ansible initiates a PowerShell script, how to get Ansible to return "ok" (nothing changed)?

Usually when Ansible kicks off a PowerShell script with win_command/win_shell/win_psexec, as long as it doesn't run into errors it'll return "changed", because of course it doesn't know what ...
jerdub1993's user avatar
1 vote
2 answers
7k views

Ansible Loop Through Variable Number of Hostvars

I am trying to grab hostnames and IP addresses from a user-entered list of hosts and send that information to a central server. The primary issue I'm running into is that the number of hosts can vary ...
hypen9950's user avatar
0 votes
1 answer
35 views

Unable to configure the Verify Privilege Vault Software Development Kit for DevOps

I am running a RHEL 8 server, trying to utilise the SDK for Privilege Vault. I am following the instructions to install the SDK Secret Server Scripting Tool for DevOps (click here) on the Linux server ...
user1913559's user avatar
0 votes
1 answer
540 views

Ansible Findall capture groups and list

I think I'm confused with Python and Ansible findall. Can I use capture groups in Ansible? For example, How can I capture group 1 and group 2 then reverse the position in the resulting list? For ...
Billy K's user avatar
  • 121
1 vote
1 answer
575 views

Create parameters from a list of lists

I have a fact, which is a list of lists, e.g. [ [disk1, filename1], [disk2, filename2], ... [diskN,filenameN] ] I need to run a command in the format like command -x disk1,file=filename1 -x disk2,file=...
Billy K's user avatar
  • 121
1 vote
1 answer
232 views

Fan out to other hosts when already using Serial in ansible

I have 80+ hosts that run my application, and I'm updating a long existing ansible playbook to change our load balancer. In our current load balancer setup, hosts can be added / removed from the load ...
Mike's user avatar
  • 113
1 vote
1 answer
384 views

Need to know more about the handlers in ansible

Below is the tasks I have in my nginx role # tasks file for nginx - name: Backup and update nginx configuration file template: src: templates/proxy.conf.j2 dest: "{{ nginx_conf }}&...
Vicky Ingle - Mint's user avatar
1 vote
1 answer
275 views

Syntax error in ansible while using handlers

Below is my role task which copied the nginx conf and then reloads the service only when the shell command output of nginx -t contains "syntax is ok" --- # tasks file for nginx - name: ...
Vicky Ingle - Mint's user avatar
0 votes
1 answer
1k views

Ansible and Jenkins: "winrm is not installed: cannot import name utils

I started to learn Ansible and Jenkins a few days ago. I'm stuck on one particular problem and despite many efforts can't figure it out. I have a very basic playbook that runs OK if I run it directly ...
Okrx's user avatar
  • 73
0 votes
1 answer
932 views

Ansible: grep crontab files based on usernames extracted from /etc/passwd

I'm looking to extract a list of users from /etc/passwd and then grep their crontab files for disabled (commented: ^#) jobs. The high level steps would be: Grab an array of usernames from /etc/passwd ...
Mike's user avatar
  • 23

1 2
3
4 5
36