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

ansible: restart ssh fails #19

Closed
gdha opened this issue Apr 28, 2017 · 2 comments
Closed

ansible: restart ssh fails #19

gdha opened this issue Apr 28, 2017 · 2 comments
Assignees
Labels

Comments

@gdha
Copy link
Owner

gdha commented Apr 28, 2017

The playbook ansible/common/roles/rear-test/tasks/update_sshd_config.yml contains:

- name: Restart ssh
  service: name=ssh state=restarted

to restart the SSH daemon after modifying the /etc/ssh/sshd_config
But, while running the playbook we get the following error:

TASK [rear-test : Update SSH configuration file - /etc/ssh/sshd_config] ********
ok: [client] => (item={u'regexp': u'^PasswordAuthentication', u'line': u'PasswordAuthentication yes'})
ok: [client] => (item={u'regexp': u'^UseDNS', u'line': u'UseDNS no'})

TASK [rear-test : Restart ssh] *************************************************
fatal: [client]: FAILED! => {"changed": false, "failed": true, "msg": "Could not find the requested service ssh: host"}
	to retry, use: --limit @/vagrant/ansible/common/vagrant-playbook.retry

PLAY RECAP *********************************************************************
client                     : ok=11   changed=4    unreachable=0    failed=1   

Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.
@gdha gdha added the bug label Apr 28, 2017
@gdha gdha self-assigned this Apr 28, 2017
@gdha
Copy link
Owner Author

gdha commented Apr 28, 2017

The solution was found on ansible/ansible-modules-core#1533:

- name: Restart ssh
  shell: sleep 3; systemctl restart sshd
  async: 1
  poll: 0

gdha added a commit that referenced this issue Apr 28, 2017
to fix issue #18
and changed the ssh restart lines for issue #19
@gdha gdha closed this as completed May 29, 2017
@WrzocHoo
Copy link

WrzocHoo commented Feb 4, 2019

There is no ssh service, it's name is sshd

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

No branches or pull requests

2 participants