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

Reboots not working in Ansible 2 #16

Open
joux3 opened this issue Apr 22, 2016 · 8 comments
Open

Reboots not working in Ansible 2 #16

joux3 opened this issue Apr 22, 2016 · 8 comments

Comments

@joux3
Copy link
Collaborator

joux3 commented Apr 22, 2016

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
Copy link
Collaborator

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 tkurki changed the title firstrun.sh doesn't reboot the Pi after potentially changing root partition size Reboots not working in Ansible 2 Apr 22, 2016
@tkurki
Copy link
Owner

tkurki commented Apr 22, 2016

ansible/ansible#13485

@joux3
Copy link
Collaborator Author

joux3 commented Apr 22, 2016

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
Copy link

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

@tkurki
Copy link
Owner

tkurki commented Aug 15, 2016

Thanks @epleterte for the comment. See also ansible/ansible#15117 (comment)

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

@ndelaet
Copy link

ndelaet commented Mar 2, 2017

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
Copy link
Owner

tkurki commented Mar 2, 2017

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
Copy link
Collaborator

hkapanen commented Mar 9, 2020

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

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

No branches or pull requests

5 participants