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 automation tool ("IT orchestration engine", per the company web site) for the deployment and configuration of applications and systems.

1
vote
1answer
35 views

Linux Mint Infrastructure Management [closed]

I want to deploy Linux Mint on ~40 PCs. If I do that, I will need a centralized way to control those PCs. For Example, install/remove software on all those PCs on the same time, set environment ...
0
votes
1answer
937 views

How to pass prompt in ansible?

I am trying to pass a prompt y in ansible when it executes the below command. When i do manually on server it asks for a prompt. How should i do it with ansible using shell module.Please help with ...
14
votes
2answers
72k views

Ansible use inventory_hostname or ansible_hostname in task name

I am writing a rolling upgrade playbook and would like to print out the hostname of current host been upgraded. I put inventory_hostname and ansible_hostname in task names but that did not work - ...
1
vote
0answers
27 views

PXE boot a computer using Ironic Bifrost

I am using Openstack Ironic standalone using Bifrost. I followed this link link https://docs.openstack.org/bifrost/latest/install/index.html#introduction to install Bifrost on CentOS system in ...
0
votes
1answer
28 views

Ansible User module removes sudo configuration. Why?

An Amazon Linux 2 machine is configured with a user that can sudo without password as follows: # Add user sudo groupadd -g 2002 one-username sudo useradd -u 2002 -g 2002 -c "One Username Account" -...
-1
votes
1answer
20 views

Defining Ansible inventory on remote server

What specific changes need to be made to the code below so that the Ansible Playbook will know how to pull testFile.txt from ServerB into ServerA? These are both Amazon Linux servers. Note that ...
2
votes
1answer
178 views

yum lockfile is held by another user

Amazon Linux 2 instances are operated upon by an Ansible Playbook which performs multiple yum tasks one after the other. What specific changes need to be made to the syntax below in order for the ...
0
votes
1answer
44 views

Ansible mysql_* modules show error at first launch

This is my yml file which should update system, install mysql-server, change binding and run steps from "mysql_secure_installation". --- # tasks file for deploy_db - name: Update repos apt: ...
0
votes
2answers
335 views

Ansible jinja2 filter reject

I need to reject "*" from stdout lines. "stdout_lines": [ "rchinnn01", "rchinnn02", "*" ] - set_fact: nfs_clients: "{{ nfs_clients_out.stdout_lines | reject(...
1
vote
1answer
27 views

Deploy different roles on different servers using one playbook

F.e. I created two roles via "ansible-galaxy init": deploy_back and deploy_front Also I wrote a playbook.yml file. - name: Create cluster become: yes hosts: all roles: - deploy_front - ...
0
votes
1answer
160 views

Ansible configuration file

I have my ansible.cfg file in /etc/ansible/ as well as /apps/ansible/. We have made all the required setup in /apps/ansible/. Now, I have created new user and have all the ssh keys setup for the ...
0
votes
1answer
55 views

Ansible: difference between “shell” and “command” modules

Ansible wiki says: The given command will be executed on all selected nodes. It will not be processed through the shell, so variables like $HOME and operations like "<", ">", "|", ";" and "&" ...
0
votes
3answers
285 views

Run shell command from Ansible

I have a shell script which just changes directory (here directory path is given). shell file #!/bin/bash p="dir/file/create" cd "$p" exec bash Ansible playbook --- - hosts: localhost ...
-2
votes
0answers
34 views

Oracle WebCenter 12C Portal Domain Configuration using Ansible

I'm trying to configure Weblogic WebCenter 12C Portal Domain via Ansible on CentOS 7, but still can't find the way how to do it. So far I could install weblogic and weblogic portal with DB via Ansible....
2
votes
0answers
34 views

Ansible firewalld - guaranteed final state?

The ansible firewalld module is great for adding rules, but old rules are left in place. How can I achieve a guaranteed final state using the firewalld module? Specifically, I would like a role that ...
1
vote
1answer
2k views

How can I pass a positional parameter a bash script requires to it in ansible?

I have a bash script I am running in ansible with the script module. However, it needs a specific positional parameter to be specified as a server-name to function in this case as $1. I am ...
0
votes
1answer
57 views

fetch dependencies while install deb with ansible

i'm trying to install mysql 8.0.15-1debian9 on a debian 9 server the problem is that mysql only provides the latest version of mysql in their apt repository which is 8.0.16-1debian9 however 8.0.16-...
2
votes
2answers
160 views

