Category "ansible"

check variable null is not in stdout_lines

I have this output: - name: list image exist on nexu debug: var: check_image_exist.stdout_lines tags: - check_image_exist ok: [workstation] =>

Ansible hangs when copying from a remote host to remote hosts using synchronize module

When you attempt to copy a file from localhost to remote using the answerable synchronize module, the job stops without progressing. Can anyone help me? My task

How to pass extra variables to ansible playbook running in a Jenkins pipeline

Here is the pipeline code that I want to execute from Jenkins pipeline{ agent { label 'ansible' } stages{ stage('SCM Checkout'){ ste

Only run Ansible seport when ports are not yet configured. Preferably not through shell or command module using semanage

I have a role setup to install the iTOP application on LAMP/Rhel 8 with Ansible 2.9 I am trying to find a way to make the seport module only run when the needed

Ansible how to acces results dictionary

I am opening a playbook to update patches in centos, but first I need to validate that there are updated packages and in case the tasks are not stopped. I am us

ansible roles split tasks/main.yml in multiple files

I want to split my tasks/main.yml into different files in my Ansible role. With defaults/ and vars/, Ansible supports the creation of a main directory instead o

Parse json value when value contains a string in ansible

This ansible playbook works --- - hosts: localhost gather_facts: False vars: jq: "[?contains(name, 'Pizza')]" json: | [{ "name":

Regular expression to collect all IPs from Pod definition

I am trying to collect IP addresses of the pods which has 3 network interfaces attached to. From the output of kubectl get pod .. -o yaml, I would like to coll

Create jinja template from dictionary in ansible

how can I access stdout and item values in a dictionary? My inventory file: all: hosts: server1: dict: custom_mountpoints: - /srv/

Error: "datetime' is not json serializable" in Ansible playbook

I am getting below error while passing below date format to Ansible Tower REST API in extra_vars with Ansible uri module in body section. date_slot: '2022-04-04

How can I alternate the elements of multiple lists in Ansible?

I have multiple lists as input (all lists have the same length, but the input can have more than 3 lists). I want to create a list which is a sum of all input l

SUM value from 2 lists

I have the following outputs: { "vmoff": [ { "CONT2": [ "vm1", "vm2", "vm5"

Error when login to Docker container using Molecule

I have this Molecule configuration: --- dependency: name: galaxy driver: name: docker platforms: - name: instance1 image: docker.io/pycontribs/centos:

How to declare a variable for service_facts

Below is the sample ansible playbook I use to check the service status using service_facts module and it worked well. Here I need support to define the service

ZABBIX AWX, sync invetory

Is possible sync the inventory of Ansible tower (AWX) running in containers with Zabbix inventory? Any code or playbook to make this appreciate a lot!

ansible modify a delete value in nested dictonary

I would like to add new value in nested dictionary and old value should be delete. Here is my parse.json file. { "class": "Service_HTTPS", "layer4": "tc

Execute a ansible playbook if other playbooks fails

I have multiple play books, I have to run create_silence.yml at the starting of the execution and delete_silence.yml at the last, which I'm able to do. But afte

how to pass many variables in ansible?

I faced problems when I don't know how to pass many variables in with_items: I have these vars: - vars: paths: - /tmp/tecom/python3/ - /tmp/teco

Ansible shell command doesn't seem to have access to the user's shell environment

Im trying to use a ruby installed via RBENV. I have confirmed that RBENV works as desired and produces the correct ruby version which can be called via the ter

How can I manage keyring files in trusted.gpg.d with ansible playbook since apt-key is deprecated?

Before apt-key was deprecated, I was using Ansible playbooks to add and update keys in my servers. At the moment, apt-key no longer updates the keys. In few sea