Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
1answer
12 views

Are there any best practices around moving config files in Ansible?

I have a role for configuring nginx. As you'd expect, it adds files to a directory that is then included by the main config file. I've started to run into issues with the order in which these files ...
0
votes
1answer
29 views

Calling Ansible hostvars group variable at later point in play

During my playbook I create a variable for one set of machines the apps. Namely a password for a user db_password. It is within the group apps only at this point. I am trying to recall that variable ...
0
votes
1answer
41 views

Ansible - SSH Error: data could not be sent to remote host

I am trying to use Ansible 2.7.7 to manage Ubuntu 16.04 cloud image but when I try to make connection I get error: SSH Error: data could not be sent to remote host "192.168.111.11". Make sure this ...
0
votes
1answer
24 views

Ansible module - mount nfs share

I am looking for to make a "mount" on nfs share with ansible. All I found is the "mount:" module that edits the fstab file. I want to mount without rebooting. Tx.
0
votes
0answers
15 views

Installing a package with Ansible and not starting the service [duplicate]

I have the following play snippet: 27 - name: ensure necessary packages are installed 28 apt: 29 state: present 30 name: 31 - apache2 32 - libapache2-mod-rpaf ...
1
vote
1answer
31 views

Accessing Ansible Dictionary

Apologies if the question is really simple, still learning and was not able to locate the exact answer of what I was after for. I have the following Dictionary: guests: small: name: small-{{ ...
1
vote
1answer
24 views

Ansible module_stdout: command not found when using sudo on Centos 7

I am connecting to centos 7 virtual and physical machines using ansible with a user called ansible that has passwordless sudo permissions on all the boxes. On most machines it works, but on one box I ...
0
votes
2answers
77 views

Unable to ping the remote user via ansible

I'm trying to connect my host machine which is of Ubuntu (ctrlnode is user) to remote machine which is of RHEL (rhelnode1 is user) on AWS and when I try to connect my a user (rhelnode1) on remote ...
-2
votes
0answers
21 views

Ansible: Replace in N files (via globbing)

I need to do a replacement in a file which exact file name I don't know. The file can have several locations: /etc/ImageMagick/policy.xml /etc/ImageMagick-6/policy.xml /etc/ImageMagick-6_Q16-1/...
0
votes
0answers
32 views

Packer Works Locallly but fails in Gitlab CI/CD w/ executable file not found in $PATH

Here is a snippet of my JSON file for packer. Pretty much running packer build example.json via adhoc - it works smoothly and builds the AMI out in AWS. When i execute this in my GitLabCI Pipeline, it ...
0
votes
1answer
26 views

Ansible: Debug and iteration over dicts fails in ansible playbook

Ansible version: ansible 2.6.2 python version 2.7.5 I have a debug output from an ansible playbook which gives this: "msg": { "changed": false, "failed": false, "guest_disk_facts": { ...
1
vote
2answers
60 views

How to read a line from a file into an ansible variable

I'm trying to read the database password on a remote host from the file /etc/mysql/debian.cnf. Format of the file is below. Is there a way to parse out the password field so I can drop a mysql user ...
0
votes
1answer
35 views

Ansible multiline results and loop

Im registering with Ansible output from network checking in such way: - name: Test kube networking shell: kubectl exec -n iperf -it {{ item }} /test.sh loop: "{{ pods.stdout_lines }}" register:...
1
vote
1answer
34 views

Keep BIG folder sincronized on network

I have N Windows 2016 servers with a folder which needs to have binaries up-to-date. This folder (actually) haves ~200GB, but it may grow, twice its size or even more. My idea was to keep those ...
0
votes
0answers
19 views

Ansible connectivity from Control Host to Remote Host : Alternate to Passwordless SSH

We are in the midway of implementing Ansible CI for app deployment. For connecting the Remote host from Control Host , we used passwordless SSH authentication (by adding SSH key to authorized_keys). ...
1
vote
1answer
20 views

AWX docker-compose stop not working

I'm pretty new to docker-compose and I can't seem to make this work. I have been following this guide for installing AWX and has been successful so far. But when trying to stop everything using ...
0
votes
0answers
33 views

How to configure a centos-7 network interface with static settings via ansible, without network manager?

How to configure a centos-7 network interface with static settings via ansible, without network manager? I knows how to fill ifcfg* manually, but i want to fill it via ansible. I found https://docs....
0
votes
1answer
22 views

Ansible 2.7 - mysql_db : ngzip: stdout: Broken pipe\

Using the following instructions, fails the restoration of the database. As i read, archived not supports gz files, should i use a bash script? - name: Restore database mysql_db: ...
1
vote
1answer
17 views

Adding firewalld to existing infrastructure with minimal downtime

I have a mixed Ubuntu 16.04/Ubuntu 18.04 based infrastructure and would like to set up and configure firewalld on hosts. I am going to use an Ansible role for that (I have a Vagrant-based setup to ...
0
votes
0answers
11 views

UnicodeDecodeError during installation of OpenShift Container Plattform via Ansible Playbook

I'm trying to setup an openshift cluster using ansible on RHEL7. I configured everything in /etc/ansible/hosts according to the official setup instructions. However, while running the installation ...
0
votes
1answer
41 views

Ansible stdout from item collected with loop

Im trying to print stdout of registred items according to documentation documentation. Here is my yaml file: - name: network-check tags: stats shell: "tail -n 3 {{ ansible_facts['nodename'] }}_{{ ...
1
vote
1answer
34 views

Ansible - delete all partitions on a given list of disks

I'm having serious trouble to do something that seems very trivial, I guess I'm probably going on the wrong way. The scenario is quite simple, I have a host_group in which I have a list of disks like:...
1
vote
1answer
67 views

Ansible: How to get a subelement of a nested list of dictionaries

I'd like to build our DNS zones via Ansible. The user should just maintain one variable for the forward-lookup zones (e.g. foo.bar). Reverse-lookup zones (0.0.10.in-appr.arpa) should be auto-generated ...
0
votes
1answer
23 views

Docker compose doesn't reuse the intended anonymous host volumes on container recreation

I have an Ansible container and when I have developed a docker-compose file create the container. version: '2' services: ansible_tower: image: ybalt/ansible-tower:latest ports: - "333:...
0
votes
1answer
20 views

How can I check numeric string

I am using the assert module to verify my variables defined through the command line. I need to check if my variable contains only numbers(GID). How can I do that? I have tried the following options, ...
0
votes
0answers
16 views

Ansible to loop over grouped items

I got a small task I'd like to implement in ansible: There is a list of websites that are on the webserver, each associated with docroot, like this: site1.com => docroot: /var/www/site1/ site2.com =>...
0
votes
1answer
46 views

Restrict user providing asterisk * on the prompt ansible awx

I am trying to create a self service job template for our users through Ansible AWX , and want to restrict the users to mention the exact host detail where they want to run the job. During testing I ...
1
vote
2answers
37 views

Ansible: Raise Error if replace did not find anything to replace

How do you solve this in Ansible? I have a file /etc/foo/foo.config. I want to replace the string "DisallowBar" to "AlllowBarUntilMidnight" in this file. Ansible should act in these cases like this: ...
2
votes
1answer
30 views

Ansible error handling

Guys need one help with error, need to run one remote script on servers, but i get the below error. my playbook - hosts: broken strategy: debug become: yes remote_user: snehal gather_facts:...
1
vote
0answers
23 views

Ansible Digital Ocean APIv2 too fast?

I'm getting mixed results here provisioning new droplets with some new code. It seems like maybe Ansible is not waiting properly for the server to get an IP address. I have made several attempts to ...
2
votes
1answer
27 views

ProxyCommand ansible option throwing ssh: illegal option error

Context ansible 2.7.6 OpenSSH_7.4 Issue I have a machine A that i can access only by a gateway that we call the machine G through ssh. The external ip adress of the machine G is 10.X.X.X. The ...
1
vote
0answers
87 views

ansible empty dictionary conditional

I had an error when I run this code: - set_fact: my_var: "{{ my_var|default({}) | combine( {item.key: item.value} ) | default({}) }}" with_dict: "{{ my_dict }}" when: my_id in authorised[...
1
vote
1answer
37 views

How to assign inventory group alias to a variable?

I have this Ansible inventory file: [fileservers] fs01.example.com ansible_ssh_host=192.168.1.1 ip_addr=192.168.1.1 [dbservers] db01.example.com ansible_ssh_host=192.168.1.2 ip_addr=192....
0
votes
1answer
72 views

How to prevent empty subelement list error in Ansible loop?

When I try to loop (with Ansible 2.6 loop) with subelements through all public keys of a list of users and encounter a user which has no public keys defined: - authorized_key: user: "{{ item.0....
0
votes
0answers
58 views

Error with Ansible 2.7.5 IOError: [Errno 13] Permission denied: '/usr/lib/python2.7/site-packages/idna-2.8.dist-info/METADATA'

RHEL 7.5 kernel: 3.10.0-862.14.4.el7.x86_64 ansible-2.7.5-1.el7.noarch python-2.7.5-69.el7_5.x86_64 I'm getting the below error when I run ansible-playbook commands: ansible-playbook -i serverlist ...
0
votes
1answer
32 views

Ansible Digital Ocean APIv2 multidroplet deployment conceptual misunderstanding

I am having some conceptual trouble getting Ansible to work with the Digital Ocean APIv2 to deploy multiple droplets. Normally I would define a list of hosts in the Ansible hosts file and that's how ...
0
votes
0answers
21 views

How do I make ansible fall back to a lower precidence variable

I have ansible detecting the ansible_user variable based on the local $USER environment variable for team members running on their local machine. This happens via a filter in the group vars. However, ...
0
votes
1answer
114 views

Print Ansible facts from a loop

Hoping someone can save my sanity as I've been Googling the snot out of this with no luck. Seems like it should be pretty simple. I'm trying to gather the duplex of all interfaces on a list of hosts ...
1
vote
1answer
34 views

Ansible adduser issue

Having some trouble with the user module in Ansible. Everything is technically working, just not as I expected. It seems Ansible uses "useradd" versus the newer "adduser" in Ubuntu and I think its ...
0
votes
2answers
36 views

How to change disk setting 'thick lazy zeroed' to 'eager zeroed thick' by command line (Linux) or API (pyvmomi) from outside of an ESX?

I use Ansible 2.6 and pyvmomi 6.7.0 to create some vm via vSphere 6.0.0. When I resize disk, I loose 'eager zeroed thick' disk setting. What is the simplest way to get back to this setting remotly (...
0
votes
2answers
51 views

Ansible: how to manage hosts if they are not always online?

My apologies if this question has been asked before, but I may not be using the correct terminology in my searches... In my spare time I'm managing a limited amount of hosts (desktops and laptops ...
0
votes
1answer
344 views

How to install mysql server using ansible playbook?

I am trying to install mysql server on centos using ansible playbook. My yml file looks like above. --- - name: Install MySQL database server hosts: test become: yes become_method: sudo ...
0
votes
1answer
44 views

How to configure nginx, access from web browser using ansible playbook?

I have an ansible playbook to install nginx. But when I type ip address I cannot access the server. Service is running fine. --- - name: Install nginx hosts: nginx become: true tasks: - ...
2
votes
1answer
112 views

Totally automating Apache on whatever distro

The problem I'm having seems to be true to all distors but let's assume I use an all-default debian-stable (server), and ran apt update -y. Installing, upgrading, restarting as well as enabling or ...
1
vote
1answer
35 views

How to set tasks by variable in Ansible

I have been working with Ansible for a long time, and it came to mind that I would love to add customization into my playbooks from user input. But the following plays throw errors: --- # Test user ...
1
vote
1answer
115 views

ansible find: get path of a directory

In find I'm getting the following output, how to filter only the path? find: paths: /jv01 recurse: yes file_type: directory patterns: 'agent_13.3.0.0.0' register: oem - debug: var: oem "...
-1
votes
1answer
46 views

Run playbook periodically

we want to do backup using ansible and we want it to run periodically. I think its possible using os crontab to running playbook, but we want to have more neatly solution Is there any feature in ...
0
votes
1answer
52 views

set date on the mail body via ansible

I am trying to send a mail via ansible yaml that looks similar as below. The requirement is to send this email a week ahead of the patching. I can schedule it in cron, but I need to send an email 1 ...
0
votes
1answer
63 views

Haproxy healthcheck and backend section generation

I have a lot of sites and I want to do a http healthcheck for each one. Does it mean that I need to make a backend section for each site? If so, I need to generate it somehow. Can I achieve it with ...
0
votes
1answer
118 views

lineinfile module creating a file if it doesn't exist even I use “create=no”

--- - hosts: testhost become: yes tasks: - name: change user profile copy: src=/tmp/profile dest=/home/test/.bash_profile force=no owner=test group=test - name: update bashrc ...