Category "ansible"

All combination of 2 lists in ansible

I have 2 variables as a list in ansible host_list: - 1.1.1.1 - 2.2.2.2 port_list: - 443 - 80 and I want to get the 3rd variable as a list of l

How to prevent Jinja2 substitution in Ansible playbook?

In my playbook, a JSON file is included using the include_vars module. The content of the JSON file is as given below: { "Component1": { "parameter1" : "

Managing "nested" group in Ansible YAML inventory files

I'm managing a number of clusters, and I wanted to consolidate multiple inventory files into a single inventory that looks effectively like this: all: childre

TypeError: 'NoneType' object is not iterable in ansible output

I have set up an ansible tower using the following docker image ybalt/ansible-tower:latest After setting up I have upgraded the applications inside the conta

Custom Ansible module throws unsupported arguments when passing list as parameter

I am writing custom module but when I put the type as list and pass the values like below, I get the error unsupported parameters For type string it is workin

how do i create an windows hardened image in EC2 image builder using ansible playbooks?

i've been trying to use ec2 image builder to harden a windows image using winrm and ansible playbooks that contain the scripts to my hardening. Since windows do

module user doesn't accept encrypt password generated by ansible-vault?

Recently I used 'user' module to create user with password provided in vars/main.yml - name: Create pamuser user: name: pamuser password: "{{ pamuser

Ansible seems to be ignoring variable in when conditional when it is overridden with "-e" from the command line

I'm working on an Ansible playbook that uses a when condition, and I was trying to test the scenario where there is a default value specified as a play variable

Ansible how to create list of dictionary keys

I am probably missing something simple. I have the dictionary in vars.yml deploy_env: dev: schemas: year1: - main - custom ye

How to execute psql command using ansible with variables

I am trying to run below task but it gives error. - name: Check if Schema exist shell: "psql -h {{ dbserver }} -U {{ dbuser } {{ dbname }} -c '\dt' | grep -

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