Encrypt a file on remote host

How to encrypt a file on the remote host using Ad-Hoc command 'ansible-vault'. for example, a myfile.txt on a remote machine needs to be encrypted from the host machine
0
votes
2answers
216 views

how to use included variable from file with jinja2 template and with_items

I am having an error where the fields of my variable are not being detected when trying to build a configuration using a jinja2 template. This is to sync Linux repositories to yum and apt based ...
1
vote
1answer
6k views

Ansible, attempting to get specific regex pattern to work with lineinfile module

As per my question above: "Ansible, attempting to get specific regex pattern to work with lineinfile module" Essentially, I'm trying to get it to work in a single play as opposed to 2 separate plays, ...
1
vote
3answers
6k views

ansible pass shell command result to variable

I stuck a bit with ansible and autogenerated id, I have multiple mysql master - slaves server for that I need to generate a server-id. my idea was to do something like this: - name: generate ...
0
votes
1answer
73 views

how to run playbooks in ansible parallel

site.yml --- - import_playbook: common.yml - import_playbook: redis.yml - import_playbook: riak.yml - import_playbook: webserver.yml - import_playbook: haproxy.yml I want to run these playbooks in ...
1
vote
2answers
29 views

It is possible to define an ansible.cfg file as the main config for only one role?

I would like to run the 'ssh' role without the become directive and run my others roles run with the become directive I decided to create an another config file ansible_ssh.cfg which not contains the ...
1
vote
1answer
103 views

Ansible dnf module: “MODULE FAILURE”

