Questions tagged [ansible]

On-topic questions are concerned with the use of the tool itself. Installing Ansible and prerequisites, connection issues, ... are off-topic. Red Hat Ansible is a model-driven, configuration management, multi-node deployment/orchestration and remote task execution system. It uses SSH by default, so there is no special software to be installed on the nodes you manage. Ansible is written in Python but can be extended in any language.

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

How to set up an hostnamectl set-icon-name via ansible

Redhat has a command called hostnamectl set-icon-name. Is it correct to configure this using ansible? The usual command (ansible.builtin.shell: "hostnamectl set-icon-name {{ inventory_hostname }}&...
ZULI's user avatar
  • 33
0 votes
0 answers
14 views

solaris command works fine when executed manually but fails when triggered using ansible

Below command works fine on Solaris: solarishost<db01:hostuser>$ nawk '/ap0085/ {getline; print}' /opt/.unx_env | awk -F= '{print $2}' mypass solarishost<db01:hostuser>$ echo $? 0 ...
Ashar's user avatar
  • 3,037
0 votes
1 answer
28 views

Merge two YAML files with ansible.builtin.include_vars and combine

I am trying to merge these two YAML file together: vars/standard_x.yaml: --- paas_id: "aze8ea" paas_name: "test-ngi" components: - name: paas_registration - name: argos ...
Arnau Amargant's user avatar
-3 votes
0 answers
24 views

Ansible filter and and adding new variable based on condition [closed]

Is it possible to set up a status variable based on condition? - name: Get all Certs and their details set_fact: certs_info : "{{ certs_info | default ([]) + cli_facts | json_query(...
Priyanka's user avatar
0 votes
1 answer
42 views

Temporary files are not deleted even if ANSIBLE_KEEP_REMOTE_FILES is set to false

Centos 6.9 ANSIBLE_KEEP_REMOTE_FILES = false version ansible 2.8.1 /tmp/.ansible-root/tmp/ Regarding temporary files deletion: If the task fails, won't tmp be deleted? If I abort the playbook ...
Chandrama Padagavakar's user avatar
-4 votes
0 answers
25 views

Dynamically creating tables using Terraform and Ansible on GCP Cloud sql postgres instance [closed]

Cloud sql doesn't support ssh connection how can run my ansible script I want to create 3 schemas and multiple tables using sql scripts. I don't want to hardcode the database password in ansible ...
Aroh yadav's user avatar
-3 votes
0 answers
18 views

Issue with Ansible URI module execution for Spectrum API [closed]

I'm currently facing an issue while trying to execute a Spectrum API call using the Ansible URI module. The API call is working fine in Postman, but when I try to replicate it in Ansible, I encounter ...
premkumar G's user avatar
0 votes
1 answer
61 views

Ansible: How to compare Linux services for 2 hosts?

I want to compare 2 Red Hat server's service list by Ansible and print out only the different service that is running. For instance: server 1 running services: a,b,c,d server 2 running services: c,d,...
G.Baysec's user avatar
  • 141
0 votes
0 answers
25 views

Ansible Task fails because of undefined variable but when condition should prevent task from running [closed]

I have the following Ansible tasks: - name: Generate password for new ansible user ansible.builtin.shell: openssl rand -base64 14 register: ansible_control_user_password when: ...
Lucas W's user avatar
0 votes
2 answers
35 views

AWX LDAP configuration in a declarative way

In order to fully configure my AWX instance in a declarative way, I set up an Ansible playbook I launch from my Debian server to my AWX instance (K8s hosting). Everything works great, i'm able to ...
motorbass's user avatar
  • 196
-2 votes
0 answers
25 views

Configuration store and management [closed]

I have an application that has something like below structure Service A - application and environment configuration, infrastructure dependencies (Queue, DB etc) etc. Service B - application and ...
user14013917's user avatar
1 vote
1 answer
23 views

Refresh dynamic inventory during playbook run

Is it possible to refresh inventory during ansible playbook execution? I create AWS objects (VPC, subnets, security groups etc.) from scratch with playbook which uses plugin amazon.aws.aws_ec2 for ...
shpokas's user avatar
  • 139
1 vote
2 answers
46 views

Ansible throws error with ini_file module if section is null

Can someone please tell me what I am doing wrong? I am using version: ansible [core 2.15.3] I have a playbook with the following task: - name: Ensure fav=juice is in file community.general....
dealbitte's user avatar
  • 221
-2 votes
0 answers
19 views

Ansible global handling error and execute shell command

I have master playbook which consist of many other playbooks (roles). I'd like to handle installation failure (on any step of this installation) and execute shell command. Is it possible to do it in ...
John Smith's user avatar
1 vote
1 answer
35 views

Ansible stops running on a host after an error and I can't use ignore_error

During my work on deploying a Kafka Cluster I've noticed that problems might occur if I add a connector to Kafka Connect without first checking if the last added is actively running. So I have this ...
grizzo's user avatar
  • 161
0 votes
1 answer
24 views

Ansible URI tasks failing suddenly with no changes due to SSL issues

I have a series of playbooks that all stopped working suddenly. I have made no major modifications to the Ansible server other than running system updates, and all of the devices are firewalls / ...
Moridn's user avatar
  • 37
-1 votes
0 answers
31 views

Ansible - How to extract from output of a loop and assign to variable

I am trying to get the Confluent Active Controller broker server name using a playbook. The shell command I use to achieve this is : act_controller=$(zookeeper-shell "${zookeeper_host_port}" ...
adbdkb's user avatar
  • 1,965
0 votes
0 answers
37 views

Create container from git repo and run with podman

I am trying to leverage ansible to: pull a git repo create an image tagged with the git commit hash run the image using podman as a user systemd service The requirements are that: run rootless if ...
Shunkica's user avatar
0 votes
0 answers
19 views

ansible playbook not able to find the inventory file [duplicate]

I am running an ansible playbook, in the playbook only I am calling a python script which actually generates the inventory file which needs to be used by this playbook.. For the very first execution, ...
Sandy's user avatar
  • 419
0 votes
0 answers
10 views

Are tags of the handlers ignored? [duplicate]

We use handlers to restart services, when the service-configuration files change. Duh... However, sometimes such immediate restarts are undesired -- so we tagged all such handlers with the same tag (...
Mikhail T.'s user avatar
  • 3,143
0 votes
0 answers
28 views

Ansible dynamic inventory for Azure always empty

I'm working on a multi-cloud setup with Ansible and Azure support is the latest platform addition. The problem is that Azure dynamic inventory is delivering empty list of hosts. There are no error ...
TonyAngelino's user avatar
1 vote
0 answers
28 views

Certificate: the specified credentials were rejected by the server

Need help Securing WinRM for Ansible with Certificates. Ive followed a couple tutorial on setting it up but Im getting an error when testing with ansible web -m win_ping -vvv. I get the error: [server ...
eia92's user avatar
  • 79
0 votes
1 answer
32 views

How can I call a playbook from a role?

I have a playbook which does a set of tasks, import a playbook and then perform next set of tasks in below order and it works well . --- - hosts: all tasks: - include_tasks: task1.yml - ...
Linuxuser's user avatar
-4 votes
0 answers
57 views

Formatting of JSON structure lost when its saved and readback from a file in ansible [duplicate]

Below is my ansible play (reproducible tetcase) that dumps a variable multiline_json_data having multiline JSON structure into a file. The file keeps appending similar multiline JSON data. I expect ...
Ashar's user avatar
  • 3,037
0 votes
1 answer
33 views

Ansible task fail when running script command

When executing a playbook with the following command I get a failed with a Could not find or access '/opt/ansible-automation-platform-setup-bundle-2.4-1.4-x86_64/setup.sh' on the Ansible Controller.\...
Danilo Patrucco's user avatar
0 votes
1 answer
34 views

Unable to resolve conflicts while building AWX-EE custom image

I'm currently building AWX EE custom image with the latest available but it seems latest versions got some conflicts with pip modules. My custom image was working great in July (awx-ee version 22.X 23....
motorbass's user avatar
  • 196
-2 votes
0 answers
26 views

Store and reuse ansible roles in github

I'm having trouble to store and pull roles that are stored on github. My folder structure is as the following: / /src /tests /docs /deploy /ansible /roles /myRoleA /...
DJYod's user avatar
  • 233
1 vote
2 answers
47 views

Convert win_service_info dictionary to lowercase

I am using the win_service_info module to store the services of a Windows machine into a dictionary. But, later, I want to search for a specific service by the path to the executable. I want this to ...
Jason Garner's user avatar
-3 votes
0 answers
90 views

Loss of indentation and formatting occurs when saving the output to a file and reading it back in Ansible [closed]

Below is the Ansible play where i execute mongo command and display the output as below: - name: "Executing .txt {{ item | basename }} scripts in order" shell: "sudo docker exec -ti {{...
Ashar's user avatar
  • 3,037
-1 votes
1 answer
50 views

Unable to redirect variable's value to file using ansible copy module [closed]

I have taken just a sample from a huge data that I wish to read from variables and dump in the file. cat junk.txt {:,:"(s):"}} This data in the junk is not in my control and comes as ...
Ashar's user avatar
  • 3,037
0 votes
0 answers
25 views

Ansible 2.15 Filter expression is not being evaluated when called from JSON

Environment (I am using ansible-navigator to run playbooks so the environment is within a podman container): ansible [core 2.15.5] config file = /etc/ansible/ansible.cfg configured module search ...
rick_sorkin's user avatar
-2 votes
0 answers
42 views

How do I cure a division by zero issue in Ansible? [closed]

I have a playbook that makes an ssh call and brings back some capacity information. Since it is using the ansible.builtin.command module the return is captured by stdout and thus the data is a string. ...
Andrew Madsen's user avatar
-2 votes
0 answers
37 views

Flask Application Deployment using Ansible roles and Docker-Compose [closed]

Sure, it looks like you have a detailed set of tasks for deploying a Flask application using Ansible roles and Docker. To assist you, let’s break it down: Create Ansible Role “Installation” /etc/...
patil ajay's user avatar
-1 votes
0 answers
49 views

Ansible: No package matching 'docker-ce' is available [closed]

I know the question was asked but it was 6 years ago. In general I have ansible playbook that suppose to install Docker on Oracle Cloud powered by Ampere (arm) that runs arm version of Ubuntu. The ...
Jan Pips's user avatar
  • 111
1 vote
1 answer
35 views

Extract Specific data from json in ansible

I have a big json var, the structure is like this: { "ad_groups": [ { "display_name": "GROUPNAME", "group_members": [ ...
YaserMow's user avatar
0 votes
1 answer
71 views

How to write an Ansible playbook for starting Artifactory services?

In order to automate the Artifactory and Xray services, starting process from the Remote Servers, we decided to make use of our existing Ansible Tower with playbooks to start and stop the Artifactory ...
Vowneee's user avatar
  • 1,170
-3 votes
2 answers
42 views

Ansible lineinfile to add a string in front of every line and convert to single line [closed]

I am using sed to add a string in front of line and then xargs to keep in single line. How can I achieve same in ansible ? For eg : I have a file as below [root@test]# cat tt aa bb cc dd With sed , ...
Linuxuser's user avatar
1 vote
2 answers
38 views

How to run ansible task with_items only when items not empty

this is my ansible task - name: "Add sudoers users to wheel group" with_items: "{{ system_users }}" changed_when: no user: name: "{{ item.name }}" password: ...
Sangria's user avatar
  • 145
0 votes
2 answers
65 views

molecule lint - Error: No such command 'lint'

I am trying to understand how to configure Ansible linting as part of my testing phase but unfortunately all information and documentation out there about molecule seems to be outdated. First, this is ...
qmaxquique's user avatar
-3 votes
0 answers
40 views

Best practices on creating ansible roles with docker(-compose) and molecule? [closed]

I'm trying to automate my homelab with Ansible. Most my applications are docker(-compose)-based. I've created in the past some roles with docker-on-docker in molecule for testing (based on geerlingguy'...
Laur Ivan's user avatar
  • 4,141
3 votes
1 answer
42 views

Difference between using prefix "ansible.builtin" and without

In tutorials I find sometimes: - name: Copy something ansible.builtin.copy: src: "src/foo" dest: "dest/foo" but sometimes: - name: Copy something copy: src: "...
k_o_'s user avatar
  • 5,424
0 votes
1 answer
34 views

How to get a file with the highest version number from a list of files in Ansible?

I have a scripts directory on my Ansible Control Node. In this directory there are multiple files, Worker1_0, Worker1_5, Worker2_1 and so on. The numbers are version numbers. I want to write a role ...
Lucas W's user avatar
-2 votes
0 answers
24 views

Escalation succeeded in Ansible

I am running a module in Ansible name: roles hosts:all gather_facts: false become: true tasks: command: yum groupinstall "server with GUI" -y --allowiearsing" while ...
avinash nagella's user avatar
1 vote
1 answer
58 views

Match name: of the list1 to a name: of the list2 and get matches from the list2

I am trying to find matches based on list1 name: in list2, but as the result get the dict2 matches. I am using this with Ansible. list1 : - name: game1 - name: game3 list2: - name: game1 ...
zwerk's user avatar
  • 13
0 votes
1 answer
46 views

Ansible - Concatenate list of items for command module without surrounding quotes

I'm trying to concatentate an Ansible list into a space seperate string without surrounding quotes within a shell or command module call. The command I'm trying to use requires a space separated list ...
another_d's user avatar
0 votes
1 answer
23 views

How to Clean Up Ansible Runner Processes Stuck in Interaction?

I'm using ansible_runner to execute Ansible modules, typically the shell module. I have a scheduled script for running these tasks, but occasionally I encounter an issue: Ansible tasks seem to get ...
Tony's user avatar
  • 35
1 vote
1 answer
51 views

Precedence order in Ansible variable assignments, confused

I have the following playbook: - hosts: localhost vars_files: - vars/common_vars.yml vars: deploy_folder: "win" in my vars/common_vars.yml deploy_folder: "linux_deploy"...
g.pickardou's user avatar
-1 votes
1 answer
51 views

How can I test three conditions in a when clause?

My requirement is to execute a command if three conditions satisfy. But the below condition does not work as expected when: (count.stdout == 0 and type == 0 and operat.sdtout == "AIX") As ...
Dileep Nannapaneni's user avatar
-2 votes
0 answers
28 views

ansible - cisco IOS reloading switch, prompt error

I have a problem with reloading cisco switch using ansible. I am trying with this playbook: tasks: - name: reload device ignore_errors: true ios_command: commands: - "...
fuzioon64's user avatar
1 vote
1 answer
41 views

Using a variable from a previous play along with patterns in the 'hosts' keyword of an Ansible playbooks

I have this playbook. It will eventually be used to execute SQL on a MySQL database. --- # This playbook sets a bunch facts/variables # including mysql_config_master. - import_playbook: init.yml - ...
Red Cricket's user avatar
  • 9,908

1
2 3 4 5
455