Category "ansible"

Gitlab CI with Ansible

I am creating a pipeline which is automatically triggered when I push my code on gitlab.com. The project is about the provisioning of a machine. Here my .gitla

Fixed sorting order of hosts in inventory_hostname groups

I am using AWX with the combination of CMDB inventory and many groups are defined there . i.e. from set_A to set_Z and blah blah blah I am calling many groups i

Check the defined variable is empty or not in Ansible

- hosts: localhost vars: files_list: #it may contain the file_list like #file_list: # - "file*" tasks:

Get simplified dictionary from a dict of dicts with Ansible

I have the following data structure: site_subnets: control: { network: "100.99.97.0/24", mtu: "1500", vm_start_offset: 0, dhcp_from_ip: "30", dhcp_to_ip: "5

Ansible - The PyMySQL (Python 2.7 and Python 3.X) or MySQL-python (Python 2.X) module is required

My ansible code looks like this: --- - name: Install python apt: pkg: "{{ item }}" update-cache: yes state: latest with_items: - python

How to stop Ansible task cleanly (without failing) and move on to next task?

I'm automating the process of starting eNodeB and then attaching a UE to it. Here is the connection diagram I have created a nested playbook which consists for

Add word to end of line in Ansible

I've been trying a lot of lineinfile and replace examples but i can't get it to work. I have the following lines: deb-src http://httpredir.debian.org/debian b

Ansible vault shows decrypted values if playbooks executed with debug mode

I am using ansible vault to encrypt the password, but when I am using debug mode it shows the password as plain text. Consider below code Generate ansible-vaul

Ansible not changing into directory to run command(s)

I'm using Ansible 2.8.4-1.el7 in order to automate some tasks. Since I'm starting learning the tool, I'm going through the official documentation most of the ti

Ansible: YAML inventory for staging / production hosts

I can't setup inventory which will be easy and useful in yml format for Ansible Playbook :( For example: all: children: db: children: produc

Iterating over two lists in ansible

I'm new at Ansible and YAML syntax and I'm facing a simple issue: how to iterate over two lists, with the same index? Something like that: int[] listOne; int

How to increment a value on hosts (Ansible)

I have endless kafka servers to configure, their ids must be different from each other. Configuration must be done through jinja templating. Their broker.id fi

creating dictionary with ansible

I want to create a dictionary in ansible from a list; using some variables for the value in the key-value pair of the dictionary, but it seems to be not working

How to trigger an Ansible Tower Job template from Github branch commit?

How can I trigger a job in Ansible Tower using its API on a Github branch commit? I could use a Github webhook but when triggered by a push it occurs regardle

"Undefined variable" error on Ansible when run over Windows machines

This is a very simple Ansible playbook I run from AWX to get information about hosts, and it works as intended on Linux machines: --- - name: Get some info d

How to compare more than two lists have the same values in same indexes in Ansible?

I would like to compare more than 2 lists, and see if they have the same values in same indexes. I have the previous questions regarding how I can alternate the

write tasks to install nginx and postgresql using ansible-playbook

.score.sh is given as #!/bin/bash pass=0; fail=0; if [ $? -eq 0 ];then worker=`ps -eaf|grep nginx|grep worker` master=`ps -eaf|grep nginx|grep master`

including handlers from different file

The handlers I have are not being run by the playbook or tasks I have the following directory structur: <project> - playbook.yml - <roles>

Setting relative paths in Dockerfile when building with ansible

I am trying to build some docker files using ansible, but it is not clear what is used as the build directory. directory structure . ├── build

How to get hostname with largest number in the inventory

How to extract a hostname with the largest number and use that hostname in the mount command as shown below? Basically, I have only one volume that needs to be