Category "ansible"

How to compare more than two lists have the same values in same indexes in Ansible?

I would like to compare more than 2 lists, and see if they have the same values in same indexes. I have the previous questions regarding how I can alternate the

write tasks to install nginx and postgresql using ansible-playbook

.score.sh is given as #!/bin/bash pass=0; fail=0; if [ $? -eq 0 ];then worker=`ps -eaf|grep nginx|grep worker` master=`ps -eaf|grep nginx|grep master`

including handlers from different file

The handlers I have are not being run by the playbook or tasks I have the following directory structur: <project> - playbook.yml - <roles>

Setting relative paths in Dockerfile when building with ansible

I am trying to build some docker files using ansible, but it is not clear what is used as the build directory. directory structure . ├── build

How to get hostname with largest number in the inventory

How to extract a hostname with the largest number and use that hostname in the mount command as shown below? Basically, I have only one volume that needs to be

Is it possible to configure Azure Windows VMs using Ansible on Azure DevOps Microsoft Hosted Ubuntu agents?

We try to configure an Azure VM using an Azure DevOps pipeline. We first create the machine using Terraform and then we need to configure it. Right now the pipe

How to sort version numbers in Ansible

I'm building an Ansible playbook in which I want to make a backup of a database in case I need to upgrade the software. For this I want to compare the highest v

Terraform: wait till the instance is "reachable"

I have some Terraform code with an aws_instance and a null_resource: resource "aws_instance" "example" { ami = data.aws_ami.server.id instance_ty

Ansible playbook with JSON output

I'm new to Ansible and I'm having a problem passing a variable into json_query to read elements from a JSON array. working line: Interface:{{ result.json |

Ansible uncomment line in file

I want to uncomment a line in file sshd_config by using Ansible and I have the following working configuration: - name: Uncomment line from /etc/ssh/sshd_confi

Ansible WinRM Server did not response with a CredSSP token after step Step 5

I am using Ansible (2.9.6) to connect Windows server using WinRM CredSSP. for win ping command its giving server did not response with CredSSP token. CredSSP en

How to copy files that match a glob pattern with Ansible

I have the following local set of files: $ find . -maxdepth 2 . ./.DS_Store ./radio ./radio/server.properties ./radio/recordings/ ./radio/requirements.txt ./rad

Ensure a certain amount of time has elapsed between two tasks in ansible playbook, in real time

I will be notifying users that an event will happen in 15 minutes; I then perform tasks that take a variable amount of time which is less than 15 minutes, and I

Docker, how to deal with ssh keys, known_hosts and authorized_keys

In docker, how to scope with the requirement of configuring known_hosts, authorized_keys and ssh connectivity in general, when container have to talk with exter

Ansible error loading fact, please check content but not always

I am trying to retrieve the available memory using ansible facts. When I run the code directly on the target machine, it works as expected. However, when I run

How to filter out a particular line from ansible output

I am facing an issue while running my ansible-playbook to filter out the IP address from the playbook output. Here is my code - hosts: myhost tasks: - nam

Change Ansible key in a dict

I have a dictionary in Ansible. my_dict: key1 : value1 key2 : value2 key3 : value3 key4 : value4 I would like the final output to be my_dict: key

Delete all old files, but keep newest 4 files using ansible-playbook

I would like to delete all old files, and keep newest 4 files. The output isn't what i expected. Even i use absent on file modules, but it doesn't delete the fi

Provisioning with Ansible and Vagrant multiple vagrantfiles

I'm creating a monitoring environment that has monitoring_servers and monitored_boxes, and of course Ansible controller. For testing roles etc I've created a n

Unable to perform "git clone" on local system using Ansible

I am trying to clone a git repo on my local system. I have done this manually and it works fine, but when I try to do it via Ansible, it doesn't work out Here i