ansilbe delegate_to can not run

The task definition:

- name: add flannel network config in etcd
  shell: config_flannel_network.sh
  when: flannel_config_shell.changed
  delegate_to: "10.122.12.177"

software environment

  • ansible client
    host: 127.0.0.1
    system os: centos 7
    ansible version: 2.9.1
    python: python
  • target host
    host: 10.122.17.201
    system os: centos 8
    python: python3
  • delegate_to host
    host: 10.122.12.177
    system os: centos 7
    python: python

exec ansible task, error message:

TASK [flannel : add flannel network config in etcd] *************************************************************************************************
task path: /home/earthgod/workspaces/ansible-k8s-tst/ansible-roles-k8s/roles/flannel/tasks/main.yml:24                                               
fatal: [10.122.17.201 -> 10.122.12.177]: FAILED! => {"changed": false, "module_stderr": "BECOME-SUCCESS-uwkbocxpjaabqexywadrpcglwjsndvfs\r\n", "modul
e_stdout": "/bin/sh: /usr/bin/python3.6: No such file or directory\r\n", "msg": "The module failed to execute correctly, you probably need to set the
 interpreter.\nSee stdout/stderr for the exact error", "rc": 127}

There is no "/usr/bin/python3.6" installed at remote "10.122.12.177". Either
install it, or set "ansible_python_interpreter" to the version
already installed. For example in the inventory

  10.122.12.177 ansible_python_interpreter=/usr/bin/python2.7

Cheers,

  -vlado