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.

Filter by
Sorted by
Tagged with
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, ...
2
votes
2answers
469 views

Ansible resumable plays [e.g. with site.retry]?

Using ansible often relies on a property called "idempotence". If you apply a role a second time, it's expected to have the same result. E.g. it won't add a second copy of the same line in a config ...
1
vote
1answer
4k views

How reasonable to make ansible work on systems with restrictive umask?

Q1. If you setup root with a restrictive umask, it will affect the files created when you run ansible, right? (Unless you tell ansible to ensure a specific mode aka. permissions). A1. Looks like it, ...
0
votes
3answers
617 views

Ansible : fetching remote hostnames

I have made a script which will put the hostname and ip adress into a file. My script is below: echo "*********************************************">>a.txt; hostname>>a.txt; /sbin/...
1
vote
0answers
1k views

Ansible, trying to find a way to force a task time out on a host it's currently operating on

Concerning Ansible, this should be fairly straightforwards I hope: Scenario: I have 3 servers, red, green, and blue. I have a task created for ansible to use yum in linux to install a random ...
0
votes
1answer
782 views

Omitting ansible's argument basing on variable

I want to maintain users with ansible. I use user module but I want to have some non-unique user ids. Now I have a dictionary like this: users: user: { password: "HASH", shell: "/bin/zsh", home: "...
8
votes
1answer
15k views

How can install specific version of ansible?

How can I install a specific version of Ansible, using Yum or another method? When I try to install version 2.0 it says No package 2.0 available. I checked the epel repo. There are only two rpms, ...
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 ...
2
votes
1answer
268 views

Replace deployment scripts with ansible-pull

To deploy new servers I use a master script (in bash) which downloads from a repository another script. That script then configures the servers and the services I want. The master script is always the ...
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
0answers
2k views

Ansible ERROR! 'AnsibleUnicode' object has no attribute 'keys

I am running Ansible for the first time and I get this error: root@raspberrypi:/opt/ansible# ansible-playbook -i /opt/ansible/hosts simple.yml ERROR! 'AnsibleUnicode' object has no attribute 'keys' /...
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
614 views

Where is the zone actually configured for an interface in firewalld?

I'm using ansible for adding zones to my firewall on a Centos machine. Didn't realize until it (almost) too late, that I'm not getting the IN_Internal interface working, it's all going to public, ...
1
vote
1answer
696 views

Ansible - Configuring AWS EC2 instance after it's created

I've got an Ansible playbook that creates an AWS EC2 instance through a CloudFormation template. After it's created I would like to configure it also through Ansible. Here is what I have now: --- - ...
1
vote
1answer
4k views

Parsing ansible output in shell script using sed/grep

I have a shell script which executes an ansible playbook and I want to process the output of this playbook. I am not sure how can I do this. Script: #!/bin/sh ansible-playbook -i inventory/ec2.py ...
1
vote
1answer
116 views

Ansible variables scope clash

I've got an ansible setup that looks like this inventories/ sandbox1 group_vars/ all sandbox1 pb/ pb1/ run_pb1.yml I've got roles and other stuff too, but I think ...
0
votes
1answer
1k views

Running the Following Playbook syntax appears to be correct but getting following ERROR!- 'blockinfile' is not a valid attribute for a Play

Running the Following Playbook syntax appears to be correct but getting following ERROR! ERROR! 'blockinfile' is not a valid attribute for a Play The error appears to have been in /root/playbook1....
4
votes
2answers
23k views

Add user and set password using Ansible

I have created an Ansible playbook to create user and set password. But it is giving me an error ERROR: password is not a legal parameter of an Ansible Play --- - hosts: all user: root vars: ...
0
votes
1answer
288 views

Ansible: running from virtualenvwrapper with pip installation

I'm trying to test ansible with a "pip" installation of ansible in a virtualenv of python managed by virtualenvwrapper. However, I am having problems to use the ssh-agent and the SSH keys: (ansible)$ ...
3
votes
1answer
950 views

What Command Line tools to connect from Unix to remote Windows?

I need to make some scripts for connecting from a Unix server to several Windows stations for automating file transfers. GUI is not needed and I can't install any additional software into Windows ...
3
votes
0answers
706 views

using ansible via vpn

I have a set of hosts that I can only access via openVPN (one VPN per host or group of hosts). ssh is only available after connected to the VPN. Is there any way to automatically bring up the VPN ...
5
votes
1answer
422 views

Turn off color in bash for logs

I am running Ansible on multiple machines and redirecting the output to a file, say log-$(date), which is mailed to me every day. The output file has multiple text colors, how to turn them off? ...
2
votes
1answer
5k views

How to Bind Mount /var/tmp to /tmp using Ansible and to CIS standards

I am hardening a centos6.7 VM to CIS benchmark standards. I am automating as much as I can using Ansible. The hardening document I am using is (page 12-13): https://benchmarks.cisecurity.org/tools2/...
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
1k views

SSH known_hosts ignored on one machine

I am experience strange behavior using ssh with a jump host. While the setup works on machine A (cygwin, OpenSSH_7.1p1, OpenSSL 1.0.2d 9 Jul 2015) it does not work on machine B (OpenSSH_6.7p1 Ubuntu-...
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/...
0
votes
2answers
2k views

Ansible nginx service on CentOS 6.7

I am trying to install and start nginx on my CentOS 6.7 test box. My playbook --- - hosts: testing tasks: - name: Install nginx package yum: name=http://nginx.org/packages/centos/6/noarch/...
3
votes
0answers
2k views

start-stop-daemon, services, environment variables, and ansible

So, I have a Java program that runs Ansible. I'd like to run this program as a service. I've written a service script in /etc/init.d that uses start-stop-daemon to run/stop the Java program. I've run ...
0
votes
1answer
2k views

Why is my /etc/hosts file not being read?

My /etc/hosts file looks like this: # Your system has configured 'manage_etc_hosts' as True. # As a result, if you wish for changes to this file to persist # then you will need to either # a.) make ...
10
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 ...
22
votes
3answers
59k views

List ALL Ansible variables for a host or group with an ad hoc command?

Ansible variables come from a variety of sources. It is for example possible to provide host_vars and group_vars by creating YAML files in a subfolder named host_vars and group_vars respectively of ...
5
votes
2answers
12k views

Ansible failed_when only print customized error message

I am writing a simple Ansible playbook to run RHEL leap second detector on Linux boxes with mixed distribution. here is the playbook --- - hosts: Linux vars_files: - ../group_vars/Linux.yml ...
2
votes
1answer
4k views

In Ansible dynamic inventory JSON, can I “render” hostvars based on the hostname?

The Ansible documentation gives an example here on how to return an inventory in JSON format: { "databases" : { "hosts" : [ "host1.example.com", "host2.example.com" ], "vars" ...
0
votes
1answer
1k views

How can I reuse the Ansible inventory for local tasks?

I'm trying to make use of Ansible for configuration management and centralized administration. All the machines I'm interested about are actually containers on the host which is going to run Ansible. ...
2
votes
1answer
2k views

Configure Ansible to write logs to a different file on managed servers

I would like to know if there is a way to configure Ansible to have its own log files instead of writing to /var/log/messages on RHEL server.
0
votes
1answer
64 views

Echo n-values for 1 key in ansible?

I have an ansible var : site1: - name: myName value1: something1 value2: apple value3: 14 ... valuen: "a submarine" So the point is, that I don't know how many values are ...
15
votes
2answers
75k 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 - ...
0
votes
3answers
1k views

Where can I find all the methods that I can call on an Ansible variable

Here is a simple Ansible playbook: - name: this command prints FAILED when it fails command: /usr/bin/example-command -x -y -z register: command_result failed_when: "'FAILED' in command_result....
4
votes
1answer
18k views

Unarchiving a downloaded tarball with Ansible

I'm trying to get WordPress downloaded and installed via Ansible and I can't seem to figure out what I'm doing wrong here. First I download via the get_url module then I attempt to use the unarchive ...
1
vote
2answers
328 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 ...
2
votes
1answer
4k views

Bash script and yml file output

I'm trying to catch the stdout of a script to a file, and at the same time have it display its ongoing summary: ./RUN host-names ANSIBLE.yml 2>&1 | tee out.txt What this does is that it ...
7
votes
1answer
509 views

Configuration management via versioned packages

For the hosts we manage, my boss has a vision of configuration management via versioned packages (in our particular case, fpm-built debian packages). This is to make: host deployment easier easier to ...
24
votes
1answer
21k views

Proper syntax for ansible symlink

What is the proper syntax for creating symlinks using ansible? I'm creating a Vagrant virtual environment and running ansible as my provisioner. Everything works fine up until I try to symlink to my ...
1
vote
1answer
70 views

how to ensure stable domain names for newly-provisioned cloud server instances?

I've been playing with server configuration management tool Ansible, whose use often depends on reference to a local inventory file containing arbitrary host names. For example, # file: my_hosts [...
1
vote
1answer
709 views

Error while installing edx on debian squeeze

I am installing edx platform on debian squeeze with anisible at the middle of the process of installation I get this error : TASK: [supervisor | create a symlink for supervisor cfg] ******************...
2
votes
3answers
3k views

Is it possible to start administering a linux box via Ansible with just the root account and its password?

I recently rented a Linux box and I intend to provision it using Ansible. I'd like to use Ansible as early as possible in the process. At this stage I only have a root account and the corresponding ...