IBM / ansible-for-i

the tool is to provide several customized modules for Ansible to manage IBM i systems.
GNU General Public License v3.0
55 stars 53 forks source link

Incorrect sample to start SSH service using ibmi_tcp_server_service module? #164

Closed syahrul-aiman closed 7 months ago

syahrul-aiman commented 11 months ago

Hi team

Looking at the following module: https://github.com/IBM/ansible-for-i/blob/devel/plugins/modules/ibmi_tcp_server_service.py

This is the example task given:

- name: start tcp server service
  ibmi_ibm.power_ibmi.ibmi_tcp_server_service:
    name_list: ['*SSH', '*HTTP']
    state: 'started'
    joblog: True

I'm a bit confused on this sample given as the connection to the IBMi node is via SSH. So how is this module being executed if the SSH service has not been started?

Am I missing something?

Thanks!

robgjertsen1 commented 11 months ago

This example for ibmi_tcp_server_service is incorrect to include ssh in the list for starting a service. That needs to be performed outside of an ansible command. Probably fine to stop the ssh service this way. Documentation should remove this from the name_list and could add something else like *DIRSRV .

syahrul-aiman commented 11 months ago

Hi @robgjertsen1,

Thank you so much for clarifying this. This makes more sense.

Thanks again and have a nice day!

krka01 commented 11 months ago

@syahrul-aiman @robgjertsen1 The sample is correct, it is possible to stop and start the SSHD daemon from the same ssh connection as stopping the SSHD will not end active ssh connections.

We use the ibmi_ibm.power_ibmi.ibmi_tcp_server_service to both stop and then start the SSHD in the same playbook after we have installed PTFs for the SSH server or modify the sshd_config file and it works perfectly fine.

I wish all TCP servers worked this way.

robgjertsen1 commented 11 months ago

Thanks for pointing out your use case with using the same playbook for stopping and starting ssh for update of sshd. I haven't tried this yet, but makes sense that active ssh connection is maintained. It would probably be helpful to point this out in the documentation versus the isolated code snippet for starting ssh.

robgjertsen1 commented 7 months ago

Fixed with release 2.0.1.