Questions tagged [ansible-handlers]

28 questions
1
vote
3 answers

Run handlers regardless of task failure?

I have an Ansible role which has the following tasks: --- # optionally find the latest version of goss using the GitHub "API" - name: detect latest version shell: | curl -sIS https://github.com/aelsabbahy/goss/releases/latest | \ tr…
Naftuli Kay
  • 87,710
  • 93
  • 269
  • 411
0
votes
0 answers

Ansible cannot find the requested handler that is within the same role

I am running a playbook that includes a role with the roles: key. When a task within the role notifies a handler within the role it throws the following error. ERROR! The requested handler 'Build eigen' was not found in either the main handlers list…
Braedon
  • 41
  • 1
  • 5
0
votes
2 answers

When usage with Ansible Handlers

having an ansible playbook that will run on all hosts including Debian based & RedHat based servers this will install mariadb on RHEL based servers only doing some configuration changes, start the service once the service started handlers are used…
csx4
  • 141
  • 1
  • 5
0
votes
0 answers

Supressing handler in Ansible

My role have two handlers: start service and restart service. I want to run start service only if service was installed, and I want to restart service if I changed service configuration file. (That were normal ansible handlers, now complicated part…
George Shuklin
  • 6,952
  • 10
  • 39
  • 80
0
votes
1 answer

ansible debug msg throws error inside handler

Playbook runs fine but debug msg module throws undefined variable error. --- - hosts: labservers become: yes tasks: - name: restart httpd service: name: httpd state: restarted notify: - cmds handlers: - name: change file…
evanooruvan
  • 25
  • 1
  • 6
0
votes
1 answer

Ansible handler for resting password to change the password on first login

Hello working on a ansible script to create a ssh user and on the first login to be forced to changed the password. The idea is ok, but seems like handler is not ok for the ansible 2.7.7 with python version 3.7.3. Here is the actual script and…
Klevin Kona
  • 361
  • 1
  • 3
  • 15
0
votes
1 answer

ansible. Run handler on specific host

I need to collect some information during run of ansible and print this information in the end. I've tried to define empty list variable in role. I added in playbook handler which add new value to list ant print value of this variable in the end of…
passer
  • 123
  • 1
  • 2
  • 7
0
votes
0 answers

Ansible handler not executed

Ansible version: 2.6.3 My folder structure : chrony/ ├── handlers │   └── main.yml ├── tasks │   ├── config.yml │   ├── main.yml │   └── package.yml └── templates └── chrony.conf.j2 The handlers main.yml was restarting chrony: - name: Restart…
dommgifer
  • 71
  • 1
  • 1
  • 7
0
votes
1 answer

Ansible roles workflow issue

I want to (step1) change postgresql configuration file, (step2) restart service and then (step3) add db user. ../roles/postgres/tasks/main.yml - name: change postgre pg_hba.conf template: src=pg_hba.conf.j2…
Roy Zeng
  • 511
  • 7
  • 10
0
votes
1 answer

What is the proper way to upgrade installed packages with Ansible

Let's assume I have the next simple Ansible playbook: --- tasks: - name: Upgrade installed packages become: true apt: upgrade: safe - name: Install NGINX web server become: true apt: name: nginx …
Victor Bocharsky
  • 11,930
  • 13
  • 58
  • 91
0
votes
1 answer

Handler dependencies for Ansible

I have a role which configures /etc/network/interfaces.d/ethX. It has handler 'restart interface' which is called through notifications. But there are few programs which are listen on that interface and should be restarted if I changed anything in…
George Shuklin
  • 6,952
  • 10
  • 39
  • 80
0
votes
1 answer

Ansible notify syntax issue - name ^ no action detected in task

I'm not sure what I'm missing here. Ansible 2.1.2.0 Python 2.7.5 CentOS Linux release 7.2.1511 (Core) Playbook file looks like: [vagrant@myvagrant ~/aks/netdata_ansible/ansible] $ cat netdata.yml --- - hosts: all gather_facts: no roles: …
AKS
  • 16,482
  • 43
  • 166
  • 258
-1
votes
2 answers

ansible role can't start apache via handler

I have this simple role for apache (in CentOS7): roles/apache/tasks/main.yml --- - name: Add epel-release repo yum: name: epel-release state: present - name: Install Apache2 yum: name: httpd state: present - name: Insert Index…
icasimpan
  • 1,253
  • 3
  • 16
  • 28
1
2