Questions tagged [ansible]

Use this tag for questions about Ansible, an open-source automation engine, related to using Ansible for topics such as cloud provisioning, configuration management, application deployment, etc.

Filter by
Sorted by
Tagged with
2
votes
2answers
3k views

Ansible - Copy multiple files

I am trying to copy multiple files to the target like so: tasks: - name: "Copying files" copy: src: files/{{ item }} dest: /my/folder/ with_items: - file.txt The files ...
0
votes
2answers
109 views

Cannot install Ansible

So I am creating a packer template for docker with the image php:7.0-apache. I added a shell provisioner where I try to install ansible so I can provision the image: { "type": "shell", ...
1
vote
1answer
31 views

Ansible: Backing up variable value doesn't work as expected

Attempting to save a variable's value for backup before modifying it doesn't work. I have the following inventory file (note the custom ansible_port and user): all: hosts: test: ...
2
votes
1answer
2k views

Azure Powershell DSC or Ansible

I wanted to find out what are you using for Desired State Configuration on your end. I am thinking to start introducing Azure Powershell DSC or Ansible for DSC of our on-prem environment and cloud ...
2
votes
2answers
613 views

Ansible ad-hoc command to reboot servers in serial with a pause

How do I go through all hosts in an Ansible inventory in serial with an Ansible ad-hoc and reboot servers with a specified number of seconds in between each reboot? I am looking for something similar ...
1
vote
1answer
124 views

How to filter vmware_vm_facts

I'm trying to pull out the "uuid" from facts returned by ansible's vmware_vm_facts module. There is a solution to a similar question posted on Reddit, but when I try that, it fails with 'ansible....
3
votes
1answer
223 views

I'm trying to run `vagrant provision` on PowerShell Window for Ansible playbook

Here is what it replies: Windows is not officially supported for the Ansible Control Machine. Please check https://docs.ansible.com/intro_installation.html#control-machine-requirements What should I ...
0
votes
2answers
50 views

How to run Ansible command to update imunify360 settings

How can I use Ansible to run the following CloudLinux Imunify360 commands properly on CloudLinux 7 (similar to CentOS7)? I tried different ways to "escape" the colons in the commands and it doesn't ...
4
votes
2answers
943 views

Using SSH to open interactive session in ansible

Is there a semi-easy way to use Ansible to open an interactive session? I've spent a good amount of time making use of keys and other credentials stores to make a stellar ansible inventory file. ...
2
votes
2answers
853 views

Configure VPC for ECR access

I am creating my infrastructure with Ansible. I create a VPC and an ECS cluster where I use Fargate to run my docker containers. When the tasks are started I am prompted that the task was not able to ...
2
votes
0answers
57 views

How to test production Ansible execution without having to provision target

We use ansible for our day to day operation and so far so good. We have been looking for a way to run local test etc just like chef guys and found molecule that we use with testinfra/vagrant. While I ...
3
votes
2answers
166 views

What is the most used tool for Cloud Infrastructure deployment Ansible vs Puppet vs Terraform?

I have some time for research at work right now, and I was thinking on expanding my knowledge on my favorite subject, which is DevOps (love you all). I have some advanced experience with Ansible, as ...
0
votes
1answer
107 views

Why Ansible skip items in inserafter?

I have about 10 hosts that I run a playbook for them with serial:1. in this playbook there is this code which append output of all commands in one file: - name: copy the output to a local file ...
1
vote
1answer
241 views

Why is Rails (with Nginx/Passenger via Ansible) unable to see my RAILS_MASTER_KEY environment variable?

I'm writing Ansible playbooks to provision an Ubuntu 18.04 server. I want to provision the server for a Rails application using Passenger and Nginx. I used geerlingguy.passenger from Ansible Galaxy ...
1
vote
2answers
47 views

Running Automation on Google Cloud Virtual Instances using Ansible

I'm trying to automate google cloud virtual instances remotely only using external ip addresses of virtual machines. I can ssh into the virtual machines using command line with user name ...
1
vote
1answer
534 views

ansible question to execute and display multiple commands

I have the simple ansible script below: - hosts: myhost tasks: - name: few commands command: "{{ item }}" with_items: - ls -l - df -h - cat /tmp/1 there ...
0
votes
3answers
3k views

Using `dig` Ansible module?

I am trying to look up the IPv4 address (a single one, which I will assert on!) for a given name using Ansible and use that as a fact "down the line". An MWE looks like this: --- # vim: set ...
2
votes
1answer
4k views

how to prevent Ansible from showing output on screen?

I have this in my playbook which execute a command on remote server and enters its log on local server. - name: run script shell: runuser -l testuser -c "/tmp/test.sh" register: myshell_output ...
0
votes
1answer
484 views

Ansible SSH best practices

What are the best practices to be followed wrt security when it comes to SSH authentication (password less, key based, etc.) when setting up Ansible in a new environment with 1000s of machines? Which ...
2
votes
1answer
1k views

Passing parameters from Jenkins to Ansible playbook

How can I pass parameters from Jenkins to my Ansible playbook? Eg. I want to take IP address from users and pass it to the playbook so that it will execute only on those machines.
1
vote
1answer
757 views

How to determine which packaged pip to install in order to run the Ansible pip module?

I am struggling to find a reasonable method to detect which of python-pip or python3-pip I should install depending on the contents of the ansible_python fact. This is on Debian and Ubuntu. Looking ...
0
votes
1answer
212 views

Running task or role before any playbooks

Is there a way to run a specific task or role at the very beginning of every ansible-playbook run? I'm looking for something that would go into ansible.cfg or something like that, so all playbooks ...
0
votes
1answer
585 views

Ansible can't recursively delete a directory

So, I am trying to recursively delete a directory with all files/folders inside. I tried: - name: Cleaning up file: state: absent path: /tmp/myfolder/ But the directory did not get ...
0
votes
1answer
162 views

Build Docker Images with Ansible + Vagrant

So I am working on a research project and I am trying to automatically generate specific environments on different virtualization techniques. So, first I made a Vagrantfile that pulls an Ubuntu ...
2
votes
2answers
95 views

How to use edited inventory file?

I have workflow with 2 templates. First I add new host to my hosts.ini file: - name: Add to host file blockinfile: path: /var/lib/awx/projects/_52__glusterfs/hosts.ini block: | ...
3
votes
2answers
1k views

Ansible configure and compile in directory

So I have have an Ansible Task that extracts a programs sourcecode zip into a certain directory and is then supposed to compile and install it. The extraction of the zip works fine, but then I need to ...
0
votes
1answer
257 views

How deploy public key to newly created VM on GCP?

I create VM instance using ansible module gcp_compute_instance My code: --- - name: Create jenkins node-1 hosts: localhost connection: local gather_facts: no vars: address: <my ip> ...
2
votes
1answer
58 views

How to verify hashes of Ansible Galaxy dependencies?

From a security perspective, I don't like the idea of relying only on Git tags, as they could be moved later. Unfortunately, I'm not aware of an official solution to enforce checks. This is the best ...
11
votes
1answer
6k views

Ansible: What's the difference between task, role, play and playbook?

Ansible has tasks, roles, plays and playbooks. Are those just names for different levels in a playbook organization? If not, how, exactly, do they differ from and relate to each other?
2
votes
1answer
252 views

How I can use multiple hosts in AWX playbook?

I have workflow that create 2 virtual machines on GCP. When virtual instance created I store output with external ip to variable. In next playbook i want to use all of my ip addresses in host section. ...
0
votes
1answer
74 views

Where do I use Ansible and where is Terraform used? ( Strengths & Weaknesses) [closed]

What is Ansible mainly used for? Where do I use Terraform? This question focusses on where the tools have relative strengths or weaknesses. For example: Ansible for VM build and Software ...
1
vote
2answers
136 views

Given a blank slate, tool recommendations? [closed]

so I have 8 months of DevOps experience previously working as a desktop engineer for two and a half years.Starting a new role in the education sector, recently they brought their IT department which ...
1
vote
1answer
778 views

How to make sure the specified Azure vm size available?

I am trying to create a VM with a playbook like this: tasks: ... - name: Create VM azure_rm_virtualmachine: resource_group: AnsibleResourcEGroup name: AnsibleVM vm_size: ...
2
votes
0answers
373 views

How to programmatically generate docker-compose file? [closed]

I am writing an Ansible playbook to deploy services to a clustered environment. There are 3 types of hosts (Application, Load balancer, database). Services are deployed via docker-compose on each host ...
4
votes
1answer
133 views

Why is developing Ansible Playbooks using Roles a best practice?

It's a best practice to develop Ansible Playbooks with reusable roles. From what I've seen, people end up putting all their roles into a single complex files anyways. So it doesn't really fix the ...
2
votes
1answer
165 views

Check connectivity of 5000 + servers from ansible and get list of hosts which are connectable and which are not

I need to check connectivity of hosts on port 43. I can manually login and check connectivity by: nc -v `hostname` 43 nc -v `hostname_1` 43 Is there any ansible script that goes through all the ...
3
votes
1answer
1k views

How to get the device name of a specified mount point with ansible facts?

Using Ansible facts I can get the list of "ansible_mounts": "ansible_mounts": [ { "block_available": 423698, "block_size": 4096, "...
1
vote
1answer
200 views

Create User Using Ansible with Authenticate Pem File

Community, I am creating a user on the client machine using Ansible but the issue is it creates a user and add authenticate file but getting an error while SSH to that machine using created, User. ...
1
vote
2answers
1k views

Ansible resetting swap linux

I am newbie to Ansible, i failed using ansible via command that way : ansible host -a "/sbin/swapoff -a && /sbin/swapon -a" Only this worked ansible host -a "/sbin/swapoff -a ansible host ...
0
votes
2answers
1k views

How to run Ansible file in Jenkins using Ansible plugin

Please look into this error trying to implement the deploy.yml file with ansible plugin which is installed in the jenkins. In ansible console I can implement the app successfully to the target ...
2
votes
2answers
88 views

Ansible: Test if multiple RDS instances are all stopped

With Ansible, I'm stopping several RDS (it could be EC2) instances. Then I want continue only when all of them are in the state stopped. I use the following task: - name: Wait for RDS modify to ...
1
vote
1answer
149 views

ansible-pull ignore group_vars vault

How do I ignore the group_vars vault file when running ansible-pull? My repository (among other stuff) does machine init, joining the domain and software updates. I would like the software part to be ...
0
votes
1answer
172 views

Unable to run the playbook in remote machine using Ansible job template. Connection Failed

Playbook.yml --- - name: connectionTest hosts: Windows tasks: - name: "Windows Connect" win_command: hostname register: wincmd_out Variable declared in Inventories Project/inventories/...
4
votes
1answer
69 views

How to handle availability zones and failover with ansible? Is it even within the scope of ansible?

I am only getting started with ansible. I want to set up a new development infrastructure with the infrastructure as code principle. First thing I'll have to prove is a Jenkins instance with a few ...
0
votes
1answer
55 views

How does one set up OpenStack Swift (object) storage container-specific API keys with Ansible?

I've got the following OpenStack commands for setting up Swift object storage containers: openstack container create $CONTAINER_NAME openstack container set --property Full-Key=$CONTAINER_API_KEY $...
0
votes
1answer
313 views

Loop chmod with Ansible

I'd like to remove the execute bit from some ubuntu motd (Message of the day) files with ansible to disable some ad-like Ubuntu news. The module should only act if files exist and permissions are ...
2
votes
1answer
464 views

Looping through hosts from an inventory group in a group_vars file

Is it possible to do something like this: # inventories/inventory1/group_vars/group1 filewatches: {% for host in groups['group2'] %} - type: "copy" directory_name: "{{ host }}" ...
1
vote
1answer
81 views

Is it possible to have pair of IPs in Ansible?

I have so many HA machines that one of them is primary and the other is standby. I have this playbook that copies a config file from primary and then from standby on local machine then use those ...
2
votes
1answer
374 views

Share variables across instances

I'm writing TestInfra test scripts for mongo cluster instances using Molecule Ansible. I want to share variables across all the instances. I created a python class, and initialise and update the ...
1
vote
0answers
74 views

Per machine credentials for privileges escalation using AWX [duplicate]

I have an inventory with a lot of hosts in it using the same credentials, but one host needs a different approach. For the ssh connection a different user is used, after the connection is established, ...

1 2
3
4 5
8