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
10 views

Error after execeuting Ansible-Playbook command related to OpenGPG verification

For my virtualisation class we currently have a task where I need to create a Kubernetes cluster using Ansible. We have a guide in how to do this and i've been following the steps plus troubleshooting ...
Yuna's user avatar
  • 1
0 votes
0 answers
24 views

fatal: [node1]: FAILED! => {"msg": "module (kube) is missing interpreter line"}

I've been trying to install Kubernetes cluster with Kubespray 2.22.0 for a while. I get the error on the node where I run ansible-playbook: fatal: [node11]: FAILED! => {"msg": "...
Fikret's user avatar
  • 1
0 votes
0 answers
29 views

How to add/update a host in an inventory on Ansible Automation Platform?

I'm trying to run a workflow in Ansible Automation Platform where I create an EC2 instance, then I want to add the IP to a host (or create a new host if it doesn't exist) in an inventory so that I can ...
jeremywat's user avatar
  • 444
-1 votes
0 answers
19 views

Ansible connection fails with vagrant [closed]

I am trying to use command vagrant provision but in my case it is giving error fatal: [master]: UNREACHABLE! => {"changed": false, "msg": "Data could not be sent to remote ...
hassan 's user avatar
-2 votes
1 answer
32 views

Setting up conditional loop in Ansible but receiving undefined error

I have the following tasks - name: detect if table exists script: /detect.sh # returns 0 if the "names" table is found register: result with_sequence: count=100 when: result.rc != 0 ...
user3822558's user avatar
2 votes
2 answers
50 views

How to use if/else condition in JMESPath

I'm trying to get the name and is_encrypted attributes of a JSON object based on condition. I.e.: is_encrypted == YES if data_encryption.drive_protection_enabled == true or data_encryption....
Mounika's user avatar
  • 57
2 votes
1 answer
19 views

Ansible: How To Compare 1 Host's Services with Multiple Host's Services?

I had an issue with comparing services for 2 server's with ansible. That is solved by the below yaml. My question is, how can I compare 1 host's service list with multiple host? --- - hosts: test ...
G.Baysec's user avatar
  • 163
0 votes
0 answers
33 views

Merge two ansible tasks

I have these two ansible tasks: - name: Merge standard and delegation vars components ansible.builtin.set_fact: merged_components: >- "{{ standard['components'] | community.general....
Arnau Amargant's user avatar
2 votes
1 answer
26 views

How to extract multiple nested attributes from all items in a list of dicts?

I have a list of objects and I need to pull out multiple attributes from the items in the list so that the result is a list of only those attributes and none of the others. Here's what my original ...
jeremywat's user avatar
  • 444
0 votes
0 answers
9 views

Cant add zabbix host ansible

I dont create zabbix host via code bellow: - name: Zabbix Agent. Create host vars: ansible_network_os: community.zabbix.zabbix ansible_connection: httpapi ansible_httpapi_port: 443 ...
Nikolay Debolsky's user avatar
1 vote
1 answer
36 views

update_facts with json_query

I am attempting to modify several values in a JSON file. The most efficent way to do this seems to be with the update_fact module which requires an ouput to the register. This issue I am having is I ...
Kio's user avatar
  • 35
0 votes
3 answers
77 views

How to pass a password to the vault-id in a bash script?

I have a bash script that runs multiple ansible-playbooks. eg.before encryption ansible-playbook check_patch_applied.yml --extra-vars="target=123 patch_number=232323" -v t ansible-playbook ...
AUser's user avatar
  • 37
0 votes
0 answers
18 views

Migration from ansible 2.7 to 2.12 problem with cisco.ios.ios_command module

Hello i ave a problem since my migration to ansible 2.7 to 2.12. I use my old playbook with cisco.ios.ios_command and i have this error when i try to send my ios command: fatal: [192.168.1.12]: FAILED!...
Silver's user avatar
  • 15
1 vote
1 answer
58 views

search & replace a list of dictionaries by another list of dictionaries and a given attribute

is it possible to search and replace the following (source) list of dictionaries: - k: aaa v: 1 - k: bbb v: 2 - k: bbb v: 3 v2: should be kept from source - k: bbb - k: ccc v: 4 by this (...
Niki Waibel's user avatar
0 votes
0 answers
22 views

ansible not returning powershell task result as role result

I am using ansible core 2.15.4. and have the below playbook: tasks: - name: My Custom task ansible.builtin.include_role: name: my_task vars: my_items: ...
Murat Erenturk's user avatar
0 votes
0 answers
63 views

ec2 instance is hanging when we move the larges files to tmp directory

When I move around 100gb files to /tmp directory with allocating 300gb, When I tried using ansible for move file to tmp directory then I am getting below error {"changed": false, "...
Umesh 's user avatar
  • 15
-2 votes
2 answers
39 views

ansible playbook to delete multiple file with search pattern

Using Ansible, how would I delete all items like those below rm -rf /var/log/messages-* rm -rf /var/log/mail-* rm -rf /var/log/secure-* rm -rf /var/log/cron* rm -rf /var/log/spooler-* rm /var/...
Saravanan Vadivelu's user avatar
-1 votes
2 answers
33 views

unable to use set_fact in ansible

unable to use set_fact in ansible. please help me out "msg": [ "nilaj 15", "ajin 15" ] - set_fact: name_list: "{{ name_list + item.split() | first }}&...
Balkrushna.Kamble's user avatar
1 vote
1 answer
18 views

Parsing Flat Inventory From Inventory API File With Ansible

I need your help to understand or find the best way to parse a string like this from inventories API who return this: ""Name","Status","Environnement",\r\n "...
ElBaBa's user avatar
  • 11
3 votes
2 answers
78 views

Replace module to remove everything starting with a string to the end of file

I need to remove text from a file starting with a particular string — control_center_basic_users: — until the end of file control_center_basic_users: admin: principal: admin password: '' ...
adbdkb's user avatar
  • 1,995
0 votes
1 answer
27 views

Ansible use dict and string with combine function

I have a problem that I don't understand, more precisely I would like to understand the cause of the problem and therefore also the solution. I have an Ansible-Playbook for my nfs mounts. If I run ...
user2369332's user avatar
-3 votes
0 answers
21 views

How to add rhel compute node in existing kolla-ansible ubuntu node [closed]

i have a openstack node with 1 controller and 1 compute node with ubuntu OS , i have deployed this with kolla-ansibe , now i want to add red hat node as a new compte node. Please guide me, how i am ...
Himanshu Bhatt's user avatar
-3 votes
0 answers
55 views

Unable to update the file using ansible even though it exists with good permissions [closed]

Below is the ansible code to add a forward slash to the provided file list in the variable source_files All the commented lines in my code are various stuff i tried to get this to work but it simply ...
Ashar's user avatar
  • 3,033
-1 votes
1 answer
20 views

Ansible - How to patch systems in an order and based on the operating system?

I have dynmaic inventory which has 10 nodes. 8 of them are RedHat and 2 of them are Ubuntu. The hosts are in random order. I want to write a playbook so that it will patch the Ubuntu node at last ...
Eugenics 's user avatar
-3 votes
0 answers
39 views

Sqlplus query waits indefinitely when executed as ansible task [closed]

I'm able to execute this SQL query and get the output in no time: targethost<db01:remuser>$ source ~/.profile && cd /u targethost<db01:remuser>$ sqlplus -s orauser/orapass @11_DB....
Ashar's user avatar
  • 3,033
1 vote
1 answer
48 views

How do I `hostnamectl set-icon-name` via Ansible?

Red Hat 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
  • 45
-2 votes
0 answers
31 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,033
0 votes
1 answer
57 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" components: - name: paas_registration - name: argos size: s ...
Arnau Amargant's user avatar
-3 votes
0 answers
40 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(...
Mounika's user avatar
  • 57
0 votes
1 answer
54 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
-3 votes
0 answers
19 views

I encounter problems - 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
82 views

Ansible: How to compare 2 host's services with ansible?

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
  • 163
0 votes
0 answers
31 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
47 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
-3 votes
0 answers
34 views

Versioning for configuration and infrastructure corresponding to application code version [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
50 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
21 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
36 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
27 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
35 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,995
0 votes
0 answers
45 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
33 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
32 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
33 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
59 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,033
0 votes
1 answer
38 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
41 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

1
2 3 4 5
455