I am seeing the Ansible dnf module fail. But not reliably. When it does fail, it seems to succeed if I run Ansible again. My system is Fedora 29 Workstation. (More version information is shown ...
1
vote
2answers
327 views

When puppet, chef or ansible are simpler solutions than package manager?

I'm new to above deployment and configuration tools. I have typical need to install and upgrade on a target machine a customized and configured webserver, maybe reverse proxy, database, required ...
0
votes
1answer
37 views

ansible block of code

I need to create an xml formated file in ansible. The file contains <> and spaces. When I run the playbook without the <> or any white spaces between lines in it, the playbook creates the ...
1
vote
2answers
194 views

read-verification alternative (two prompts and if-then comparison alternative)

I am trying to create a small script for creating simple, all-default Apache virtual host files (it should be used any time I establish a new web application). This script prompts me for the domain....
0
votes
1answer
28 views

Ansible: Iterate over variables and run command if variable is defined

I want to set nameservers in /etc/resolv.conf using ansible. I basically want to set variables (DNS1, DNS2, DNS3). I only want to apply DNS# if it is defined. I have the following so far. # Run this ...
0
votes
0answers
140 views

ansible unarchive module not working as intented!

i am using ansible unarchive module,, cassandraDir = /opt/con/cassandra cassandra package = /tmp/apache-cassandra-3.7-bin.tar.gz I need to unzip the cassandra package in the "cassandraDir" ...
0
votes
1answer
110 views

Ansible modules copy/template errors for Linux 5 hosts using python26 ,python binding libselinux-python needed

We have some 50 odd linux 5 hosts, and to manage that we use ansible. Problem :- Ansible modules copy/template errors for Linux 5 hosts using python26 ,python binding libselinux-python needed ...
1
vote
4answers
4k views

Copy files to aws s3 bucket using Ansible

My plan is to copy file from ec2 to s3 bucket using ansible, Here I've make playbook but getting some error: copy2s3.yml --- - name: Copy to s3 s3: aws_access_key: "{{ lookup('env','aws_key')...
8
votes
2answers
1k views

Whenever ansible makes changes to sshd in CentOS7 a random future play cannot connect

This has been an irritating enough problem now that I thought I would finally ask the community at large what a possible solution might be. It's even more irritating that I seem to be the only one ...
0
votes
0answers
202 views

How can I prompt users while running a playbook?

My needs: Write a playbook which can install apache if the user wants to, while the playbook is running by typing yes or no. apache_prompt.yml hosts: slaves vars_prompt: - name: ...
0
votes
1answer
104 views

How to change the user after connecting to the jump host when using ProxyCommand

My normal flow is like: ssh jumphost sudo -iHu jump_user ssh target_user@targethost Do some task How to do this using ProxyCommand? I have tried: ssh target_user@target_host -o ProxyCommand="ssh ...
1
vote
1answer
159 views

If condition in ansible jinja2 template

Search keyword in "host_fqdn" variable. If the value has "lab.com" keyword in it, it should directly store the value to "host_fqdn" again or else it should add "lab.com" keyword to the value and store ...
1
vote
1answer
1k views

Ansible task for searching words

With my ansible task I wanted to check if openjdk is installed on environment. - name: Check if java is installed on environment shell: rpm -qa | grep 'openjdk' register: result As result I ...
8
votes
2answers
26k views

How would I register a dynamically named variable in an Ansible task?

I'm trying to retrieve the group ID of two groups (syslog and utmp) by name using an Ansible task. For testing purposes I have created a playbook to retrieve the information from the Ansible host ...
0
votes
1answer
2k views

Ansible playbook - to change the line in configuration file

I need to write a playbook to replace the line locking_dir = "/var/lock/lvm" to locking_dir = "/run/lock" in /etc/lvm/lvm.conf using ansible /root # cat /etc/lvm/lvm.conf | grep locking_dir | grep -v ...
1
vote
1answer
100 views

Arch: Is there any chance to use Apache all default for 2 or more virtual hosts?

I consider establishing an Arch based LAMP. From reading this document, it seems there is must configuration to be done just for Apache itself, not to mention MySQL and PHP. In Debian LAMP there's ...
0
votes
1answer
47 views

LAMP DB-agnostic way to create a DB stack

Is there a LAMP-MySQL (or equivalent) agnostic way to create a DB stack that includes: DB-user and a relative password DB with the same name as of the user Setting a host for the DB (say, localhost) ...
8
votes
4answers
893 views

Is there a distro-agnostic configuration management software?

I don't want to label myself to specific configuration-manager modules like Ansible's apt module or yum module. Is there a distro-agnostic configuration management software, or at least one with ...
0
votes
0answers
74 views

How can I import an OVA into RHEV oVirt with Ansible

I am using both Ansible and RHEV and notice there does not seem to be a way to import an OVA into a RHEV oVirt environment using the Ansible oVirt VM module. I have a prebuilt VM I exported as an OVA ...
0
votes
2answers
2k views

Ansible: send email on unreachable host

I'd like to get an email sent whenever one of the hosts in ansible cannot be reached through SSH. I've tried to write a playbook to do this (see below). After gathering facts, any unreachable host is ...
0
votes
1answer
4k views

Updating yum repo in RHEL 7 with Ansible

I have been trying to write a playbook that adds the EPEL repo to the list of repos available. The playbook I have is: - hosts: all # define variables. vars: epelReleaseMajorVersion: 7 ...
0
votes
1answer
57 views

Building projects from source - determining / changing bin location?

I have pulled down a git repository for Ansible and followed the instructions to build it. I'm not familiar with the process of building from source and am somewhat confused. http://docs.ansible.com/...
1
vote
3answers
369 views

What's the advantage of mere Ansible on mere shell-scripting if one doesn't use communally-maintained Ansible-Galaxy roles? [closed]

I establish a LAMP with a few extras on a remote Debian machine with a similar shell (Bash) script: #/bin/bash apt update -y apt upgrade ufw sshguard unattended-upgrades wget curl git zip unzip tree ...
2
votes
2answers
167 views

How to enable or disable Apache modules in a distro-agnostic way?

I usually work with Debian/Ubuntu as a basis for Apache and recently learned that commands like a2enmod MOD or a2dismod MOD are Debian-specific. Is there a global / distro-agnostic way (maybe with ...
0
votes
2answers
6k views

Ansible array variable

I have a template file config.j2. {% for host in groups['dbs'] %} ips= {{ hostvars[host].ansible_default_ipv4.address }} {% endfor %} My output is: ips= 192.168.231.91 ips= 192.168.231.92 ...
0
votes
1answer
63 views

Why does upgrading through Ansible commonly considered “idempotent”?

I know that an idempotent function returns a result which is can be returned more than once without changing the application essentially (like adding zero to a number or multiplying that number by 1). ...
0
votes
1answer
319 views

How to run Ansible playbooks only if there are no problems in the playbook?

I have learned of the command ansible-playbook example.yml --check which can tell me if something in my playbook is problematic (as far as Ansible can recognize). I think I should combine this ...