Questions tagged [ansible-playbook]

468 questions
1
vote
1 answer

How to enumerate hostvars into a role setting in Ansible

So I'm using a role to configure my postgresql server. That tole has a way of specifying server users & databases, like so: postgresql_users: - name: baz My hosts.yaml: all: hosts: children: django: hosts: django_1: …
velis
  • 233
  • 2
  • 10
1
vote
2 answers

Ansible: execute tasks.yml from playbook.yml

I searched a lot for exact the same thing that I wanted to do, but found nothing. So, I'm here to ask: I have a playbook.yml, where defined some tasks. The first task of that playbook is checking existence of file and, if file exists I want to…
Andrey N.
  • 13
  • 7
1
vote
1 answer

How to go rescue module when any package fails in Ansible Playbook

I have simple playbook where i am installing a bunch of packages in local system, expecting my playbook to come out from the loop when there is any failure during installation and go to rescue module for recovery. But my ansible playbook is trying…
john 517501
  • 13
  • 1
  • 4
1
vote
1 answer

Configure auditd to monitor the execution of only one command

We have Ansible in place I want to set up audit which logs who executes a play.. I want therefore only monitor the execution of the command ansible or ansible-playbook. I can configure Ansible to log all command using this: -a exit,always -F…
zn553
  • 11
  • 2
1
vote
1 answer

Ansible Windows endless run

I'm trying to use Ansible on my first Windows node, using winrm on HTTP (I will use https as a second step) and ntlm authentication. I configured group_vars and the basic connection to the Windows host works: me@ansible:~/ansible$ ansible -i…
Mat
  • 1,873
  • 7
  • 25
  • 41
1
vote
2 answers

How to perform a cyberarkpassword lookup for all hosts in an inventory group and write the keys out to individual pem files?

Ansible version 2.7.9 I'm writing an ansible playbook to deploy an piece of software to a linux environment. SSH access to these systems is protected by a CPM (Cyberark), used as an ssh key manager. I've got most of the logic figured out, save for…
Austin H
  • 13
  • 2
1
vote
1 answer

foreman.facts in ansible playbook

Iam using the foreman.py script for creating a dynamic inventory. How can I use the collected facts from the foreman.facts file in my ansible playbooks? ll /etc/ansible/foreman* -rw-r--r--. 1 root root 613597 Jun 3 16:38…
brotaxt
  • 11
  • 2
1
vote
3 answers

How to debug below o/p in ansible

From the Below output I need to see only "Value " information .. How to debug to get only Value information ??/ ok: [localhost] => { "msg": { "changed": false, "connection": "close", "content_length": "342", "content_type":…
Sandeep C H
  • 11
  • 1
  • 2
1
vote
2 answers

Ansible - debugging a template file modifications

I'm dry running an Ansible role. Part of the role is to deploy a big configuration template (that has a lot Ansible variables that get substituted in the deployment process) on a remote machine. A dry run tells me that the remote configuration file…
theo
  • 25
  • 8
1
vote
1 answer

Register variable holding list filtering instead of set_fact

filtered fact in the code below contains the filtered string and can be used throughout the playbooks during the execution: - hosts: localhost tasks: - set_fact: filtered: " {{ some_arg }} | regex_search(...)" However, filtered is…
rok
  • 159
  • 8
1
vote
1 answer

Make Ansible module use /etc/ansible/hosts instead of IP address

I have this Dell iDRAC management module I'm trying to use. For some bizarre reason it seems to demand an IP address instead of a respecting the hosts: directive. Here's the example I have been given: - hosts: idracs connection: local name:…
mr.zog
  • 923
  • 3
  • 20
  • 39
1
vote
1 answer

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'] }}_{{ item }}.out | awk '/Mbits/ { sum += $7; n++} END…
user3069488
  • 169
  • 2
  • 4
  • 19
1
vote
0 answers

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 fix it with no luck and putting in some arbitrary…
Atomiklan
  • 549
  • 1
  • 8
  • 16
1
vote
1 answer

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.username }}" state: present key: "{{…
willemdh
  • 245
  • 4
  • 14
1
vote
1 answer

Openshift installation playbook failing

I'm trying to install 2-node cluster with origin version 3.10 (one master, one node). Playbook fails on task openshift_control_plane : Wait for control plane pods to appear Initialization : Complete (0:00:35) Health Check …