Questions tagged [ansible-playbook]

Ansible playbooks are how ansible code is shared and reused.

112 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2 votes
0 answers
343 views

RouterOS shell command result with Ansible is different?

You will see, I have a little problem with the execution of an Ansible task, since I am giving it the same command that I work with in the Mikrotik shell, but the result is a little different and I ...
Fabio Orefice Amez's user avatar
2 votes
1 answer
43k views

-bash: ansible-playbook: command not found

Fresh Fedora Server Netinstall. Updated. Installed only Git and Ansible latest versions from standard repo. Want to execute Ansible against it's own host (localhost) to set up its host itself (not ...
Dzintars's user avatar
  • 203
2 votes
0 answers
1k views

ansible block-rescue is not working with handler

I am trying the following playbook. But even after getting the error from handler, the rescue section is not working. handlers: - name: port status shell: netstat -nltp | grep {{ app1_port }} ...
Sachin C's user avatar
2 votes
1 answer
368 views

Ansible: Replace (only) default config file

I'd like to place a custom configured /etc/my.cnf ONLY if the default my.conf is currently in place. Once the default my.cnf has been replaced or edited, I don't want to risk replacing it with my ...
Danny F's user avatar
  • 498
1 vote
1 answer
56 views

Creating a podman container as a non-root user in an Ansible playbook running as root

Is it possible to create a Podman container under a different user than the one running the Ansible playbook using namespaces? I am writing an Ansible playbook for my virtual private server. The ...
mcy's user avatar
  • 111
1 vote
1 answer
124 views

Ansible / YML code needed to Reset / Power Cycle a VMware VM

I have a file called "vcenter.yml" in my hosts folder which is used to authenticate to my vcenter and perform a dynamic inventory of this vcenter. I use this file to gather VM info and also ...
pmazzola's user avatar
1 vote
1 answer
145 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
1 vote
0 answers
169 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
2k views

Add new disk to LVM group using ansible module

Team, there are lvol module but I am having hard time find way to add new device to existing VG group. so I took alternate route to use shell module and running RAW commands. but is there a way I can ...
AhmFM's user avatar
  • 119
1 vote
1 answer
1k views

run a task using playbook on successful output of before task in windows

I'm executing the below YAML(ansible) file using Jenkins. I want to execute task3 only after the successful execution/output of task2 and task2 only after task1 , My YAML file is as below. How do I ...
vodevops's user avatar
1 vote
1 answer
4k views

How can I use ansible to synchronize directories between groups of servers?

I am currently migrating some data between servers and need to make sure I'm copying some data directories while still preserving mappings between old hosts and new hosts. I'm looking at using ansible ...
reedog117's user avatar
  • 183
1 vote
1 answer
751 views

Ansible is unable to connect to a MySLQ database from last week

