Questions tagged [ansible]

Questions related to the tool itself are considered on-topic. This includes discussions about installing Ansible, dealing with connection problems, and so forth. Red Hat Ansible is a system for model-driven configuration management, orchestrating multi-node deployments, and executing remote tasks. By default, it utilizes SSH, eliminating the need for additional software installation on managed nodes. Although Ansible is coded in Python, it can also be customized using any programming language.

Troubleshooting npm installation and folder permission problems with Vagrant/Ansible

Having an issue where npm install doesn't work on my Vagrant setup using Ansible, but runs smoothly from the console. SITUATION 1) I have a playbook with the following lines: ... - name: install frontend libs npm: path=/vagrant/frontend/bem ... When ...

Attempting to manipulate arrays by using the json_query method

I'm experiencing difficulties with using the json_query function to filter arrays based on a specific key value. When providing the direct path, this is the API result that is displayed: ok: [localhost] => { "msg": [ { ...

Receive the results of the ansible runner in either JSON or YAML format

I am currently running my Ansible playbook from Python using ansible_runner. My goal is to improve the logs and retrieve specific event results. Typically, when the Ansible playbook is executed from the command line, it provides a human-readable output in ...

Error: The Ansible module development cannot proceed due to a missing module named 'server_types'

Currently, I am delving into the realm of creating my own ansible modules. To test a new module that I've developed, I have created a playbook named test_playbook.yml: --- - hosts: all tasks: - name: Suspend MNR realtime_server: serv ...

Utilizing variables effectively in Ansible for URI requests

Currently facing an issue with replacing values and creating a json template in ansible for sending via the uri module to a webserver. Seeking assistance from anyone who can help? It appears that ansible is converting all double brackets in the json to si ...

Incorporate a fresh key-value pair into a JSON file with Ansible

Currently, I am utilizing Ansible to automate configuration steps for my application VM. However, I am facing challenges when trying to add a new key-value pair to an existing JSON file on the remote host. Let's assume I have this initial JSON file: { ...

Struggling to retrieve information from a deeply nested array within an Ansible playbook

I am having trouble extracting the values of vs_name for each item in the array list. There seems to be an issue with my code, but I can't seem to pinpoint it. Below is the desired output that I need to parse: ok: [localhost] => { "msg" ...

How to pull specific nested dictionary values based on conditions using JINJA2 within Ansible for JSON data extraction

I am attempting to retrieve the CDN domain name associated with a specific Alias from Ansible's cloudfront_facts. The output, in summary form, looks like this: { "cdn_facts": { "ansible_facts": { "cloudfront": { "summary": { "distrib ...

Can we use JSON to effectively compare various variables?

My current task involves comparing running services before and after a reboot on Linux servers. However, I am facing difficulty in getting the output to display the differences. The function I have right now saves the pre/post state to disk. Ideally, I wo ...

Can Ansible convert integers into MAC addresses?

Currently, I am facing a challenge where I have an integer that needs to be converted into a MAC address. I attempted using the hwaddr in Ansible but it did not provide the desired result. Any assistance with this would be highly appreciated. I also explo ...

Remove a JSON object that corresponds to a particular value

I am in need of modifying a JSON file in a specific way. My goal is to remove an entire object from the file based on a certain condition. In this case, the condition is that "name": "value1_1:value1_2" The value of value1_1 is what I am targeting for ...

Tips on utilizing json_query to locate a specific pattern in Ansible

My goal is to extract specific data from a JSON response acquired through an API call using the uri module. The JSON output consists of key value pairs structured like this: item : "name-of-the-item" "json" : { "data": { ...

An error has occurred with Django compress: Input of type 'CacheKey' is invalid

We encountered a new problem when trying to compress Django static files on our production servers. Our setup includes Ubuntu 16.04, Python 3.x, and Django 1.11. I am using an ansible-playbook for deployment. The specific error message we are seeing is: ...

Failed to execute on [cor-001]: unable to proceed because junos-eznc (PyEZ) version 2.1.7 or higher is necessary for this module. Unfortunately, junos-eznc is not available

I encountered an error while trying to execute my playbook, despite having pyEZ installed. Can someone assist me in resolving this issue? MCBOOK:~ user2018$ ansible-playbook simpletest.yml [DEPRECATION WARNING]: [defaults]hostfile option, The key is ...

Obtain the package version from Ansible output by employing jq

I need assistance parsing the below JSON output from Ansible using jq. Specifically, I am trying to extract the version number for a package named GeoIP. How can I efficiently utilize jq to retrieve this version number for the specified package? The desir ...

Using Ansible with virtualenv to manage Windows Remote Management (WinRM

I'm currently navigating the world of ansible, winrm, virtualenv, and Jenkins. So far, I've successfully installed Ansible with Tom via epel-release. My configuration for Jenkins is still at a basic level. In my journey, I created a virtualenv named $HOM ...

Strategies for sorting through Ansible JSON data efficiently

Utilizing Ansible Automation for Linux Patching. After completing the patching process, I need to extract specific details from the JSON output. Below is the code snippet that does not provide accurate output from the JSON file when executing the playbook ...

Obtain data from JSON by leveraging Ansible's map functionality

I am trying to extract the UserId from the following output: ok: [localhost] => {"ansible_facts": {"Usernamelis": "", "_raw_params": ""{u'Users': [{u'UserName': u'reo', u'PasswordLastUsed': u'2016-01-08T14:00:34Z', u'CreateDate': u'2016-01-06T14 ...

Execute npm and node using ansible

I am facing a challenge with the script execution on a machine that has zsh installed. Here is what I have set up: Software Installed # Install NVM sudo curl https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash ## Reload shell to st ...

Utilizing either Ansible's Jinja templating or Python programming for performing calculations on a constantly

Currently, I'm working with ansible 2.5 and python 2.7 on a project that involves executing calculations on dynamic JSON variables. The variable in question is not fixed and can contain anywhere from 1 to 1000 objects. For example: var: [ { "name": ...

Refine intricate nested list JSON queries

I am currently working with the following data: { "additionalInfo": [], "id": "8d929134-0c71-48d9-baba-28fb5eab92f2", "instanceTenantId": "62f4c8ab6a041c1c090f ...

Error: Property name in Ansible must be enclosed in double quotation marks

Task at hand involves reading the contents of a file and for each line in JSON format, executing a script. This part is functioning correctly. - name: create users script: cmd: myscript.sh "{{item}}" with_lines: "cat users-list" ...