Questions tagged [ansible-playbook]

468 questions
1
vote
1 answer

Avoiding jinja templating delimiter in when statements

I'm currently porting my Ansible playbooks from version 2.1 to 2.7. Ansible now prints a warning if I use jinja templating delmiters such as {{ .. }} in a when clause. [WARNING]: when statements should not include jinja2 templating delimiters such…
Francis
  • 481
  • 2
  • 7
  • 19
1
vote
1 answer

Ansible expect is not sending response

I'm new to ansible and trying it by writing an ansible playbook for installing graphite, as a part of it I have the graphite-manage syncdb command which I would like to automate. I wrote this task to automatically answer to the promts but for some…
rivar_
  • 113
  • 1
  • 4
1
vote
2 answers

Ansible Variable above hosts

Ansible Variable above hosts hello its posible to create a variable for multi hosts like this? vars: some_vars: "./Prometheus/roles/" # <---- THIS Variable? - hosts: lxd1 vars_files: - Prometheus/vars/grafana_vars.yml become: true …
1
vote
1 answer

Ansible: cannot get contents of a variable

I seem unable to get the output from a yum command from ansible. I have $ cat mcve.yum - name: MCVE hosts: localhost tasks: - name: Install package yum: name=perl register: test async: 1200 poll: 5 - debug: …
boardrider
  • 949
  • 2
  • 18
  • 29
1
vote
2 answers

Ansible variable for roles used several times

I have a role with some variables than I using several times with different parameters like below: roles: - role: my_role vars: role_uuid: uuud_1 first_param: first - role: my_role vars: role_uuid:…
DevOps
  • 720
  • 5
  • 16
1
vote
1 answer

Does ansible win_chocolatey module support retries?

Has anyone ever seen retries work on an ansible win_chocolatey task? The follow seems to fail on the first attempt with no retries and I'm getting timeouts at the ansible level while choco attempts to install a package. - name: Install Chocolatey …
Peter Kahn
  • 207
  • 3
  • 11
1
vote
1 answer

Ansible hangs on pumactl start

I have a playbook to install puma on my ec2 instance and everything is fine except when I run bundle exec pumactl start at the the end it starts the server but the playbook hangs indefinitely. Here is the Ansible task - - shell:…
Ryan Grush
  • 181
  • 9
1
vote
1 answer

Pooling package installs in ansible

I am trying to set up a system with multiple roles (e.g., webserver, database-server, mailserver etc.) Each of the roles requires the installation of some software packages defined as their own task in the main.yml for each role. Does ansible have a…
John Nemo
  • 17
  • 3
1
vote
1 answer

Ansible: Calling tags from role but they are not getting executed

I have some tasks as shown below - name: Add the server's domain to the hosts file lineinfile: dest: /etc/hosts #regexp='.*{{ item }}$' line: "{{ hostvars[item].ansible_default_ipv4.address }} {{ LOCAL_FQDN_NAME }} {{ LOCAL_HOSTNAME }}" …
Quintin Par
  • 4,373
  • 11
  • 49
  • 72
1
vote
1 answer

Restart MariaDB cluster with Ansible

I would like to restart my MariaDB cluster with Ansible. I applied serial option to run script on servers one by one, but at the end of the script (= after build cluster), I would like to run command on each of these server to carefully restart…
dannyx
  • 31
  • 7
1
vote
1 answer

Ansible Debug-msg data as email content

I want to send email with content from .yml file output. I've created a Jenkins job using groovy script and inside groovy I'm using shell script to call .yml file and inside I'm checking the url's health check using Ansible's URI module. Output on…
Ram_Mady
  • 11
  • 2
1
vote
0 answers

change a group_var on every 20 executions

I have an Ansible project with more or less 100 hosts (much more in a near future), this project does several calls to an API that as a limit rate of 1000 calls per token. In my project I define the token on group_vars and what I want is to run a…
João Pereira
  • 39
  • 3
  • 7
1
vote
1 answer

ansible : Task output redirection to the next task as input

Hi I am able to get the desired output in my playbook below where I am using 2 tasks as follows aws-create-rds and aws-create-route53-record --- # Playbook for creating aws rds instance and then creating route53 dns record. - name: setup…
Shailesh Sutar
  • 1,517
  • 5
  • 23
  • 41
1
vote
1 answer

How can I log inventory_hostname to a file on the remote using a Playbook?

I'm trying to write the inventory hostname to a remote file for later processing (eventually a remote fact file). The host below has the physical hostname calvin.mydomain however the controller connects to it using the inventory hostname (different…
Server Fault
  • 3,714
  • 12
  • 54
  • 89
1
vote
1 answer

Ansible: access variables and dump to CSV file

vars: servers: - name: centos port: 22 tasks: - name: Check if remote port wait_for: host={{ item.name }} port={{ item.port }} timeout=1 ignore_errors: True register: out with_items: "{{ servers }}" - debug: var=out - name: Save…
Ricky Vene
  • 21
  • 1
  • 1
  • 4