marinepi-provisioning icon indicating copy to clipboard operation
marinepi-provisioning copied to clipboard

Reboots not working in Ansible 2

Open joux3 opened this issue 8 years ago • 8 comments

setup.yml playbook successfully calls raspi-config to change the root partition size. However, for the change to work the device must be rebooted. The firstrun.sh should probably also take care of that? Or do some mounting magic. Your thoughts?

joux3 avatar Apr 22 '16 06:04 joux3

Current system should reboot at the end of the 'setup.yml', as 'expand_filesystem' notifies 'reboot'. Then again, I have a slightly related issue where password change makes authentication fail and palybook gets interrupted and no reboot...

Can you provide logs?

hkapanen avatar Apr 22 '16 07:04 hkapanen

https://github.com/ansible/ansible/issues/13485

tkurki avatar Apr 22 '16 07:04 tkurki

You are correct. Probably an ansible 2.x related issue? For now I'll just switch to older Ansible.

Logs at the default level (I can run more verbose logging if 2.x is ever to be supported):

marinepi-provisioning $ ./firstrun.sh 192.168.0.14

Removing 192.168.0.14 from ~/.ssh/known_hosts..


# Host 192.168.0.14 found: line 5
~/.ssh/known_hosts updated.
Original contents retained as ~/.ssh/known_hosts.old
SSH password: 
[DEPRECATION WARNING]: Instead of sudo/sudo_user, use become/become_user and make sure become_method is 'sudo' (default). This feature 
will be removed in a future release. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
Enter new password: 

PLAY ***************************************************************************

TASK [setup] *******************************************************************

paramiko: The authenticity of host '192.168.0.14' can't be established.
The ssh-rsa key fingerprint is xxxxxx.
Are you sure you want to continue connecting (yes/no)?
yes
ok: [192.168.0.14]

TASK [Create .ssh] *************************************************************
changed: [192.168.0.14]

TASK [Push SSH key to the Raspberry Pi] ****************************************
changed: [192.168.0.14]

TASK [Change default user password] ********************************************
changed: [192.168.0.14]

TASK [Expand filesystem] *******************************************************
changed: [192.168.0.14]

PLAY RECAP *********************************************************************
192.168.0.14               : ok=5    changed=4    unreachable=0    failed=0   

joux3 avatar Apr 22 '16 07:04 joux3

According to the Ansible issue tracker this should be fixed in 2.1 (but look at notes in the issue).

epleterte avatar Aug 10 '16 20:08 epleterte

Thanks @epleterte for the comment. See also https://github.com/ansible/ansible/issues/15117#issuecomment-226934783

Have you verified this yourself, maybe have a playbook to demonstrate?

tkurki avatar Aug 15 '16 18:08 tkurki

Hello,

I'm a beginner with Pi, and trying to install a MarinePi as instructed. So far, managed to get the Pi install running, install Ansible and create an SSH key on my own macbook. But it seems to have an issue with the install after that:

`MacBook-Pro-de-Nicolas:marinepi Nicolas$ ./firstrun.sh 192.168.1.117 SSH password: Enter new password:

PLAY [all] *********************************************************************

TASK [setup] ******************************************************************* ok: [192.168.1.117]

TASK [Create .ssh] ************************************************************* ok: [192.168.1.117]

TASK [Push SSH key to the Raspberry Pi] **************************************** ok: [192.168.1.117]

TASK [Change default user password] ******************************************** changed: [192.168.1.117]

TASK [Expand filesystem] ******************************************************* changed: [192.168.1.117]

TASK [Show IP Address] ********************************************************* ok: [192.168.1.117] => { "hostvars[inventory_hostname]['ansible_default_ipv4']['address']": "192.168.1.117" }

RUNNING HANDLER [reboot] ******************************************************* fatal: [192.168.1.117]: FAILED! => {"changed": false, "failed": true, "module_stderr": "", "module_stdout": "", "msg": "MODULE FAILURE"} ...ignoring

PLAY RECAP ********************************************************************* 192.168.1.117 : ok=7 changed=2 unreachable=0 failed=0 `

Any idea? thank you

ndelaet avatar Mar 02 '17 07:03 ndelaet

The reboot handler is not working properly, but everything is probably ok if you can ssh to your Pi and you can continue the provisioning.

PS. For quicker troubleshooting you might want to join Signal K Slack at http://slack-invite.signalk.org/

tkurki avatar Mar 02 '17 08:03 tkurki

A reboot module was introduced to Ansible 2.7. See PR #78 addressing this.

hkapanen avatar Mar 09 '20 19:03 hkapanen