Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow variables in notify list #456

Merged
merged 1 commit into from Jun 8, 2012
Merged

Conversation

dhozac
Copy link
Contributor

@dhozac dhozac commented Jun 7, 2012

This promotes reuse of a generic service tasks and handlers list, since a significant amount of services are used the same way.

@mpdehaan
Copy link
Contributor

mpdehaan commented Jun 8, 2012

Can you give an example of this being used in a playbook? I'm not sure I follow how this makes things reusable.

@dhozac
Copy link
Contributor Author

dhozac commented Jun 8, 2012

A lot of my services use the same basic format, install service, template configuration file, and enable the service, restarting it if the configuration file changes. So I have a tasks/templated-service.yml that I include for each of them:
---
- name: install $service
action: yum pkg=$package state=latest
notify:
- restart $service
- name: install $service configuration
action: template src=templates/$service.conf dest=$dest owner=$owner group=$group mode=$mode
notify:
- restart $service
- name: enable $service
action: service name=$service state=started enabled=yes

and then in the playbook I just use
tasks:
- include: tasks/templated-service.yml service=radvd package=radvd dest=/etc/radvd.conf owner=root group=root mode=0644
handlers:
- include: handlers/service.yml service=radvd

mpdehaan added a commit that referenced this pull request Jun 8, 2012
Allow variables in notify list
@mpdehaan mpdehaan merged commit 4cf057a into ansible:devel Jun 8, 2012
@mpdehaan
Copy link
Contributor

mpdehaan commented Jun 8, 2012

Sounds reasonable, merged, thanks!

mpdehaan added a commit that referenced this pull request Jul 17, 2012
Allow variables in notify list
@ansible ansible locked and limited conversation to collaborators Apr 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants