seancallaway / rancher_ansible

Ansible Modules for Interacting with Rancher
MIT License
6 stars 1 forks source link

drain fail #7

Open andreas-theswede opened 2 years ago

andreas-theswede commented 2 years ago

Hi

I am getting the following error when using the drain function.

The drain start and completes, so it is only the "ansible job" which in indicating something went wrong. Unfortunately I am a terrible at python...

{
    "module_stdout": "/usr/lib/python3.6/site-packages/urllib3/connectionpool.py:847: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings\r\n  InsecureRequestWarning)\r\nTraceback (most recent call last):\r\n  File \"/home/ansible/.ansible/tmp/ansible-tmp-1643867344.0378213-97863888650931/AnsiballZ_rancher_node.org\", line 102, in <module>\r\n    _ansiballz_main()\r\n  File \"/home/ansible/.ansible/tmp/ansible-tmp-1643867344.0378213-97863888650931/AnsiballZ_rancher_node.org\", line 94, in _ansiballz_main\r\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n  File \"/home/ansible/.ansible/tmp/ansible-tmp-1643867344.0378213-97863888650931/AnsiballZ_rancher_node.org\", line 40, in invoke_module\r\n    runpy.run_module(mod_name='ansible.modules.rancher_node', init_globals=None, run_name='__main__', alter_sys=False)\r\n  File \"/usr/lib64/python3.6/runpy.py\", line 208, in run_module\r\n    return _run_code(code, {}, init_globals, run_name, mod_spec)\r\n  File \"/usr/lib64/python3.6/runpy.py\", line 85, in _run_code\r\n    exec(code, run_globals)\r\n  File \"/tmp/ansible_rancher_node_payload_dzj4hizb/ansible_rancher_node_payload.zip/ansible/modules/rancher_node.py\", line 176, in <module>\r\n  File \"/tmp/ansible_rancher_node_payload_dzj4hizb/ansible_rancher_node_payload.zip/ansible/modules/rancher_node.py\", line 168, in main\r\n  File \"/tmp/ansible_rancher_node_payload_dzj4hizb/ansible_rancher_node_payload.zip/ansible/modules/rancher_node.py\", line 50, in rancher_node_drained\r\n  File \"/tmp/ansible_rancher_node_payload_dzj4hizb/ansible_rancher_node_payload.zip/ansible/modules/rancher_node.py\", line 19, in get_node\r\nKeyError: 'pagination'\r\n",
    "module_stderr": "Shared connection to NODE.DOMAIN.ORG closed.\r\n",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1,
    "_ansible_no_log": false,
    "changed": false
}
seancallaway commented 2 years ago

I'm wondering if the Rancher API has changed. It looks like the pagination result wasn't returned by the API.

@andreas-theswede Please provide the version of Rancher you're using as well as the code for the task where this failed.

andreas-theswede commented 2 years ago

We are running rancher 2.6.2, @seancallaway

At the moment we run

- name: Drain Node
    ignore_errors: True
    rancher_node:
      name: '{{NODE}}'
      rancher_url: 'https://{{RANCHER_URL}}.domain.se'
      api_bearer_key: '{{API_KEY}}'
      force: true
      ignoreDaemonSets: true
      deleteLocalData: true
      state: drained

Then we wait for 60 sec and run this command which completes sucessfully

 - name: Drain Node
    rancher_node:
      name: '{{NODE}}'
      rancher_url: 'https://{{RANCHER_URL}}.domain.se'
      api_bearer_key: '{{API_KEY}}'
      force: true
      ignoreDaemonSets: true
      deleteLocalData: true
      state: drained
seancallaway commented 2 years ago

Interesting. I am going to see if the API has changed.