I have a docker container with jenkins, that uses ansible for some automated commands. One specific commands connects to a database on a different docker container and perform some checks (as cleaning ...
King Midas's user avatar
1 vote
1 answer
995 views

On a RHEL workin as ansible controller getting error running playbook

I have a playbook that runs with no errors in my local tests VM (CentOS7) but when I run this same playbook on the prod servers (RHEL7). I run below command sudo ansible-playbook passwords.yml -e ...
brunofl's user avatar
  • 11
1 vote
1 answer
275 views

Restarting winbind service on rhel6, service restarts but ansible fails the run

Seeing this consistently with the playbook below. - hosts: all gather_facts: no become: yes tasks: - name: restart winbind service: name: winbind state: restarted - name: ...
cubezombie's user avatar
1 vote
4 answers
22k views

Ansible - x.x.x.x | UNREACHABLE! => { “changed”: false, “msg”: "Failed to connect to the host via ssh … }

I created a cluster and i try to reach the master node from an another Ansible server. I copied the ssh key to the master server. and i can reach it via below command, from ansible server ssh -i ~/....
user615216's user avatar
1 vote
0 answers
497 views

Multiple ansible-playbook Execution with Error status

I am trying to execute multiple playbooks with master.yml file. For each playbook PASS/FAIL summary I need to publish. Each playbook executes on multiple hosts, so can't use it in tasks. Any idea how ...
amit bikram's user avatar
1 vote
0 answers
1k views

User is not allowed to execute command as another user

--- - hosts: all become: true become_user: root become_method: sudo gather_facts: False tasks: - name: Root user check shell : export PATH=$HOME/python/Python-2.7.12:$...
Thamkinath Kounain's user avatar
1 vote
1 answer
950 views

Deploy .exe with .ini file using ansible

I have installer.exe with setup.ini file. It installs perfectly. As long as I open installer with double click or cli. When I'm trying to run it remotly installer just ignores .ini file. It doesn't ...
nowakasd's user avatar
1 vote
1 answer
10k views

Ansible stdout from item collected with loop

Im trying to print stdout of registred items according to documentation documentation. Here is my yaml file: - name: network-check tags: stats shell: "tail -n 3 {{ ansible_facts['nodename'] }}_{{ ...
user3069488's user avatar
1 vote
0 answers
114 views

Ansible Digital Ocean APIv2 too fast?

I'm getting mixed results here provisioning new droplets with some new code. It seems like maybe Ansible is not waiting properly for the server to get an IP address. I have made several attempts to ...
Atomiklan's user avatar
  • 559
1 vote
1 answer
7k views

Avoiding jinja templating delimiter in when statements

I'm currently porting my Ansible playbooks from version 2.1 to 2.7. Ansible now prints a warning if I use jinja templating delmiters such as {{ .. }} in a when clause. [WARNING]: when statements ...
Francis's user avatar
  • 481
1 vote
1 answer
2k views

Ansible: Calling tags from role but they are not getting executed

I have some tasks as shown below - name: Add the server's domain to the hosts file lineinfile: dest: /etc/hosts #regexp='.*{{ item }}$' line: "{{ hostvars[item].ansible_default_ipv4....
Quintin Par's user avatar
  • 4,443
1 vote
1 answer
604 views

Restart MariaDB cluster with Ansible

I would like to restart my MariaDB cluster with Ansible. I applied serial option to run script on servers one by one, but at the end of the script (= after build cluster), I would like to run command ...
dannyx's user avatar
  • 31
1 vote
0 answers
48 views

change a group_var on every 20 executions

I have an Ansible project with more or less 100 hosts (much more in a near future), this project does several calls to an API that as a limit rate of 1000 calls per token. In my project I define the ...
João Pereira's user avatar
1 vote
1 answer
11k views

Ansible: access variables and dump to CSV file

vars: servers: - name: centos port: 22 tasks: - name: Check if remote port wait_for: host={{ item.name }} port={{ item.port }} timeout=1 ignore_errors: True register: out with_items: "...
Ricky V.'s user avatar
1 vote
1 answer
2k views

ansible git autodeploy by webhooks

How to automate deployment from git repository hosted on github / bitbucket to ubuntu server using ansible? In github repostory settings->webhooks i can add webhook for pull to master, that will ...
Евгений Новиков's user avatar
1 vote
1 answer
1k views

Ansible: list all variables required for a playbook

Given a playbook --- - hosts: some_host_group roles: - foo - bar I'd like to get the list of all variables that the playbook needs to be defined. Something like: # playbook-requires ...
badbishop's user avatar
  • 928
1 vote
1 answer
396 views

Can I get dependent roles installed as part of running the playbook?

Using Vagrant's ansible_local provisioner, how can I ensure the roles used in my playbook are installed before Ansible tries to execute them? I tried to install the role with shell: ansible-galaxy .....
Davor Cubranic's user avatar
0 votes
0 answers
27 views

Ansible playbook to create a new storage

I'm trying to create a new storage in my proxmox node with an Ansible playbook, but this ends up having no free space, all the space is used. I want to do this from the playbook and not from the ...
Ionut's user avatar
  • 101
0 votes
1 answer
111 views

Ansible stuck with local_action or delegate_to

I'm running playbooks for years but now i'm facing a new issue without any clue, when I launch playbook against remote machine : it's ok for gathering facts and tasks. But then when I try a ...
Bertrand Cebador's user avatar
0 votes
1 answer
409 views

Playbook not use sudo command - Ansible Semaphore in Docker Container

So I'm learning DevOps tools. I installed Ansible Semaphore in a Docker container on my home server and created playbooks. I created a sudo user on a remote server and added an SSH key. However, my ...
Talhak's user avatar
  • 11
0 votes
0 answers
45 views

Getting TSIG update error (PeerBadKey) when running Bind9 role

I am getting this kind of error fatal: [bobul-2]: FAILED! => {"changed": false, "msg": "TSIG update error (PeerBadKey): The peer didn't know the key we used"} when I ...
valga's user avatar
  • 1
0 votes
1 answer
634 views

How to install postgres and create new user and db using ansible playbook?

I tried using below playbook to install postgres 12 on my ubuntu machine on both 22 and 23 versions of ubuntu. For installating postgres and set a default password to postgres user and create a new ...
user2331760's user avatar
0 votes
0 answers
40 views

Need help on how to Reset the powerstate of multiple VM's similar to obtaining multiple VM's powerstate using a VMware Dynamic Inventory File

I am trying to create and use a playbook that will reset the power of ONE, TWO or ALL VM's similiar to the playbook I use to obtain the powerstate of ONE, TWO or ALL VM's. Here is my current setup and ...
pmazzola's user avatar
0 votes
0 answers
115 views

Need advice on ansible-pull and vault

Hope you're doing well. I have this design headache My very basic interrogation here is: how can i implement ansible-pull a "secure" way with kiss principle ? For example i use ansible-pull ...
infoman33's user avatar
0 votes
0 answers
73 views

Pods stuck in Init:CrashLoopBackOff state after upgrading the crunchydata PGO from 5.1.2 to 5.3.1 using helm

When running the cmd: kubectl get pods -n pgo, it returns. root@XXXXXXXXXXXX:/opt/pgo# kubectl get pods -n pgo. NAME READY STATUS ...
tarakeswari_yerra's user avatar
0 votes
0 answers
71 views

not able to access apache 2 server running in vagrant from the host

I'm running apache2 inside the vagrant guest machine . Below is my vagrant file- # -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure("2") do |config| config.vm.box = "ubuntu/...
Rajkumar Natarajan's user avatar
0 votes
1 answer
2k views

Ansible: [WARNING]: The input password appears not to have been hashed

I'm facing an issue while using Ansible 2.9.27 on RHEL 7 to automate my infrastructure, specifically when working with encrypted passwords in my tasks. When utilizing the password option of the ...
sebelk's user avatar
  • 702
0 votes
0 answers
42 views

How to import all projects defined in a metadata.yml file?

This is my first foray into anything AWX/Ansible, so please be gentle :) I've set up a new AWX instance in Kubernetes (using the AWX Operator), and am trying to import our existing job-templates from ...
Sagar's user avatar
  • 534
0 votes
1 answer
253 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
0 votes
0 answers
66 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
1k 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
  • 56
0 votes
0 answers
91 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
0 votes
0 answers
342 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
  • 111
0 votes
0 answers
393 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
0 votes
2 answers
1k 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
1 answer
825 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
0 votes
1 answer
271 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
0 votes
1 answer
314 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
  • 23
0 votes
2 answers
5k views

ansible find: get path of a directory from register

Thanks in advance for any assistance. I can't seem to figure out what I am doing wrong hence why I am seeking some help. I wish to search for a folder using ansible, locate the folder and copy its ...
nickyung's user avatar