Category "ansible"

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

How Do I Prevent Ansible Skipping My win_shell Task?

I have a win_shell task in Ansible to stop certain processes: - name: Stop Citrix applications win_shell: (Get-WmiObject Win32_Process | where-Object commandlin

How can I send Ansible Tower workflow template approval to Slack channel and recieve response from Slack channel?

I have a situation where the approval logic in Ansible Tower workflow template is working fine, Slack notifications are also working fine, but, I want to send a

How to create a mail profile in my remote windows machine using ansible

I'm unable to create a mail profile in my remote windows machine which has Outlook 2016. I havw to create it using ansible. I tried this: - name: Manage windows

Controlling account that runs ansible script vs. ssh account that connects to target server

Scenario: two linux servers; First is ansible controller node - srvControler. Second server is remote target - srvTarget. On ansible controller node (srvControl

How to run a Java download command using shell in ansible

I want to download and install Java in one our VMs using Ansible. I tried with yum and that was successful but, as part of requirement I was asked to do it anot

How can I manage groups in inventory?

I have a common playbook (task) but in my last task I want to do an action on a group of hosts and when it is finished, do the same action on another group (for

Is it possible to import child yaml file in main yaml where child yaml will decrypt login info with ansible-vault

>>> main.yaml --- - hosts: localhost connection: local gather_facts: false vars_files: - child.yml tasks: - debug: var: user