Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [ansible-playbook]

Ansible playbooks are how ansible code is shared and reused.

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

How to use Ansible to add a comment line to each line of a file

I am using ansible-playbook to edit a disa stig playbook. Upon initial run, it just bricks the server (RHEL 8). I want to comment out each line of the file which is over 20K lines. Then I can ...
Jamie Claybrooke's user avatar
0 votes
1 answer
139 views

Multi master HA Kubernetes kubespray installation using kubevip fails

I'm trying to install a HA Kubernetes using Kubespray with Kube VIP. I followed the instruction of Kubespray for Kube VIP but it gets stuck on "TASK [kubernetes/control-plane : Kubeadm | Create ...
Mohammad Reza Ghahremani's user avatar
0 votes
0 answers
52 views

Ansible to change Cisco IOS enable password on multiple devices

Does anynoe know if there is a ansible module for changing the Cisco IOS enable password on devices? There appears to be a user module but that is for usernames only in IOS. Should I use the ...
Jim's user avatar
  • 1
0 votes
1 answer
205 views

Ansible "Failed to create temporary directory" (GCP)

I've encountered an issue with my Ansible playbook that provisions both a Kubernetes cluster and other servers within our cloud infrastructure. Specifically, the problem arises when I configure the &...
1wonder's user avatar
0 votes
0 answers
90 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
1 vote
1 answer
267 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
2 answers
186 views

How to fail an Ansible task if executable not exists?

Part of my Ansible playbook is K3S cluster creation. For a server node I have these tasks: <...> - name: Retrieve K3S installation status command: which k3s changed_when: false ...
Dmitry Papka's user avatar
7 votes
2 answers
510 views

Ansible performance issues on a huge group

So, I have this host group, which consist of 35k VMs. Aaaand I need to run a playbook over it. If it does matter - playbook is just a call for community role for installing node_exporter. But I'm ...
Anatolii Tk's user avatar
0 votes
2 answers
313 views

sudo: /etc/sudo.conf is owned by uid 65534, should be 0\nsudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set

I have the latest Ansible Tower configured on a RHEL 8.9 When I run specific ansible tasks, I always get this error message: { "module_stdout": "", "module_stderr"...
Budianto IP's user avatar
1 vote
1 answer
240 views

Running certain ansible tasks only on certain processor vendors

I want to configure IOMMU settings for a group of servers. Doing this requires making a change to grub configuration as such on Intel servers: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash intel_iommu=...
knpwrs's user avatar
  • 429
0 votes
1 answer
228 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
631 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
1 answer
413 views

Ansible lineinfile replace with system variable

I'm encountering an issue while using Ansible to dynamically modify a Zabbix agent configuration file. Specifically, I'm attempting to employ an ansible lineinfile module with a loop to update ...
Yousuf's user avatar
  • 35
0 votes
0 answers
55 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
1 vote
1 answer
1k 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
2 answers
827 views

ansible handler with when condition

So I have this playbook - hosts: localhost gather_facts: no vars: this_thing_is_true: true use_handler: false tasks: - debug: msg: 'Notifying handlers' changed_when: ...
EricHymowitz's user avatar
0 votes
0 answers
51 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
124 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
1 vote
1 answer
162 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
0 votes
0 answers
86 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
1 answer
107 views

Ansible Openstack get/update application credentials

I'm trying to fetch and update application credentials through Ansible openstack.cloud module, but I cannot find any information about that. Is it possible to use Ansible to list my own application ...
sctx's user avatar
  • 33
1 vote
2 answers
226 views

Ansible variable register in two tasks either one or the other

I have an Ansible role that manipulates some Zabbix components. This role has this set of tasks to check the Zabbix Agent type (1 or 2) and version. - name: Check if Zabbix Agent 2 is installed ...
markfree's user avatar
  • 123
0 votes
0 answers
85 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
233 views

Ansible playbook with 'async' outputs out of order when executing on multiple servers

I have a playbook that is suppose to run a script on 5-10 servers in parallel - name: Run script & cleanup ansible.builtin.shell: | ... bash {{ SCRIPT }} ... args: executable: /...
Subzero123's user avatar
0 votes
1 answer
1k views

script file is not getting executed on target machine using ansible script module

script file is not getting executed on target machine using ansible script module. I have written a script file on control-node wants that to copy it on target machine and then from there i wants to ...
Priyanka's user avatar
0 votes
1 answer
2k views

Ansible regular expression to match a string from a list of line

I'm trying to read a content of file from remote file. but i want the message to be displayed only matched UUID from fstab file. but when i ran below playbook it is throwing below error. playbook: - ...
Priyanka's user avatar
0 votes
1 answer
123 views

Want to Use Ansible Lineinfile Module to Insert Private IP Addresses from Hosts in the zookeeperservers Inventory Group

I need to modify a line in a configuration file with the private IP addresses of the hosts in the zookeeperservers inventory group. The config file is an .xml file. The key word in the config file is &...
David S's user avatar
2 votes
1 answer
823 views

Ansible-pull does not find vars in group_vars directory

I have an ansible structure that contains some roles. /usr/local/ansible playbooks roles role1 role2 tasks handlers ...
Ed Greenberg's user avatar
0 votes
1 answer
6k views

Ansible: ERROR! 'shell' is not a valid attribute for a Play

--- - name: Extract PS output. shell: "ps -ef | grep pmon" register: pmon - name: Display PS output. debug: msg: - "{{ pmon.stdout_lines }}" Error: ERROR! '...
Learner's user avatar
1 vote
1 answer
827 views

How to pass Variable from previous host to next target host play in ansible playbook

I want to pass variable called ssh_user from the first play on ansible playbook to next different host play. I have tried to use "set_fact" but seems like it's still can't retrieve variable ...
Mhd Ridho Swasta's user avatar
2 votes
1 answer
2k views

ERROR! unexpected parameter type in action Ansible Playbook

I have my playbook yml script below: --- - name: Download files from FTP hosts: localhost gather_facts: false vars_prompt: - name: target_host prompt: "Target Host IP: " ...
Mhd Ridho Swasta'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
53 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
1 vote
1 answer
261 views

Ansible send hostnames in a list to python script

I wanted to send the hostnames from ansible role to python script. In my host file there are 2 hosts 1ld900 and 1ld901. my role as below --- - name:execute python script: writetoexcel.py {{ ...
Prade's user avatar
  • 31
0 votes
1 answer
4k views

How to force Ansible 'shell' task to change state with 'changed_when' condition?

I am running script with Ansible task which installs some repositories and my goal is to show changed state when running change mode to notify, that script will run if check mode will not be activated....
dorinand's user avatar
  • 399
0 votes
1 answer
805 views

Ansible: escaping special characters in a regexp loop

I been having problems getting this to work, can anyone provide any insights? - name Configuring rsyslog.conf playbook hosts: "{{host}}" tasks: - name: Configuring ...
Gene's user avatar
  • 15
0 votes
1 answer
390 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
2k 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
0 votes
1 answer
1k 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
6k 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
  • 13.5k
0 votes
1 answer
2k 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
104 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
4k 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: ...
Isopote42's user avatar
  • 157
0 votes
0 answers
412 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
1 answer
649 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
0 votes
2 answers
526 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
  • 399
0 votes
2 answers
2k 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
  • 133
1 vote
2 answers
577 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 [email protected] Password: ####################### ...
Pete's user avatar
  • 133
0 votes
0 answers
429 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
167 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
2 3 4 5
10