Essentially, I want to be able to handle “wildcard filenames” in Linux using ansible. In essence, this means using the ls command with part of a filename followed by an “*” so that it will list ONLY certain files. However, I cannot store the output properly in a variable as there will …
Tag: ansible
ansible playbook: check linux process count
I am trying to write a playbook which shows failed when number of process running in linux host is not equal to 2. Following playbook works, but is there any better way of doing it? like is there any specific Ansible module to check process linux host? Answer What is your Ansible version? There is no Ansible …
Automation of networks using ansible on openstack
I’ve written an ansible script, to create a network based on a condition. So that, even if I run ansible script again it will not create duplicate entries in my openstack environment. task: I don’t have either of the twonetworks in my project. My intention was, both the statments display null outp…
Ansible: copying one unique file to each server in a group
I have a series of numbered files to be processed separately by each server. Each split file made using linux split and then xz compressed to save transfer time. split_001 split_002 split_003 … split_030 How can I push these files out to a group of 30 servers with ansible? It does not matter which serve…
How to run an Ansible task with become and the same $PATH?
I want to run this task but it fails since it does not find the bundle binary because the user I am running it with has a different $PATH in Ansible than when I just sudo su – deploy. If I SSH into the box as root and then run sudo su – deploy and echo ‘whoami’ $PATH I get
Ansible wait_for rebooting
I’m trying to use ansible to configure the environment I have to use. In particular, I need to write a task that reboots the servers, so I wrote this task: but the task fails reaching the time-out even though servers are correctly restarted. I was wondering if it fails because of my ssh configuration. T…
How can I add a PPA repository using Ansible?
I’m trying to add a new repository to a server so that I can install Java by Ansible. Unfortunately whenever I try to run the playbook it fails because of a GPG error. Can somebody explain what is going wrong here and what I need to do in order to fix this? I’m using Ansible 1.7.2 and currently on…
Ansible after ‘vagrant provision’ gives this error “Could not import python modules: apt, apt_pkg. Please install python-apt package.”
I have a very simple VagrantFile and Ansible Playbook. I just want to test install httpd. But every time I run vagrant provision after the VM is up I get this error: This is my VagrantFile: And this is my simple playbook.yml: And my inventory.yml: I did install the python-apt package on the virtual machine, b…