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

can we use systemd services instead of rc.local to run ansible-pull-script.sh once on boot ? #141

Open
martbhell opened this issue Jul 8, 2016 · 10 comments

Comments

@martbhell
Copy link
Contributor

martbhell commented Jul 8, 2016

It would be good if ansible runs at the end of the systemd boot sequence, not at the rc.local (which runs before many services like ypbind, slurm and fs mounts, see "systemd-analyze plot > plot.svg" output).

@martbhell
Copy link
Contributor Author

Related: fgci-org/ansible-role-cuda#5

@A1ve5 A1ve5 closed this as completed Aug 9, 2016
@A1ve5 A1ve5 removed the ready label Aug 9, 2016
@A1ve5
Copy link
Contributor

A1ve5 commented Aug 9, 2016

See fgci-org/ansible-role-cuda#5

@martbhell martbhell reopened this Aug 22, 2016
@martbhell
Copy link
Contributor Author

martbhell commented Aug 22, 2016

Reopened and renaming as the cuda part is now done. Guess I shouldn't have two issues in the same issue..

@martbhell martbhell changed the title can we use systemd services instead of rc.local to run ansible-pull-script.sh and cuda_init.sh on boot ? can we use systemd services instead of rc.local to run ansible-pull-script.sh once on boot ? Aug 22, 2016
@martbhell
Copy link
Contributor Author

fgci-org/ansible-role-cuda@f93fd8a cuda_init.sh now uses a systemd service oneshot and that seems to work.

  • If we were to run ansible-pull as a systemd service - what point in boot do we want it to start at?
  • Right now rc.local and its scripts are started after network.target and it's type is forking. (/usr/lib/systemd/system/rc-local.service)
  • Making it start after ypbind, network-online, maybe more? But we should make sure that the service starts even if those services are not yet installed.
  • Do we want to keep Type=forking or do we want to start some services after ansible-pull? This will increase time before the node is available in slurm.

@martbhell
Copy link
Contributor Author

An idea: maybe if the ansible-pull-script.sh creates for example /etc/FGCI (once, after first success of the ansible-pull command) and then if that file exists then the systemd service does not wait and if /etc/FGCI does not exist then it waits at that point in boot?

@martbhell
Copy link
Contributor Author

To add this we could:
A) add the service in fgci-install and remove the line added to rc.local by pxe_config during kickstart
B) change pxe_config to install the service during kickstart

One pro for B is that there won't be a confusing rc.local entry sometimes
One con for B is that we'd have to modify the kickstart template :)

Thoughts? Is A OK?

@martbhell
Copy link
Contributor Author

/etc/FGCI added in fgci-org/ansible-role-fgci-install@ac6e092

@jabl
Copy link
Contributor

jabl commented Sep 15, 2016

Here's a blog post that provides a systemd service to run ansible-pull on boot:

https://calgaryrhce.ca/blog/2016/02/03/ansible-pull-and-kickstart-for-one-touch-server-provisioning/

martbhell added a commit to fgci-org/ansible-role-fgci-install that referenced this issue Nov 9, 2016
martbhell added a commit that referenced this issue Nov 9, 2016
@martbhell
Copy link
Contributor Author

The fgci-install role can now install the ansible-pull script. Some thought is still required to think about when exactly to run it during boot and how to make it non-blocking when the node has already been configured once with ansible (because on some sites it takes ~an hour for ansible-pull to run)

@martbhell
Copy link
Contributor Author

We now install a watermark file https://github.com/CSCfi/fgci-ansible/tree/master/roles/watermark-release so that could/should be used when doing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants