Trying to reboot an Ubuntu system

fatal: [node-js.atlascollege.nl]: FAILED! => {“changed”: false, “elapsed”: 0, “msg”: “Reboot command failed. Error was Failed to set wall message, ignoring: Interactive authentication required.\r\nFailed to call ScheduleShutdown in logind, proceeding with immediate shutdown: Interactive authentication required.\r\nFailed to set wall message, ignoring: Interactive authentication required.\r\nFailed to reboot system via logind: Interactive authentication required.\r\nFailed to open /dev/initctl: Permission denied\r\nFailed to talk to init daemon., Shared connection to node-js.atlascollege.nl closed.”, “rebooted”: false, “start”: “2021-02-17T15:19:44.622905”}

Hi there list,

I’ve been using anible to keep our Ubuntu systems up to date and do some minor maintenace like ensuring certain account are in place…

But I fail on rebooting the system when a reboot is required. And this frustrates me. I end up visiting every system to do the reboot manually.

So far I’ve tried 2 methods to get the system to reboot:

fatal: [node-js.atlascollege.nl]: FAILED! => {"changed": false, "elapsed": 0, "msg": "Reboot command failed. Error was
Failed to set wall message, ignoring: Interactive authentication required.\r\nFailed to call ScheduleShutdown in logind,
proceeding with immediate shutdown: Interactive authentication required.\r\nFailed to set wall message, ignoring:
Interactive authentication required.\r\nFailed to reboot system via logind: Interactive authentication
required.\r\nFailed to open /dev/initctl: Permission denied\r\nFailed to talk to init daemon., Shared connection to
node-js.atlascollege.nl closed.", "rebooted": false, "start": "2021-02-17T15:19:44.622905"}

Hi there list,

I've been using anible to keep our Ubuntu systems up to date and do some minor maintenace like ensuring certain account
are in place....

But I fail on rebooting the system when a reboot is required. And this frustrates me. I end up visiting every system to
do the reboot manually.

So far I've tried 2 methods to get the system to reboot:

---
- hosts: node-js.atlascollege.nl
tasks:
# - name: Reboot required?
# shell: /etc/update-motd.d/98-reboot-required
# register: reboot_required
#
- name: Reboot when reboot required
reboot:
# when: reboot_required|bool

# - debug: var=reboot_required.stdout_lines

As you can see I had a condition in place to check for a reboot required. But commented that out to take errors there
out of the equation.

This playbook fails with the following error:

fatal: [node-js.atlascollege.nl]: FAILED! => {"changed": false, "elapsed": 0, "msg": "Reboot command failed. Error was
Failed to set wall message, ignoring: Interactive authentication required.\r\nFailed to call ScheduleShutdown in logind,
proceeding with immediate shutdown: Interactive authentication required.\r\nFailed to set wall message, ignoring:
Interactive authentication required.\r\nFailed to reboot system via logind: Interactive authentication
required.\r\nFailed to open /dev/initctl: Permission denied\r\nFailed to talk to init daemon., Shared connection to
node-js.atlascollege.nl closed.", "rebooted": false, "start": "2021-02-17T15:19:44.622905"}

I don't see "become: yes" in your playbook, so it looks like Ansible simply tries to reboot as regular user.

Regards
         Racke

Thanks Racke… that indeed did the trick.
Kinda assumed the -K runtime option took care of that… was wrong :smiley: