Portál AbcLinuxu, 13. července 2025 21:07


Dotaz: Ansible v Debianu bookworm - něco je blbě

23.1.2024 20:56 pepa z depa
Ansible v Debianu bookworm - něco je blbě
Přečteno: 482×
Odpovědět | Admin
Ansible v Debianu bullseye funguje. Ansible v Debianu bookworm nefunguje. Úplně čistá instalace Debianu. Nainstalován ansible.
 # ansible -m ping localhost
localhost | SUCCESS => {
    "changed": false,
    "ping": "pong"
}

 # ansible -m ping ping
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: expected str, bytes or os.PathLike object, not list
ping | FAILED! => {
    "msg": "Unexpected failure during module execution: expected str, bytes or os.PathLike object, not list",
    "stdout": ""
}

 # ansible -vvv -m ping localhost
ansible [core 2.14.3]
  config file = /root/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True
Using /root/ansible.cfg as config file
host_list declined parsing /root/inventory/hosts as it did not pass its verify_file() method
script declined parsing /root/inventory/hosts as it did not pass its verify_file() method
auto declined parsing /root/inventory/hosts as it did not pass its verify_file() method
Parsed /root/inventory/hosts inventory source with ini plugin
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: root
<127.0.0.1> EXEC /bin/sh -c 'echo ~root && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp `"&& mkdir "` echo /root/.ansible/tmp/ansible-tmp-1706038709.331248-6096-81533437188582 `" && echo ansible-tmp-1706038709.331248-6096-81533437188582="` echo /root/.ansible/tmp/ansible-tmp-1706038709.331248-6096-81533437188582 `" ) && sleep 0'
Using module file /usr/lib/python3/dist-packages/ansible/modules/ping.py
<127.0.0.1> PUT /root/.ansible/tmp/ansible-local-6092fz92k0e1/tmp8x8vapcj TO /root/.ansible/tmp/ansible-tmp-1706038709.331248-6096-81533437188582/AnsiballZ_ping.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1706038709.331248-6096-81533437188582/ /root/.ansible/tmp/ansible-tmp-1706038709.331248-6096-81533437188582/AnsiballZ_ping.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/usr/bin/python3 /root/.ansible/tmp/ansible-tmp-1706038709.331248-6096-81533437188582/AnsiballZ_ping.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1706038709.331248-6096-81533437188582/ > /dev/null 2>&1 && sleep 0'
localhost | SUCCESS => {
    "changed": false,
    "invocation": {
        "module_args": {
            "data": "pong"
        }
    },
    "ping": "pong"
}

 # ansible -vvv -m ping ping
ansible [core 2.14.3]
  config file = /root/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True
Using /root/ansible.cfg as config file
host_list declined parsing /root/inventory/hosts as it did not pass its verify_file() method
script declined parsing /root/inventory/hosts as it did not pass its verify_file() method
auto declined parsing /root/inventory/hosts as it did not pass its verify_file() method
Parsed /root/inventory/hosts inventory source with ini plugin
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.
<127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: root
The full traceback is:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/ansible/executor/task_executor.py", line 158, in run
    res = self._execute()
          ^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/ansible/executor/task_executor.py", line 633, in _execute
    result = self._handler.run(task_vars=vars_copy)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/ansible/plugins/action/normal.py", line 47, in run
    result = merge_hash(result, self._execute_module(task_vars=task_vars, wrap_async=wrap_async))
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/ansible/plugins/action/__init__.py", line 1040, in _execute_module
    self._make_tmp_path()
  File "/usr/lib/python3/dist-packages/ansible/plugins/action/__init__.py", line 457, in _make_tmp_path
    tmpdir = self._remote_expand_user(self.get_shell_option('remote_tmp', default='~/.ansible/tmp'), sudoable=False)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/ansible/plugins/action/__init__.py", line 923, in _remote_expand_user
    data = self._low_level_execute_command(cmd, sudoable=False)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/ansible/plugins/action/__init__.py", line 1320, in _low_level_execute_command
    rc, stdout, stderr = self._connection.exec_command(cmd, in_data=in_data, sudoable=sudoable)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/ansible/plugins/connection/ssh.py", line 1329, in exec_command
    cmd = self._build_command(ssh_executable, 'ssh', *args)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/ansible/plugins/connection/ssh.py", line 733, in _build_command
    b_args = (b"-o", b'IdentityFile="' + to_bytes(os.path.expanduser(key), errors='surrogate_or_strict') + b'"')
                                                  ^^^^^^^^^^^^^^^^^^^^^^^
  File "(frozen posixpath)", line 232, in expanduser
TypeError: expected str, bytes or os.PathLike object, not list
ping | FAILED! => {
    "msg": "Unexpected failure during module execution: expected str, bytes or os.PathLike object, not list",
    "stdout": ""
}

 # cat ansible.cfg 
[defaults]
inventory=~/inventory

 # ls -Rl ~/inventory/
/root/inventory/:
total 4
-rw-r--r-- 1 root root  5 Jan 23 20:10 hosts
drwxr-xr-x 2 root root 60 Jan 23 20:30 host_vars

/root/inventory/host_vars:
total 4
-rw-r--r-- 1 root root 139 Jan 23 20:12 ping.yml

 # cat ~/inventory/hosts 
ping

 # cat ~/inventory/host_vars/ping.yml 
---
ansible_connection: ssh
ansible_port: 22
ansible_user: root
ansible_ssh_private_key_file:
  - ~/.ssh/id_rsa

ansible_host: '127.0.0.1'


Nevygooglil jsem, co dělám špatně.
Nástroje: Začni sledovat (0) ?Zašle upozornění na váš email při vložení nového komentáře.

Odpovědi

23.1.2024 21:03 pepa z depa
Rozbalit Rozbalit vše Re: Ansible v Debianu bookworm - něco je blbě
Odpovědět | | Sbalit | Link | Blokovat | Admin
Ach můj Bóže... Už to vidím. Stačí napsat do diskuse a je to.

Nicméně, dřív to fungovalo.
24.1.2024 07:17 trello
Rozbalit Rozbalit vše Re: Ansible v Debianu bookworm - něco je blbě
A co je teda blbě?
24.1.2024 10:09 pepa z depa
Rozbalit Rozbalit vše Re: Ansible v Debianu bookworm - něco je blbě
Blbě je tohle:
"Unexpected failure during module execution: expected str, bytes or os.PathLike object, not list",
Takže:
 # cat ~/inventory/host_vars/ping.yml 
---
ansible_connection: ssh
ansible_port: 22
ansible_user: root
ansible_ssh_private_key_file: ~/.ssh/id_rsa
ansible_host: '127.0.0.1'
24.1.2024 10:32 X
Rozbalit Rozbalit vše Re: Ansible v Debianu bookworm - něco je blbě
Presneji kdyz se podivas na ten traceback:
File "/usr/lib/python3/dist-packages/ansible/plugins/connection/ssh.py", line 733, in _build_command
    b_args = (b"-o", b'IdentityFile="' + to_bytes(os.path.expanduser(key), errors='surrogate_or_strict') + b'"')
                                                  ^^^^^^^^^^^^^^^^^^^^^^^
Tak to ma problem natahnout soubor s klicem.

Založit nové vláknoNahoru

Tiskni Sdílej: Linkuj Jaggni to Vybrali.sme.sk Google Del.icio.us Facebook

ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.