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
0
votes
1answer
13 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 ...
1
vote
0answers
14 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 long time making use of keys and other credentials stores to make a stellar ansible inventory file, problem ...
2
votes
2answers
100 views
+50

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
27 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 ...
0
votes
0answers
18 views

Problem deploying Docker Container from ECR on EC2 with Ansible

So, This question is tightly related to my previous one, which turned out to be a consequence of a different issue. To ensure every confusion is cleared up, I decided it is better to make a new ...
3
votes
2answers
68 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
16 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
15 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
34 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
18 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
2answers
66 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
26 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
35 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
32 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.
0
votes
1answer
19 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
27 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
41 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 ...
1
vote
0answers
13 views

Does CDK perform orchestration ? apart from provisioning

We used CloudFormation/Terraform for provisioning resources in AWS. Provisioning is about creating a new state or transforming one state to another. We used ansible tool to orchestrate provisioning ...
1
vote
0answers
40 views

Ansible provising with packer causes problems with sudo?

So, I have a packer template that sets up a VM and then uses Ansible as provisioner. Within the playbook that's executed, there is a task that must be run as root. (sudo proftpd). - name: Starting ...
0
votes
1answer
26 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
36 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: | ...
2
votes
2answers
16 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
29 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
16 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 ...
0
votes
1answer
72 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
26 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
38 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
82 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 ...
0
votes
0answers
50 views

Ansible - remove named cron job with file specified

I'm creating and trying to remove cron jobs based on a flag like this: - name: process files cron cron: name: process_files cron_file: "process_files_{{item.name | regex_replace ('[.-]', '...
1
vote
1answer
66 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
52 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
72 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
37 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 ...
2
votes
1answer
43 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
24 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
76 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
76 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
24 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
17 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
37 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
42 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
20 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
44 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
68 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
45 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 ...
1
vote
1answer
24 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
51 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, ...
0
votes
1answer
37 views

ansible error 'first argument must be string or compiled pattern'

I have this code in my playbook: - hosts: standby remote_user: root tasks: - name: replace hostname in config replace: path: /opt/agentd.conf regexp: #\s+Hostname\= ...
1
vote
1answer
165 views

Deploy Vm Vmware with simple Ansible playbook

I try to test one simple playbook with ansible. My goal is to create a new VM with it. --- # create a new VM from a template - name: VM from template hosts: localhost gather_facts: false ...
1
vote
1answer
70 views

Error passing arguments to ansible playbook

I am trying to create a playboook that executes a python3 script with 2 parameters, name and password in localhost. However, when i try to execute the paybook with this command ansible -b --become-...