Questions tagged [ansible]

Ansible is an open-source software platform for configuring and managing computers. It combines multi-node software deployment, ad-hoc task execution, and configuration management.

Filter by
Sorted by
Tagged with
0
votes
1answer
29 views

How fix attack different ports in Ansible configuration?

I have had a small problem that I did not find in the Ansible documentation, I would like to be able to attack several ssh ports with my playbooks, is there a way to tell Ansible that, apart from port ...
1
vote
1answer
31 views

ansible: why I cannot use {{ ansible_facts['ansible_distribution_release'] }} in playbook

I have ansible task run on localhost like this - name: add docker repository apt_repository: repo: "deb [arch=amd64] https://download.docker.com/linux/debian {{ ansible_facts['...
1
vote
1answer
33 views

When using an Ansible playbook, how do you store and use a password containing quotes or other metacharacters without them being interpereted?

My company uses Ansible (which I am a novice at) and we have a playbook and a related role for joining new Linux machines to AD. Our admin accounts have their passwords rolled three times a day, and ...
0
votes
1answer
21 views

Ansible error with auto provision Mikrotik router

I have a problem that I cannot understand how to solve ... From my ansible central machine I have written a routine for Mikrotik, to execute a series of configuration commands and thus auto provision ...
1
vote
1answer
52 views

Ansible Join two variables

I have two variable definition files as follows vars.yml aws_common_tags: Project: "{{ project_name }}" Application: "{{ application_name }}" Region: "{{ aws_region }}" Ansible: "Yes"...
0
votes
0answers
16 views

Ansible playbook “path specified in src not found”

I am runnning into this message when I do this : ansible-playbook -i inventory junos_config_new.yml --check -vvv ansible-playbook 2.9.9 config file = /etc/ansible/ansible.cfg configured module ...
0
votes
0answers
26 views

Ansible SSH connection closed

I have a little problem with ansible. I'm running it in a container: ansible 2.7.7 config file = /etc/ansible/ansible.cfg configured module search path = ['/root/.ansible/plugins/modules', '/usr/...
0
votes
1answer
21 views

How to separate variables using awk and append it to Text file using ansible

What I got as extra variable to ansible playbook is "CHOW_app/timmy_app1/johnn_app3/harper_app4/mona_app5". This is passed as single variable to the playbook. I have to separate it and save it in a ...
0
votes
1answer
86 views

How to stop the playbook if the service is already installed using win_service module?

How to stop the playbook if the service is already installed? I am trying: - hosts: windows tasks: - name: check services win_service: name: serviceName register: ...
0
votes
2answers
64 views

ansible/jinja2 reject all items from list of dicts with specific attribute

I have a list of dicts like this: list_of_dicts: - name: Item1 - name: Item2 type: special - name: Item3 - name: Item4 type: small As you can see, not all items have a type attribute....
-1
votes
1answer
22 views

Ansible install packages on target without network con

Is there any way to use ( for egg. when installing a yum package ) the ansible-controller network connection to the internet?
0
votes
1answer
85 views

What is the prefered method to install Python with Ansible on CentOS 8

CentOS 8 does not always come with Python pre-installed, and so Ansible will fail running on the remote machine until it's been installed. However in a classic Chicken/Egg, you can't use the Ansible ...
0
votes
1answer
66 views

Building List of JSON Objects in Ansible

I'm trying to build an array/list of JSON objects in Ansible. My playbook is called by specifying --extra-vars "userids=123456,654321". I then try to build the list with the following. "TBD" is ...
0
votes
1answer
9 views

Ansible: Index value in template file per instance

I am trying to deploy multiple instances of a service on a single host. The service has a config file, and in this config file, I'd like to include the index of the instance that it belongs to. For ...
0
votes
1answer
43 views

Linux/Ubuntu - Use AD groups in Ansible before the computer is on the domain

TL;DR How do I reference an AD group for folder permissions before my computer has joined the domain? I'm setting up an Ubuntu system to interface with the orgs Active Directory. I've read that ...
0
votes
0answers
20 views

Detecting changes for 'docker-compose build' in ansible

Let's say an ansible task performs docker-compose pull, and reports the result like this: changed_when: "'... pull complete' in result.stderr |default('')" That works because stdout shows "... pull ...
0
votes
1answer
21 views

