Category "ansible"

Ansible how to install a package only if same version not installed

I am trying to check the existing version of the package and run the install task if the same version is not been installed already. Below is the code I am tryi

Ansible, create list of dictionaries from list of dictionaries, with specific subkey containing dictionary

I'm trying to create a list of dictionaries, from a list of dictionaries which contains a key with a dictionary as a value. So, I want a list of dictionaries e

How to start a process (or Kafka to be specific) on remote host with Ansible Playbook

How to start Zookeeper and Kafka broker on remote target with Ansible Playbook. Following commands work fine locally. Start Zookeeper: cd /opt/kafka ./bin/zooke

Ansible include_tasks will not run when tags are specified

I am including some tasks like shown below in my main.yml (as one of the tasks in a list of several other tasks) - name : remove swarm include_tasks

Module failed to start Ansible

I'm new in Ansible. I'm working on an Ubunto machine. On the VM, I installed Ansible along with to apply play books to. When I run a playbook I receive the fol

Ansible Windows Kerberos Authentification Bad HTTP response returned from server Code 500

After configuring winRM on a windows server and filling all needed information to connect : --- ### winrm / win connection ### ansible_winrm_realm: *My AD Dom

FAILED! => {"changed": false, "msg": "apt cache update failed"} when trying to

I am new to Ansible and try, as an example, a task to install Vivaldi. My only task in a role Vivaldi update starts with - name: Run apt upgrade apt:

How do you list the versions of an Ansible Galaxy role using the ansible-galaxy command?

When I use "ansible-galaxy info author.role_name" I get substantial info, but not a list of previous versions. On the website, each role has a nice list of prev

Nested loop with user and folder in Ansible

I have the following task: - name: Create required folders. become: true ansible.builtin.file: owner: "{{ item.key }}" group: ftp mode: '0755'

How to pass token to requirements.yaml used by ansible galaxy for installing pre-requisites

I am trying to use an environment variable inside of requirements.yml but it's not working - src: 'http://oauth2:{{ lookup("env", "GITLAB_TOKEN") }}@gitla

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 -