Questions tagged [ansible-playbook]
Ansible playbooks are how ansible code is shared and reused.
472
questions
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 ...
1
vote
1
answer
55
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 ...
1
vote
2
answers
62
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
...
7
votes
2
answers
355
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 ...
0
votes
2
answers
141
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"...
1
vote
1
answer
194
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=...
0
votes
1
answer
110
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 ...
0
votes
1
answer
401
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 ...
0
votes
1
answer
229
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 ...
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 ...
0
votes
1
answer
622
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 ...
0
votes
2
answers
482
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: ...
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 ...
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 ...
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 ...
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 ...
0
votes
1
answer
86
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 ...
1
vote
2
answers
201
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
...
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/...
0
votes
1
answer
207
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: /...
0
votes
1
answer
846
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 ...
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:
- ...
0
votes
1
answer
112
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 &...
2
votes
1
answer
686
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
...
0
votes
1
answer
4k
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! '...
1
vote
1
answer
697
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 ...
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: "
...
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 ...
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 ...
1
vote
1
answer
201
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 {{ ...
0
votes
1
answer
3k
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....
0
votes
1
answer
591
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 ...
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]]...
-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" ...
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
...
0
votes
1
answer
4k
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', '/...
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 ...
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:...
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 ...
1
vote
2
answers
3k
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:
...
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 ...
0
votes
1
answer
551
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: ...
0
votes
2
answers
447
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 ...
0
votes
2
answers
1k
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 (...
1
vote
2
answers
484
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:
####################### ...
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 ...
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 ...
3
votes
2
answers
340
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: ...
0
votes
2
answers
758
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 ...
1
vote
1
answer
10k
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" ...