Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

144
Visualizações
ansible handler only runs once when notified from parameterized role

I have an ansible playbook for some init services that are broadly similar with a few tweaks. In the top-level playbook, I include the role twice, like

   roles:
     - {role: "my-service", service: webserver}
     - {role: "my-service", service: scheduler}

the my-service role has tasks, which write init scripts, and handlers, which (re)start the service. tasks/main.yml looks like this:

- name: setup init scripts
  template: src=../../service-common/templates/my-service.conf dest=/etc/init/my-{{ service }}.conf
  notify:
    - restart my service

and handlers/main.yml has this content:

- name: restart my services
  service: name=my-{{ service }} state=restarted

But after the playbook runs, we're left with only the webserver service running, and the scheduler is stop/waiting. How can I make the handler see these as two separate notifications to be handled?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

The Ansible documentation states:

Handlers are lists of tasks, not really any different from regular tasks, that are referenced by a globally unique name.

So it doesn't make use of any parameters, variables, etc. when determining when/how to invoke a handler. Only the name is used.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda