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
1
vote
0answers
5 views

How do a flaten a list mixed with nested dict in ansible playbook?

I have a variable named packages as showed below, it is not a plain list, I have some nested dict in it like browsers. --- packages: - apt-file - axel - ibus-rime - rofi - i3 - ffmpeg -...
1
vote
0answers
22 views

straight python alternative to ansible

Can anyone recommend an alternative to Ansible that lets one write straight Python code? In my group, we're finding that expressing pretty simple logic in Ansible ends up being too time-consuming and ...
1
vote
0answers
8 views

How to sort displayed tasks in the order they were run rather than by the time it took each task to run?

I've configured ansible.cfg to display the steps it has done during a playbook run and it looks like so: =============================================================================== common : ...
1
vote
1answer
15 views

Ansible: how to display the name of the currently running included_tasks playbook file?

I wrote an Ansible role which does lots of things, it's called "common" and all Ansible hosts are using it. The directory structure is as follows: ./common │   ├── ./common/README.md │   ├── ./...
1
vote
2answers
31 views

Run integration test with ansible playbook using terraform provisioning

Ok so I am totally new to devops! I am an experienced developer, but at my new job I have been tasked to automate CI/CD. Non-existing so far. Only CI with Travis. So the ideal workflow is: Push to CI ...
5
votes
1answer
23 views

Ansible: Use inventory_hostname variable in lineinfile module

I'm using Ansible 2.7.9 and I'm having trouble with the regex definition in the lineinfile module. My file has the following line: host.example.com = /path/to/a/directory I want to remove that line. ...
1
vote
2answers
76 views

How do we move to a modern CICD approach

This may also be a general pulse; but here lies the issue We use EKS, we have Jenkins, we have Ansible, we have Terraform, we have BitBucket; but none of these really form a pipeline and I'm stuck ...
2
votes
1answer
35 views

Doing map and filter of a list of dictionaries in ansible

Given a list of users: # Python Syntax users = [{'name': 'alice', 'sudo': True}, {'name': 'bob'}, {'name': 'charlie'}] # YAML Syntax users: - name: alice sudo: yes - name: bob - name: ...
0
votes
0answers
9 views

How can I use kubespray from a windows host in order to spin a local dev env?

Is there a way to spin up a local test cluster when my host is Windows and what needs to be changed form the startup guide?
1
vote
1answer
30 views

Ansible event driven capacity

I've been using SaltStack a lot in my previous job, and loved its event driven model. Now, in my new job, we are using Ansible, and definitely not in an event driven model. I was wondering if there ...
2
votes
2answers
15 views

Install apache on awa ec2 from locally installed ansible server on my laptop

I would like to install apache2 remotely on aws ec2 instance from my locally installed ansible server on my laptop. I have also the. pem key of the instance. Now what Ip need to put in /etc/ansible/...
2
votes
2answers
39 views

Combine Lists of Objects in Ansible

I'm really trying to merge lists of objects along with defaults so I can loop over them and create resources in kubernetes. I've gotten it down to a simple(ish) playbook and will post it here. - ...
1
vote
2answers
46 views

How to sync two directories on same host using Ansible?

I am using the below playbook for mounting partitions on another EBS volumes while provisioning instance on AWS --- - name: Mounting necessary partitions hosts: localhost become: ...
1
vote
1answer
28 views

Ansible seems to execute infinite loop

I wrote some roles for my home lab to setup a GlusterFS cluster. But when I run it on my 2 nodes, some tasks get executed over and over again and it seems that it never ends. Here is the log output (...
0
votes
2answers
99 views

Ansible: When 'directory/file exists' in a loop

I have written some Ansible code to put users from the users.yaml file in the variable 'nexus_local_users' to be used by a role. When doing this a random password is created and written to the '...
1
vote
1answer
37 views

Ansible warning that host key has changed, even though I've taken multiple steps to prevent this warning

I've followed the recommendations I could find to prevent this from happening. I am using Vagrant, but once the boxes are spun, I'd like to do things with the ansible command sometimes. $ grep ...
0
votes
2answers
400 views

How to run multiple commands with command module in Ansible

I want to run couple of commands in ansible playbook I am trying below: - name: Running multiple cmds command: - | cmd2 cmd2 cmd3 cmd4 But i am getting an error on ...
2
votes
1answer
22 views

Creating ec2 instances and installing mongoDB using automation

I am trying to create a 3 node MongoDB replica set using automation (ansible or terraform) in AWS. I am able to do this in the management console of AWS, but I'm not sure how to approach it. ...
2
votes
2answers
41 views

I don't fully understand how to use variables in Ansible roles

Original question: I want to roll out a partitioning layout for a home lab setup of GlusterFS and also want to do it using Ansible so I can re-use the configuration for a more stable setup later on. ...
0
votes
1answer
243 views

Creating Keycloak Realm via Ansible

Currently there is no module to create a Keycloak realm with Ansible. There is a PR but it is stucked since half a year or so. So I though, there is a Keycloak REST API (https://www.keycloak.org/docs-...
-1
votes
1answer
36 views

Can't ping client on ansible ,

$ ansible 192.168.254.150 -m ping [WARNING]: Unable to parse /etc/ansible/hosts enable callback plugins as an inventory source [WARNING]: Unable to parse /etc/ansible/they can output to stdout but ...
1
vote
2answers
251 views

Custom inventory file failing to parse properly

I've got the following production inventory file (playbooks/production.yaml) for Ansible: all: children: control: moriarty.server.com toby.server.com managed: sherlock....
1
vote
1answer
24 views

Provisioning raspbery pi sdcard

I was searching for a tool suitable for provisioning sdcard for raspberry pi. I've successfully managed to implement most of it using Ansible playbook. Need only some time for last polishing. ...
3
votes
1answer
124 views

Including vault-encrypted variables in a task

I just recently started to use Ansible, and am trying to deploy a configuration file that contains a secret key and email (for credentials to use with an API). I encrypted them with ansible-vault ...
0
votes
2answers
41 views

ansible filter debug output

I have the following output resulted from a shell command which is run on ansible on every host from my inventory: TASK [debug] ok: [10.240.22.44] => { "msg": { "changed": true, ...
1
vote
2answers
51 views

Ansible temp dir change

Ansible version 2.9.2 Is it possible to change ansible temp dir for one playbook only? I have VMs with r/o root. So, the playbook fails. Even if I run my playbook under root user on target VM it can'...
1
vote
1answer
397 views

Ansible execute task on different hosts in order

Is it possible to use ansible to manage order of programs? Im trying to find an automated solution which will do the following steps: run a program on HostA run a command on HostB which requires ...
0
votes
1answer
49 views

How to manage images versions via docker-compose with Ansible

I planned to use docker-compose and a few scripts to manage the deployment of my app on staging and production. My idea was to use one docker-compose.yml with one .env file for each environment. In ...
0
votes
0answers
19 views

Automate AWS image import?

AWS needs VM images in the AMI format to be able to start them as EC2 instance. Currently I have an .ova image on my s3 repository which I would like to start as EC2 instance. Normally, one could use ...
2
votes
2answers
598 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
46 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
24 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: ...
1
vote
1answer
157 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
79 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
43 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....
2
votes
1answer
25 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
33 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
1answer
59 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
304 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
41 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
129 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
106 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
25 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
83 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
38 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
50 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
628 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
97 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
58 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
180 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
2 3 4 5 6