As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [ansible-playbook]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
31 views

UNREACHABLE! => {"changed": false, "msg": "Data could not be sent to remote host

I have SSH access for a particular server, but when I am trying to run the playbook for that server. I am trying to do the deployment for that server but I'm facing an issue. fatal: [lapp999.corp.com]]...
Varun K M's user avatar
-1 votes
2 answers
34 views

Override hosts variable of Ansible playbook without command line

Have 2 hosts my_host1, my_host2 This code work for my_host1, I also need run it for my_host2 Can be overridden hosts value on ansible main.yml task without changing string "hosts: my_host1" ...
tuytuy20's user avatar
-1 votes
0 answers
23 views

Ansible tag usage from playbook when include_tasks used [duplicate]

Have ansible code and need run just second task on example.yml from myplaybook.yml is it possible? # myplaybook.yml - hosts: localhost tasks: - name: Run tasks from example.yml block: - ...
tuytuy20's user avatar
0 votes
1 answer
61 views

Setting mysql using ansible in ubuntu remote machine

I have written one ansible playbook for installing MySQL server in ubuntu remote machine but is not working here is the yaml code --- - name: setting mysql in ubuntu hosts: web01 become: yes ...
Nikhil Chopra's user avatar
0 votes
1 answer
107 views

You should set the `loop_var` value in the `loop_control` option for the task to something else to avoid variable

My environment: # cat /etc/debian_version 11.7 # ansible-playbook --version ansible-playbook [core 2.13.1] config file = None configured module search path = ['/root/.ansible/plugins/modules', '/...
alexus's user avatar
  • 13k
0 votes
0 answers
28 views

Can't connect from Debian VM to Windows Server VM

I've got a problem while trying to configure my Ansible server to connect to a Windows host using ssh keys. When I try this command : ansible win -m win_ping I never got an answer, even after few ...
Yannick25's user avatar
0 votes
1 answer
75 views

Return Values from Ansible Role Tasks in a loop are only registered for the last item

I have a role ovirt_vm_add_disk_role that creates a new disk for a VM with ovirt_disk module. In that role I register the variable disk_info which contains the results of the ovirt_disk module: - name:...
TZar's user avatar
  • 46
0 votes
0 answers
19 views

why ansible_facts['distribution']=="Suse" skipping apache install on Suse

I created the simple ansible playbook to install apache on CentOS and Suse. It works on CentOS but skipping on Suse without any errors, I do not understand why. This is the playbook: name: To ...
emp0001's user avatar
1 vote
2 answers
174 views

Ansible : Loop inside loop

On ansible [core 2.13.3] my var.yml file is like this : vlans: Servers: vlan_id: 10 ip: 192.168.22.20 mask: 255.255.255.0 mode: tagged: 1/1,1/2 untagged: 1/3 Clients: ...
user5525652's user avatar
0 votes
0 answers
39 views

How can I make Ansible Playbook to Continue after IP Change?

I have a playbook which configures Static IP Address and reboots the Server. However, the playbook is resulting in an error. Even the following code also doesn't seems working - name: Creating ...
UME's user avatar
  • 101
0 votes
1 answer
108 views

How to replace shell module with command module in Ansible?

I need one small help. In below example I need to replace shell with command module. But I am confused as command is not working with pipe. So please give me the solution of this task. E.g: - name: ...
Rupam Sabale's user avatar
-1 votes
1 answer
80 views

Ansible command task missing stdout for nginx config verification

After deploy new configuration of Nginx, I would like to verify configuration before Nginx handler for reload is applied. This is output of command line: nginx -t && echo $? nginx: the ...
dorinand's user avatar
  • 309
0 votes
2 answers
161 views

Ansible :: Am I not using the `cisco.ios.ios_facts` module?

I'm trying to build a simple POC ansible playbook that logs into a Cisco router and pulls the config. About my environment: My Ubuntu is Ubuntu 18.04.5 LTS My Ansible is version ansible 2.10.7 (...
Pete's user avatar
  • 131
1 vote
1 answer
96 views

Ansible to a Cisco Router :: Password Message Messing Up the Connection?

When I manually SSH from my Ansible server to a Cisco router, I see this on the command line: me@ubuntu01:~/ansible$ me@ubuntu01:~/ansible$ ssh user01@10.10.10.101 Password: ####################### ...
Pete's user avatar
  • 131
0 votes
0 answers
71 views

Store ansible vault password in azure keystore

At my company we use Azure cloud services. For our local department we want to setup a set of Linux servers. These servers are used to form a test setup. To setup and maintain these servers we chose ...
Jan Jaap's user avatar
  • 101
1 vote
1 answer
40 views

Safely abort Ansible playbooks when server downtime runs out

Afaik ansible offers no possibility to safely exit a running playbook, so I am wondering which strategy would be wise to not leave hosts in inconstistent states: Lets picture an infrastructure of ~300 ...
Aguirre23's user avatar
0 votes
0 answers
60 views

Ansible getting error when connecting to remote windows host over ssh

I have created a windows 2019 EC2 instance using Ansible. Once ec2 instance is created i have added the instance into hosts and then created a new play for accessing and executing commands on remote ...
Tarvez Khan's user avatar
2 votes
1 answer
53 views

Vmware tags and Ansible , empty out in Ansible but VMs have tags

I am trying to filter out the list of VMs with specific tags. The sample playbook is as follows : - hosts: localhost gather_facts: false become: false vars: vcenter_hostname: ...
uozzyy's user avatar
  • 23
0 votes
2 answers
190 views

In ansible, with win_shell (Powershell), how to force the job status into failed

I'm new to Ansible. I created a playbook that uses PowerShell to reset your password of your admin account. The script has a check that only resets the password IF the account is enabled. When the ...
Snak3d0c's user avatar
  • 101
1 vote
1 answer
1k views

Ansible playbook can not connect to remote user through ssh => unreachable & permission denied

I'm building a complete solution to setup and harden our vps (ubuntu 22.04) with bash script and Ansible playbooks. What I want to do is the following: Create a custom group "sudogroup" ...
Emmanuel FRANCOIS's user avatar
0 votes
2 answers
341 views

AWX SSH connection not establishing when running playbook

I am trying to run my first playbook. Running AWX on CentOS8,trying to connect to remote device using SSH. On my remote device I have run ssh-genkey on my device and added the .pub key to ...
leonardf2001's user avatar
0 votes
0 answers
78 views

Tagging behavior in a playbook with a role which contains an "include_role" task

Having this structure: Playbook(play2.yml) - hosts: localhost roles: - name: genrole tags: - genrole_tag # tagging is needed, since other ...
johniswick's user avatar
0 votes
1 answer
585 views

How to handle network changes and restart with Ansible?

I'm currently developping a network configuration role used by Ansible to customize our fresh new virtual machine that came from our Debian 11 template. The following role changes from DHCP to static ...
motorbass's user avatar
  • 153
0 votes
0 answers
22 views

Failing to create Digital Ocean Droplet with firewall

I am trying to create a firewall and then create a DO Droplet with that firewall added to it. Here's my playbook: - hosts: localhost vars: digital_ocean_token: '{{ lookup("env", "...
trouble_bucket's user avatar
0 votes
2 answers
561 views

Running a local script on local host with Ansible

I have a python script which is able to retrieve the IP adress of my remote node, and as a pre-task of my ansible playbook I would like to run this script and set the IP adress. Is there a command in ...
hugo2410's user avatar
0 votes
1 answer
171 views

ansible print folder path from register variable

I'm trying to print just the path of a register var that has multiple values, however I can only print a specific value. how can I print multiple values? --- - name: find directories find: ...
rigged's user avatar
  • 1
0 votes
1 answer
262 views

Ansible: read csv file line by line and render it to template with loop

I am using a csv file to get data and render it to template and copy to remote servers. I am facing issue that CSV file read twice for same server and this results in loop to copy last line in each ...
Lucky Ameta's user avatar
3 votes
1 answer
104 views

How to debug Ansible dict for failed ports with wait_for module?

I have written the below playbook to fetch the failed port status. - name: Check port status wait_for: host: 127.0.0.1 port: "{{ item }}" timeout: 2 state: started ...
Kamal's user avatar
  • 31
0 votes
1 answer
268 views

I cannot download MySQL ConnectorJ with ansible anymore

I have a task that looks like this: - name: Download {{ mysql_connector_download_url }} ansible.builtin.get_url: url: '{{ mysql_connector_download_url }}' dest: '{{ ...
koenig's user avatar
  • 125
0 votes
1 answer
72 views

Ansible error getting again and again

ERROR! conflicting action statements: hosts, tasks The error appears to be in '/home/a899444/aerospike-ansible/roles/java_install/tasks/main.yml': line 1, column 3, but may be elsewhere in the file ...
nisha nand's user avatar
-2 votes
1 answer
370 views

How to write Ansible playbook to commit and push my new updates on gitlab repository

How to write Ansible playbook to commit and push a gitlab repository? I have Ansible tower template to launch my playbook, then playbook must do commit and push on different git repo. This git repo on ...
Aniket's user avatar
  • 1
0 votes
0 answers
101 views

Ansible playbook to read vars from plaintext file and log file checksums

In the process of learning ansible I am trying to create a playbook to run on some email hosts to gather sha1 hashes of the files. I have a plaintext file with the path and filenames the playbook ...
dj423's user avatar
  • 3
1 vote
2 answers
2k views

Ansible Loop Through Variable Number of Hostvars

I am trying to grab hostnames and IP addresses from a user-entered list of hosts and send that information to a central server. The primary issue I'm running into is that the number of hosts can vary ...
hypen9950's user avatar
0 votes
1 answer
139 views

Ansible Findall capture groups and list

I think I'm confused with Python and Ansible findall. Can I use capture groups in Ansible? For example, How can I capture group 1 and group 2 then reverse the position in the resulting list? For ...
Billy K's user avatar
  • 121
1 vote
1 answer
228 views

Create parameters from a list of lists

I have a fact, which is a list of lists, e.g. [ [disk1, filename1], [disk2, filename2], ... [diskN,filenameN] ] I need to run a command in the format like command -x disk1,file=filename1 -x disk2,file=...
Billy K's user avatar
  • 121
1 vote
1 answer
101 views

Fan out to other hosts when already using Serial in ansible

I have 80+ hosts that run my application, and I'm updating a long existing ansible playbook to change our load balancer. In our current load balancer setup, hosts can be added / removed from the load ...
Mike's user avatar
  • 113
1 vote
1 answer
129 views

Need to know more about the handlers in ansible

Below is the tasks I have in my nginx role # tasks file for nginx - name: Backup and update nginx configuration file template: src: templates/proxy.conf.j2 dest: "{{ nginx_conf }}&...
Vicky Ingle - Mint's user avatar
1 vote
1 answer
138 views

Syntax error in ansible while using handlers

Below is my role task which copied the nginx conf and then reloads the service only when the shell command output of nginx -t contains "syntax is ok" --- # tasks file for nginx - name: ...
Vicky Ingle - Mint's user avatar
0 votes
1 answer
448 views

Ansible and Jenkins: "winrm is not installed: cannot import name utils

I started to learn Ansible and Jenkins a few days ago. I'm stuck on one particular problem and despite many efforts can't figure it out. I have a very basic playbook that runs OK if I run it directly ...
Okrx's user avatar
  • 73
0 votes
0 answers
214 views

how to start nginx with ansible?

I installed nginx manually on my server, I started it to see if everything right then I "stopped" it. Active: inactive (dead) since Thu 2022-12-15 02:58:37 EST; 7min ago I am now using an ...
G20map's user avatar
  • 1
0 votes
1 answer
416 views

Ansible: grep crontab files based on usernames extracted from /etc/passwd

I'm looking to extract a list of users from /etc/passwd and then grep their crontab files for disabled (commented: ^#) jobs. The high level steps would be: Grab an array of usernames from /etc/passwd ...
Mike's user avatar
  • 23
0 votes
1 answer
348 views

Ansible trouble while launching an exe through win_command

I'm currently writing a playbook about uninstalling Fusion Inventory Agent and then deploy GLPI agent 1.4 on Windows Server 2016-2022. For all the tests i detail below, i use my domain account which ...
motorbass's user avatar
  • 153
2 votes
1 answer
1k views

Ansible: How to merge list of dictionary objects with the same key getting one dictionary element with a list of thouse different values grouped?

I have been struggled with Ansible for a time and finally requesting for any help if possible, Having a set of Nifi policies: "nifi_raw_policies": [ { "action": "...
Juan M.Victoria's user avatar
0 votes
1 answer
1k views

Ansible: Loop over the items of a host list and execute role

I have an application composed of micro modules distributed on multiple hosts. inventory: [moduleA_hostgroup] host1 host2 [moduleB_hostgroup] host2 host3 [moduleC_hostgroup] host1 host4 Each module ...
coquinho's user avatar
2 votes
3 answers
5k views

Ansible: "You need to install 'jmespath' prior to running json_query filter", but it is installed

I am using Ansible on top of Python3 and Enterprise Linux 8 (Rocky Linux 8). When I try to use json_query, I am getting the following error: fatal: [ansible]: FAILED! => {"msg": "You ...
norinori's user avatar
0 votes
1 answer
192 views

Playbook to extract hosts from /etc/hosts

I need help extracting hosts informations from /etc/hosts file and exporting that content to a predefined file. I created a Ansible's Playbook to this task, but the content is not written on the ...
Adelmo Silva's user avatar
1 vote
1 answer
2k views

How can I loop over files in a directory and move only the unique files using ansible

I’m trying to loop over all files in a directory, these files are named differently but should have the same contents. Is there a way to loop through all these files using ansible and then move the ...
Adam's user avatar
  • 31
1 vote
0 answers
102 views

Ansible EdgeOS "add" issue

I'm trying to create a playbook to update a few edge routers to current hotfixes, but I cannot find a way to get around the prompted yes/no question with the supported community.network.edgeos_command ...
Brian Lamb's user avatar
1 vote
1 answer
282 views

How to handle existing/non existing fact in Ansible?

For inventory purpose due to some business limitation, i wrote a playbook that retrieve content of resolv.conf + ntp.conf + timesyncd.conf and then, write the retrieved content within a CSV file. ...
motorbass's user avatar
  • 153
1 vote
1 answer
87 views

Ansible & Jenkins

here is my problem I run a playbook on jenkins with extra variables, I want to test in my playbook is variables are defined ansible [core 2.12.1] , jenkins plugin 1.1 here is the command from jenkins :...
Wanexa's user avatar
  • 71

1
2 3 4 5
10