maxhoesel-ansible / ansible-collection-smallstep

Unofficial Ansible Collection for Smallstep CLI and the step-ca server
https://github.com/smallstep
GNU General Public License v3.0
72 stars 21 forks source link

Get latest step-ca release information: http.client.IncompleteRead: IncompleteRead(163840 bytes read) #387

Open patsevanton opened 6 months ago

patsevanton commented 6 months ago

Hello! Thanks for ansible collection i try ca init and get error:

Install

ansible-galaxy collection install maxhoesel.smallstep>=0.25.2,0.26.0
ansible-playbook -i inventory.yml ca.yml

My ca.yaml

- hosts: step_ca
  become: yes
  tasks:
    # Install and initialize the CA server.
    # There are a lot of configuration options, see the step_ca README for details
    - name: Install step-ca
      include_role:
        name: maxhoesel.smallstep.step_ca
      vars:
        step_ca_name: Foobar Internal CA
        step_ca_root_password: "incredibly secret password"
        step_ca_intermediate_password: "very secret password"

Inventory:

all:
  children:
    freipa-ca:
      hosts:
        "step_ca":
          ansible_host: "158.160.23.154"
  vars:
    ansible_user:  ubuntu
    ansible_ssh_private_key_file: ~/.ssh/id_rsa

Get error:

TASK [maxhoesel.smallstep.step_ca : Get latest step-ca release information] **********************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: http.client.IncompleteRead: IncompleteRead(163840 bytes read)
fatal: [step_ca -> localhost]: FAILED! => changed=false 
  module_stderr: |-
    Traceback (most recent call last):
      File "/usr/lib/python3.11/http/client.py", line 566, in _get_chunk_left
        chunk_left = self._read_next_chunk_size()
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3.11/http/client.py", line 533, in _read_next_chunk_size
        return int(line, 16)
               ^^^^^^^^^^^^^
    ValueError: invalid literal for int() with base 16: b''

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/usr/lib/python3.11/http/client.py", line 583, in _read_chunked
        chunk_left = self._get_chunk_left()
                     ^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3.11/http/client.py", line 568, in _get_chunk_left
        raise IncompleteRead(b'')
    http.client.IncompleteRead: IncompleteRead(0 bytes read)

    The above exception was the direct cause of the following exception:

    Traceback (most recent call last):
      File "/home/user/.ansible/tmp/ansible-tmp-1709357526.7043033-12303-56592882932893/AnsiballZ_uri.py", line 107, in <module>
        _ansiballz_main()
      File "/home/user/.ansible/tmp/ansible-tmp-1709357526.7043033-12303-56592882932893/AnsiballZ_uri.py", line 99, in _ansiballz_main
        invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
      File "/home/user/.ansible/tmp/ansible-tmp-1709357526.7043033-12303-56592882932893/AnsiballZ_uri.py", line 47, in invoke_module
        runpy.run_module(mod_name='ansible.modules.uri', init_globals=dict(_module_fqn='ansible.modules.uri', _modlib_path=modlib_path),
      File "<frozen runpy>", line 226, in run_module
      File "<frozen runpy>", line 98, in _run_module_code
      File "<frozen runpy>", line 88, in _run_code
      File "/tmp/ansible_ansible.legacy.uri_payload_258mirj0/ansible_ansible.legacy.uri_payload.zip/ansible/modules/uri.py", line 794, in <module>
      File "/tmp/ansible_ansible.legacy.uri_payload_258mirj0/ansible_ansible.legacy.uri_payload.zip/ansible/modules/uri.py", line 724, in main
      File "/usr/lib/python3.11/http/client.py", line 460, in read
        return self._read_chunked(amt)
               ^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3.11/http/client.py", line 598, in _read_chunked
        raise IncompleteRead(b''.join(value)) from exc
    http.client.IncompleteRead: IncompleteRead(163840 bytes read)
  module_stdout: ''
  msg: |-
    MODULE FAILURE
    See stdout/stderr for the exact error
  rc: 1
maxhoesel commented 5 months ago

Hi, I tried to reproduce this locally, but wasn't able to do so. Are you still encountering this error and can you reproduce it reliably? IncompleteRead suggests it might be a networking/TCP error, but i'm not entirely sure.

patsevanton commented 4 months ago

I remove and create more time instance with same ip. I think github block my ip for few minutes.