Ansible: how to get output of shell script command on stdout?

I create this simple script which adjust timezone on all machines, called date.sh #!/bin/sh # Exit at first error set -e # Set the localtime timedatectl set-timezone Europe/Zurich # Check date ...
0
votes
2answers
15 views

How do I create enhanced sub-lists from existing lists and another variable with Ansible?

I needed to take a simple list, take the first N elements from it where N comes from user input, and make a new list of dictionaries where each item contains an additional value stored in another ...
0
votes
1answer
52 views

How to use scp command with raw module of Ansible to transfer file to remote hosts

How to use scp command with raw module of Ansible to transfer file to remote hosts I am a beginner to ansible. I am trying to copy a file from ansible-master to ansible managed nodes using raw ...
0
votes
0answers
43 views

Adding SSH keys to local machine's SSH agent using Ansible

I'm trying to automate some of my personal server setup using Ansible, in order to wipe my disk clean and migrate to Ubuntu 20.04. Part of this process is installing the SSH keys I use for Github ...
1
vote
1answer
45 views

AWS VPC Subnet InvalidSubnet.Range only when using Ansible

I have an AWS VPC with a v4 CIDR of 10.0.0.0/16 (I double-checked that CIDR). When I try to create a subnet on AWS using the following ansible task ec2_vpc_subnet: vpc_id: "vpc-<the-non-...
0
votes
0answers
13 views

openstack static floating address with ansible

I am trying to assign a static floating IP address to my servers using ansible module os_floating_ip. my playbook code below: - name: Assign floating IP os_floating_ip: state: present cloud:...
0
votes
0answers
21 views

How to make python run from terminal environment

I tried to run Ansible playbook with python through bash script, but I came across the bug described here https://github.com/ansible/ansible/issues/32142 (TL;DR When I run playbook with pause module ...
1
vote
1answer
140 views

Get full list of Route53 zones with Ansible

