Stack Exchange Network

Stack Exchange network consists of 174 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]

Use this tag for questions about Ansible, an open-source automation engine, related to using Ansible for topics such as cloud provisioning, configuration management, application deployment, etc.

1
vote
0answers
3 views

ansible AWX is connecting through ssh as root instead of user defined in credential

Hello I am running ansible 2.6.2 and awx 1.0.7.2 on rhel 7.5. AWX is connecting to my ssh proxy as root instead of the defined Credential user. My playbook contains the following become: yes ...
1
vote
0answers
11 views

Passing variables between scripts in a Jenkins Pipeline

I have a declarative jenkins pipeline that looks like the following: pipeline{ agent { ... } stages { stage("Provision EC2 Instance and Set ENV Variable"){ ...
0
votes
1answer
5 views

vagrant box tests in gitlab-ci

I have a vagrant box, provisioned with Ansible that needs testing on github pull requests. Is it possible to setup CI test suite for the mirror in gitlab-ci without extra expenses on droplets? Or ...
0
votes
0answers
15 views

How can I get gs_secret_key and gs_access_key to use gc_storage module in Ansible

I need to create a directory in a Google Cloud Bucket using Ansible. I would like to know where I can find the values to complete "gs_secret_key" and "gs_access_key" to use "gc_storage" module in ...
6
votes
2answers
38 views

What are some clear benefits of running master/agent configuration management?

Ansible seems to have a clear advantage over competition like chef and puppet because it is agent-less and saves a certain degree of overhead. I have read several comparisons of the various ...
0
votes
0answers
34 views

How to communicate between two manged nodes without control nodes in Ansible?

I am new to Ansible. In salt using salt-call, we can communicate between two minions. Similarly, I wanted to know how in Ansible can one Managed node talk to another Managed node without using the ...
1
vote
1answer
23 views

How do I get the find module to work in Ansible?

My playbook does not create a /tmp/results.txt file, but I expect it to do so with the content of the results of the find module. Here is my playbook: - name: Do stuff become: yes hosts: fun ...
0
votes
0answers
20 views

AWS ElasticBeanstalk Clone Prod to a temporary environment to debug

Is there a good approach to create a copy of prod environment just for devs to debug a bug that couldn't be reproduced or is there any appropriate setup in multi-tenant situation with multiple ...
1
vote
1answer
39 views

Which password database system work with ansible?

Which password database system work with ansible to manage password of network devices and servers?
4
votes
1answer
66 views

How to keep configuration files automatically during apt-get upgrade or install?

When performing and apt-get update; apt-get upgrade -y on a server I encountered the message: Setting up sudo (1.8.16-0ubuntu1.5) ... Configuration file '/etc/sudoers' ==> Modified (by you or by ...
3
votes
1answer
34 views

tools to gather variant information from thousands of servers and update into database

Recently, I use ansible to gather information periodically from thousands of servers(which already installed collectd to gather CPU, memory, disks, netowrking info) in our company. For example: I ...
6
votes
1answer
111 views

What is ansible-runner about?

I've read the README file from the github repository as well as the documentation site of ansible-runner (from the official ansible project) but I don't understand what is ansible-runner about and in ...
0
votes
0answers
112 views

How to skip play in ansible-playbook?

I have 2 plays in my sites.yml file: - name: First play hosts: all remote_user: root roles: - role1 - name: Second Play hosts: all remote_user: ansible become: yes become_method:...
0
votes
0answers
31 views

Terraform Project Organization with AWS VPC Peering Connections

How best does one organize a project for AWS that makes use of peering connections. At present my folder structure looks like this modules/ staging/ production/ provisioning/ peering/ I'm also ...
0
votes
0answers
27 views

How to take a backup of Ansible tower?

Currently we have an awx running on a VM using containers: CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS ...
1
vote
1answer
37 views

Ansible YAML inventory - Groups that are allways members of other groups

Situation: I have a group "webservers" where I put all webservers in. As well as a group "mysqlservers" for the database servers respectively. Now I do also manage some LAMP servers and I want them ...
6
votes
2answers
178 views

Modify sudoers file with ansible playbook template

I am trying to create a sudoers file with ansible template. The sudoers file should look like below: Cmnd_Alias LS = /bin/ls Cmnd_Alias LESS = /usr/bin/less Cmnd_Alias DU = /usr/bin/du %support1 ALL=...
1
vote
1answer
99 views

How to write logs for certain tasks only?

I am using Ansible and created a Playbook for deployment. I defined log_path in ansible.cfg and now tasks output are going to this log file. I want to send only few task's log into this log file. How ...
2
votes
2answers
515 views

Applying ansible playbook to a docker container on a remote host

I have automated the setup of several docker containers with ansible. This works pretty well but there are certain recurring tasks that have to be executed within the docker containers. It is ...
0
votes
1answer
199 views

Ansible - Handler not found on first attempt

Command run: sudo ansible-playbook site.yml --connection=local Distributor ID: Ubuntu Description: Ubuntu 18.04 LTS Release: 18.04 Codename: bionic ansible 2.5.5 I'm encountering ...
4
votes
1answer
130 views

Ansible service module running state utility

Ansible v2.5 introduced a new "running" state for the service module, the doc is not saying anything about it. started/stopped are idempotent actions that will not run commands unless necessary. ...
0
votes
0answers
77 views

Ansible not able to connect to Ubuntu server/container (Error: Permission denied)

When I am running my ansible play book I am getting an error as below. details are given below. I am rinning the ansible-playbook on localhost (CentOS7) and connecting to docker containers. It's ...
3
votes
0answers
76 views

How to properly automate CM?

Let's say I have a number of tools like Docker bench security, some static security scanners, etc. Now I have let's say free Ansible edition (no expenses are considered). I have lots of logs, but not ...
2
votes
1answer
92 views

ansible tower_project module, always getting “ansible-tower-cli required for this module”

I have a control host that has the following: ansible --version = 2.5.2 tower-cli --version == 3.3.0 tower-cli is able to connect to a remote Ansible Tower instance (note, Ansible tower itself is ...
1
vote
1answer
35 views

Ansible playbook to ensure Ruby gems are installed

Can I use ansible to make sure certain Ruby gems are installed on a list of Windows 7 hosts? How do I do this?
4
votes
1answer
218 views

problems running Ansible with become on domain-connected Windows Server

I am running several tasks on a Windows 2016 server with Ansible including: Joining it to a domain SOMEDOMAIN SOMEDOMAIN\SOMEUSER has been added to the local administrators group on the machine with ...
3
votes
1answer
1k views

Ansible Jinja template if statement

This is a snippet from my Ansible jinja template which populates an environment specific template. docker_compose_mq: <string-passed from Jenkins> docker_compose_profiles: "string" {% if "{{ ...
3
votes
1answer
110 views

Specify default arguments for Ansible playbook

When I create playbooks I often add a comments section at the top on how to run the Ansible playbook. With more options becoming available in Ansible, the list of command-line arguments also seems to ...
7
votes
1answer
178 views

How to notate ipv6 addresses in inventory file?

I have a machine, that is accessible via ipv6 only. It is setup for ssh with rsa key. Now I'd like to manage it with ansible. Unfortunately, this is not covered in the inventory documentation. So I ...
2
votes
1answer
44 views

Why screen folder in /var/run disappears in Docker container after running Ansible playbook?

Files I've got the following Dockerfile: FROM ansible/ansible:ubuntu1604py3 ENV DEBIAN_FRONTEND noninteractive RUN pip3 install ansible RUN printf '[local]\r\nlocalhost ansible_python_interpreter="...
1
vote
1answer
45 views

Deploying a SaaS solution which is custom for every customer

So we have 5 repositories (Individual web services ex. CMS/E-commerce and internal APIs) which are currently deployed as Docker containers. What we plan to do is to use these services and make a ...
3
votes
2answers
51 views

Deploy two independently hosted services in production at once without any downtime

I have two different services. Let's say Service A and Service B. Service B is dependent on Service A. Both code bases are hosted in separate repo in Bitbucket and code bases are maintained by ...
3
votes
1answer
33 views

Tool preferences for rapidly spinning up and spinning down k8s clusters

My team hosts several completely different projects on a production k8s cluster with a given configuration. We use AWS (and are starting to use Google Cloud). We have a QA cluster as well, that "sort ...
1
vote
0answers
1k views

How to handle item not in list in ansible variable?

This question may look strange as something like this is not implemented in real life. I have tried to make it very general. Here is my ansible-playbook: tasks/main.yml - name: "Setting place name ...
3
votes
3answers
2k views

Is there a way to run with_items loops in parallel in ansible?

I'm running ansible 2.2, but can upgrade if it helps. I saw this: https://github.com/ansible/ansible/issues/12086 and was pretty excited, but it doesn't seem to be in this (or any) version of ...
1
vote
1answer
1k views

How do I get dict key from ansible playbook variable?

Following is the desire output: domain.com is in gh4.allserevers.com The idea is to pass domain name ie domain.com in playbook and playbook will lookup its A record then check it against the ...
8
votes
2answers
496 views

How do I run Ansible Azure playbooks while avoiding storing credentials in files?

Background We use Ansible to provision and manage Azure infrastructure. At the moment we run Ansible "manually" i.e. we manually execute playbooks for various automated tasks. No CI infrastructure. ...
0
votes
2answers
1k views

Ansible Playbook Localhost Invocation Working Directory

I want to run an ansible playbook locally (host is localhost, like -i "localhost,") and inside the Playbook obtain the working directory from which the ansible-playbook command was invoked. However, ...
1
vote
0answers
86 views

Can I create an Azure VM from Ansible with NICs in different resource groups?

I am working on creating an Ansible playbook to Ensure required network resources for an Azure VM are present, and Create an Azure VM attached to those resources. Due to the way the organization ...
0
votes
0answers
66 views

Ansible ping hangs after one succesful ping

I have 3 hosts and when i try to ping using the command below: ansible all -i hosts/team_ansible.yml -m ping --user max --ask-pass Only i get success message from one system and then it hangs for ...
2
votes
1answer
252 views

WinRM / WSMan - getting SSL handshake error / TCP RST when connecting with IP address, correct connection when connecting with hostname

while using ansible to manage some AWS based windows machines when connecting using the IP as destination,on some machines im getting an SSL Error credssp: HTTPSConnectionPool(host='18.217.233....
-2
votes
1answer
54 views

Ansible translation: Installing Apache + Certbot in Ubuntu

I currently have a doubt for my last line of code to make it work in ansible, the code is the following: sudo apt-get update sudo apt-get upgrade sudo apt-get install apache2 python-letsencrypt-...
1
vote
1answer
263 views

Ansible Expect module times out; unable to end play or move to another module

I've noticed that the expect module will always time out and cause an rc=1 code. It's doing everything that I want it to, I just want to move to another module. How can I end the expect module and ...
3
votes
2answers
2k views

How do you simulate “sudo su <user>” in Ansible?

I have a server where my user is able to sudo to the root user without a password, and then the root user can sudo to a third user without a password. However, my user cannot sudo directly to the ...
-2
votes
1answer
89 views

Installing Ansible Controllers to build agents which best practice to use?

Trying to implement infrastructure as code. I need the ansible controller machine which pulls the updated playbooks from the git and run the playbooks to create the infrastructure. The issue is I have ...
1
vote
1answer
671 views

Ansible Expect Module hung on attempting a simulated return keystroke

I would like to use the expect module in an ansible playbook to telnet through a termserver to reach a NetApp filer. I tried the telnet module, but using the port argument after the ip address doesn't ...
-2
votes
1answer
38 views

Conditionally run certbot

I am running an ansible task that will among others install a let's encrypt certificate. I want the task to only run if the certificate has not been installed. What is the best way to check (via cmd)...
0
votes
3answers
87 views

Logging ansible crons in kibana

I have set up some crons in ansible, and I want to log when they start, finish, and if they fail. How I could do it? I don’t know so much about ansible. Regards.
0
votes
1answer
917 views

In ansible how to select specific tasks in a role according to the playbook or a more general parameter?

My understanding of Ansible roles is that they are the unit of reusability when implementing processes using Ansible, similarly to what a class or a package is in some computer languages. It ...
3
votes
1answer
471 views

How do I provision a Windows Docker container with Ansible?

I want to provision a Windows Docker container with Ansible, but I am confused about how exactly it will work. For instance if I use Packer with Linux, I know I can run ansible (which is ansible ...