tkurki / marinepi-provisioning

Ansible provisioning scripts to set up a Raspberry Pi for marine use
Apache License 2.0
45 stars 22 forks source link

Reboots not working in Ansible 2 #16

Open joux3 opened 8 years ago

joux3 commented 8 years ago

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?

hkapanen commented 8 years ago

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?

tkurki commented 8 years ago

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

joux3 commented 8 years ago

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   
epleterte commented 8 years ago

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

tkurki commented 8 years ago

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?

ndelaet commented 7 years ago

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

tkurki commented 7 years ago

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/

hkapanen commented 4 years ago

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