The route53_info module provides a facility for getting a list of Route 53 hosted zones. However, it will only get 100 at a time. (Setting max_items to anything greater than 100 still only provides ...
-1
votes
1answer
48 views

List tags that exists in a playbook

I have a play that runs one or more roles. I would like to list available tags without parsing all the code. I am indeed experimenting some difficulties in remembering all the tags I put during ...
0
votes
1answer
19 views

Value deep in dicts

Is there an easy way get access a value inside of nested dicts that doesn't error if one of the dicts exists. Not sure what to call it, but it is proposed as optional chaining for ECMAScript. I the ...
0
votes
0answers
12 views

ERROR: vars is not a legal parameter in an Ansible task or handler

I am getting this error while executing my playbook. My main.yml - - name: Main Playbook Started hosts: remotehost connection: local roles: - role: tomcat tags: - tomcat /...
1
vote
0answers
56 views

Ansible conditional command not working on AWS server that runs ubuntu 20.04

I have a number of ansible scripts that execute commands on ubuntu servers on AWS. One particular script needs to run both on ubuntu and on Amazon Linux instances. I have a conditional command to ...
0
votes
2answers
47 views

Ansible “Yes” and “No” possibilites for installation

is possible to prompt user with "Yes" and "No" question? I am sure there it is, but I need it to install package on "yes" answer and with "no" just skip package. How to effectively do it? Thanks.
0
votes
1answer
31 views

ansible's `unarchive` removing files not in the destination directory

Ansible (v2.9.6) has an unarchive task which can unzip a tar (etc) on a server to a destination directory. Is it possible to tell it to remove any file in the destination directory which is not in the ...
0
votes
1answer
82 views

Reading a particular key value from ansible facts

I was tying to pull out below variable value from ansible fact (ansible_mount) as show below. I have lot of mounts in the target machine. What i want is to retrieve only device key value where mount ...
0
votes
1answer
70 views

How to send password with special characters from ansible to Python script?

I am invoking a python script from ansible playbook. While invoking I am passing the credentials to the python script as arguments. The password has some special characters. But in Python script, I ...
0
votes
1answer
35 views

Proxmox VM provisioning with ansible - how to run task on created vm?

I've got 3 tasks in my playbook that operate on hypervisor supplied in hosts file - create vm from template with preconfigured network settings, customise its parameters, power on and from that point ...
0
votes
1answer
47 views

Beginner: Ansible The offending line appears to be

I'm learning how to use ansible and am writing a playbook for my local desktop. I'm using the atom editor and have linter installed. I'm not getting any error whilst writing, but then when I execute ...
0
votes
1answer
65 views

Ansible Unable Non Root User Unable to Install using APT

I create a new user using ansible called nginx, nginx is part of the sudo group a, but when I try to do an apt install with this user I get the below error : FAILED! => {"changed": false, "msg": "...
0
votes
2answers
78 views

Ansible - what is the purpose of the key “run_once” in a task file.yml?

In a task file whose role is to install php on a remote server(s) someone uses this module (after the one dedicated to the installation) to update the fresh install : command: php update.php --...
0
votes
2answers
56 views

ansible win_command fails but works when command run manually

I'm trying to run New-WdsClient PowerShell cmdlet or wdsutil /add-device, I don't really care which one gets used in the end, so long as it works. When I run 'wdsutil.exe /add-device /device:...
0
votes
2answers
130 views

Invoking Python Script through Ansible Playbook and running it in background- Through Ansible Tower

Here I am trying to invoke a python script through ansible playbook. When I run the playbook containing below mentioned code, it is successfully invoking the script. But ansible script continues to ...
0
votes
2answers
29 views

Ansible `where` clause for “Is those host in that group?”

I'm writing an ansible (v2.9.6) task which should only be run for hosts in a specific group. How do I write a where clause to match that? when: "'my_group_name' in {{ group_names }}" gives me the ...
0
votes
0answers
45 views

Ansible: vmware_guest: VM Deployment

I'm currently trying to figure out how best to approach a situation where a vCenter has one or more Datacenters with the same name but in different Folder Locations. Because of this I'm unable to ...
0
votes
2answers
102 views

Unable to connect to Ansible via SSH

I create a host file with the below content [web] 167.172.xxx.xxx I have a user root and dojo360 on the web server and the public key has also been added to authorized_keys file. When I run the ...
0
votes
0answers
45 views

ansible Dynamic inventory Hosts value does not accept list of hosts

I am trying to create dynamic inventory for my setup. everywhere i see examples of IPs and hostname as list. but when i provide hosts value as list it error's out and says it has to be dict. Below ...
0
votes
1answer
62 views

How to format ansible logs in a human readable way

I need ansible logs per host (server) so I am using logs_play module in ansible.cfg. callback_whitelist = log_plays But the output is not human friendly. See an example log below: Apr 10 2020 12:23:...
1
vote
0answers
25 views

Create a tree-like structure with ansible

I have to create an LDAP structure with users and groups. The groups are a bit complex with a lot of nested groups etc. I need to create a tree like structure in my inventory, like the following: ---...
1
vote
2answers
61 views

ansible constructing variable name from another variable

I have a ansible variable definition, and was wondering if i can get the variables value based on the variable defined during runtime vars: test: user: "" dirs: base: "" logs: ""...
0
votes
1answer
26 views

How is Ansible procedural and Terraform not?

I am trying to understand how Ansible is procedural and Terraform is not. All blogs seem to suggest an example - if you create 2 EC2 instances in Ansible and change the count to 4, you will have 4 ...
0
votes
2answers
115 views

Ansible: How to Remove /etc/hosts entries on the remote server using Ansible playbook. I need only the default entries to be present

How to Remove /etc/hosts entries on the remote server using Ansible playbook. I need only the default entries to be present. I need only below entries to be present: 127.0.0.1 localhost localhost....
0
votes
1answer
54 views

Bootstrapping a Kubernetes cluster using Kubeadm on RHEL 7 - Issues with firewall

I'm trying to bootstrap a Kubernetes cluster on RHEL 7.8 but I'm having some issues with my firewall. nftables is not supported in Kubernetes and iptables-legacy must be installed instead. While the ...
0
votes
0answers
8 views

Use variable instead of plaintext password in Groovy-Ansible

My main.groovy contains ansiblePlaybook( installation: 'ansible27', colorized: true, inventory: "inventories/${...
0
votes
0answers
20 views

How Connect Webform To Ansible Or BASH/Python, To Start a Server Service

I'm a newbie with servers. My webmin service often stops after I'm done using it, so I have to SSH in to restart it. BUT that could be a security advantage. So I'd like to use an Ansible script (or ...

1
2 3 4 5
24