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.

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. It manages nodes over SSH and does not require any additional remote software to be installed on them. Modules work over JSON and standard output and can be written in any programming language. The system uses YAML to express reusable descriptions of systems.

The platform was created by Michael DeHaan, the author of the provisioning server application Cobbler and co-author of the Func framework for remote administration. It is included as part of the Fedora distribution of Linux, owned by Red Hat inc., and is also available for Red Hat Enterprise Linux, CentOS and Scientific Linux via Extra Packages for Enterprise Linux (EPEL) as well as other operating systems. Ansible was commercially supported and sponsored by AnsibleWorks. Since October 2015 Ansible is owned by RedHat.

It was named by DeHaan after the fictional instantaneous hyperspace communication system featured in Orson Scott Card's Ender's Game.

1762 questions
8
votes
2 answers

ansible display file content to stdout

I'm using ansible 2.9.3 and I'm having trouble trying to display the content of a file from the target machine, this is my playbook : - name: Display content of resolv.conf hosts: jenkins tasks: - name: Display resolv.conf contents …
dejanualex
  • 185
  • 1
  • 1
  • 7
7
votes
4 answers

Ansible adhoc command execute with sudo

I need execute ansible adhoc command. $ ansible somehost -m command -a "cat /etc/passwd"-u someuser --ask-sudo-pass I have an user account (someuser) with sudo privilege. Usually I became root sudo su -. How to use adhoc command with sudo su -…
7
votes
1 answer

Packer won't correctly use private key for SSH auth in provisioning step

I use Packer to build VirtualBox images, with the Ansible provisioner to set up the images. The builder step creates a temporary user (ssh_username and ssh_password). The Ansible provisioner runs using this temporary user. I, of course, want to get…
siride
  • 569
  • 2
  • 8
  • 18
7
votes
1 answer

Is there any way to see the group_vars, host_vars, etc. available to a host in ansible?

So I just started a new company, and while familiarizing myself with the ansible repository, I was wondering if there's any way to see the variables that come from group_vars, host_vars and all that together in one place, it's non-trivial to gather…
7
votes
3 answers

Ensure only specific list of users exist with Ansible

We use Ansible to create users with this task: - name: Create adm users user: name: "{{ item.name }}" group: "{{ common_adm_group }}" createhome: yes password: "!!" update_password: always state: present with_items: "{{…
gtirloni
  • 5,746
  • 3
  • 25
  • 52
7
votes
1 answer

Extract a single item from a list using regex in Ansible

I'm attempting to configure a bridge interface on Ubuntu 16.04, templating the /etc/network/interfaces file in order to automatically insert the local NIC, like so: auto br0 iface br0 inet dhcp bridge_ports I do not have biosdevname…
Doug
  • 73
  • 1
  • 1
  • 4
7
votes
1 answer

Is there a dynamic inventory for VMware in Ansible?

The documentation for Dynamic Inventory makes mention of so many dynamic inventories, but none for VMware. I really liked the feature of tagging servers in Amazon EC2 and was hoping to re-create a similar system in our VMware environment. Fetch all…
ujjain
  • 3,983
  • 16
  • 53
  • 91
7
votes
2 answers

How to do regex-replace in a file using Ansible?

Based on this example: - lineinfile: dest=/opt/jboss-as/bin/standalone.conf regexp='^(.*)Xms(\d+)m(.*)$' line='\1Xms${xms}m\3' backrefs=yes from this documentation, it was tried to do a regex-replace in Ansible. Ansible version user@server:/home$…
030
  • 5,901
  • 13
  • 68
  • 110
7
votes
3 answers

ansible and reloading AWS dynamic inventory

See also: https://stackoverflow.com/questions/29003420/reload-ansibles-dynamic-inventory. My question: is there a better way of doing what's below? I have an ansible role that provisions AWS machines, and runs correctly (notice the provision tag): -…
Sonia Hamilton
  • 341
  • 1
  • 4
  • 11
7
votes
3 answers

How to refer to an existing uid and gid in Ansible?

In my playbook I install the amavis package. Later in a task I use the mount module to setup a ramdisk (tmpfs). In order to let the tmpfs-ramdisk be owned by the uid and gid created during amavis package install (amavis-user and amavis-group, in…
initall
  • 2,325
  • 3
  • 18
  • 19
7
votes
2 answers

Ansible conditional statement based on other roles?

I've got the following scenario with an Ansible deployment: hostX has the role common-mta and a few other roles hostY has the role common-mta as well as the role package-postfix The common-mta role copies a file (if you could have guessed, it's…
Joshua Boniface
  • 346
  • 3
  • 14
7
votes
1 answer

Issues with ssh and Ansible

When running an ansible task (with a script action), I'm getting this error message: stderr: OpenSSH_6.0p1 Debian-4+deb7u2, OpenSSL 1.0.1e 11 Feb 2013 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 19:…
Parthian Shot
  • 1,165
  • 4
  • 16
  • 32
7
votes
1 answer

Multi-datacenter Ansible load balancer template

I am migrating the management of an existing multi-datacenter setup to Ansible, but I am not sure what is the best way to model it, as I am new to it. I have three data centers D1, D2 and D3. In each, the same configuration is repeated…
Davide
  • 71
  • 3
7
votes
3 answers

What does "localhost | FAILED => Missing become password" mean? How do I get past it?

I have a Ubuntu 14.04 virtual machine set up in virtualbox and I am trying to follow these instructions. https://serversforhackers.com/an-ansible-tutorial When I get to the module section and try to install nginx with this command. with "local"…
thenetimp
  • 231
  • 2
  • 3
  • 12
7
votes
3 answers

Ansible repeating roles

I use Ansible to manage some web- and database servers which run websites for multiple vhosts. For each website I need to assign a database role to the dbservers group and a website role to the webservers group. So my playbook looks something like…
Sven
  • 246
  • 2
  • 8