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

[RFC] Allow synchronous delegation of restart to alternative init system #76

Closed
wants to merge 2 commits into from
Closed

[RFC] Allow synchronous delegation of restart to alternative init system #76

wants to merge 2 commits into from

Conversation

lucafavatella
Copy link
Contributor

Depends on #75

Closes #70

@lucafavatella lucafavatella changed the title Init system restart Allow synchronous delegation of restart to alternative init system Mar 29, 2017
@lucafavatella
Copy link
Contributor Author

Travis CI failure:

TASK [ansible-riak : install riak_shell.config with templated configuration] ***

fatal: [riak-test]: FAILED! => {"failed": true, "msg": "The conditional check 'riak_package == \"riak-ts\" and riak_shell_nodes is defined' failed. The error was: error while evaluating conditional (riak_package == \"riak-ts\" and riak_shell_nodes is defined): {{ riak_shell_nodes_list.split() }}: {% for host in groups[riak_shell_group] %}riak@{{ hostvars[host][riak_shell_interface]['ipv4']['address'] }} {% endfor %}: 'dict object' has no attribute u'riak'\n\nThe error appears to have been in '/home/travis/build/basho-labs/ansible-riak/tasks/main.yml': line 40, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: install riak_shell.config with templated configuration\n  ^ here\n"}

(looks similar to failure in #75 (comment) )

@lucafavatella
Copy link
Contributor Author

Travis CI failure:

Issue is not caused by this PR - see #77

@lucafavatella lucafavatella changed the title Allow synchronous delegation of restart to alternative init system [WIP] Allow synchronous delegation of restart to alternative init system Mar 30, 2017
@@ -2,6 +2,10 @@
- name: run riak_disk_tune
command: /bin/bash /usr/local/bin/riak_disk_tune.sh

- name: restart riak and ensure enabled
service: name=riak enabled=yes state=restarted
when: riak_init_system == 'system'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I became concerned with variable scope at execution time of the handler. Do you know if this riak_init_system is safe here? I am considering templating the trigger with the variable, and in turn specifying trigger name with system.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better not to change this to variable in notify, because of ansible/ansible#17922

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relevant note is that tasks/main.yml flushes handlers, so variable scope is more predictable in principle in this case

@lucafavatella lucafavatella changed the title [WIP] Allow synchronous delegation of restart to alternative init system [RFC] Allow synchronous delegation of restart to alternative init system Mar 30, 2017
@lucafavatella
Copy link
Contributor Author

Semantics of handlers in Ansible - at least as of 2.2.1.0 - appears to me to be under active development yet e.g. wrt notification of extra-role handlers. So delegating task to handler seems not a wise change at this stage. Closing this then.

For using runit I ended up forking and applying minimal addition:

- name: Reboot Riak to accept the new config and ensure it is enabled to start at bootup
  command: sv restart riak
  when: riak_init_system == 'runit'

@lucafavatella lucafavatella deleted the init-system-restart branch March 31, 2017 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant