Summary
Running cf I keep getting Error details: code: 6003, error: Invalid request headers; code: 6103, error: Invalid format for X-Auth-Key header; '
I am using vault for keys, but that works and I have tried unencrypted too
Issue Type
Bug Report
Component Name
cloudflare_dns
Ansible Version
$ ansible --version
ansible [core 2.12.2]
Community.general Version
$ ansible-galaxy collection list community.general
community.general 5.4.0
Configuration
$ ansible-config dump --only-changed
DEFAULT_ASK_VAULT_PASS(/home/gilesr/ansible/Infrastructure/ansible.cfg) = False
DEFAULT_FORKS(/home/gilesr/ansible/Infrastructure/ansible.cfg) = 15
DEFAULT_HOST_LIST(/home/gilesr/ansible/Infrastructure/ansible.cfg) = ['/home/gilesr/ansible/Infrastructure/inventory/hosts']
DEFAULT_LOAD_CALLBACK_PLUGINS(/home/gilesr/ansible/Infrastructure/ansible.cfg) = True
DEFAULT_NO_TARGET_SYSLOG(/home/gilesr/ansible/Infrastructure/ansible.cfg) = True
DEFAULT_STDOUT_CALLBACK(/home/gilesr/ansible/Infrastructure/ansible.cfg) = yaml
DEFAULT_TIMEOUT(/home/gilesr/ansible/Infrastructure/ansible.cfg) = 30
INTERPRETER_PYTHON(/home/gilesr/ansible/Infrastructure/ansible.cfg) = /usr/bin/python3
INVENTORY_ENABLED(/home/gilesr/ansible/Infrastructure/ansible.cfg) = ['ini']
RETRY_FILES_ENABLED(/home/gilesr/ansible/Infrastructure/ansible.cfg) = False
VARIABLE_PLUGINS_ENABLED(/home/gilesr/ansible/Infrastructure/ansible.cfg) = ['host_group_vars', 'community.sops.sops']
OS / Environment
Ubuntu 20.04
Steps to Reproduce
- name: Create a test A record to point to 127.0.0.1
community.general.cloudflare_dns:
zone:
record: test
type: A
value: 127.0.0.1
account_email: '{{ cflare_tokens.acc_email }}'
account_api_key: '{{ cflare_tokens.api_token }}'
register: record
Expected Results
Expect the zone to get a record test pointing to 127.0.0.1
Actual Results
ESTABLISH SSH CONNECTION FOR USER: None
SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=600s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=30 -o 'ControlPath="~/.ssh/sockets/ansible-ssh-%C"' localhost '/bin/sh -c '"'"'echo ~ && sleep 0'"'"''
(0, b'/home/gilesr\n', b'')
ESTABLISH SSH CONNECTION FOR USER: None
SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=600s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=30 -o 'ControlPath="~/.ssh/sockets/ansible-ssh-%C"' localhost '/bin/sh -c '"'"'( umask 77 && mkdir -p "echo /home/gilesr/.ansible/tmp
"&& mkdir "echo /home/gilesr/.ansible/tmp/ansible-tmp-1659437037.6980214-139314-242106425287596
" && echo ansible-tmp-1659437037.6980214-139314-242106425287596="echo /home/gilesr/.ansible/tmp/ansible-tmp-1659437037.6980214-139314-242106425287596
" ) && sleep 0'"'"''
(0, b'ansible-tmp-1659437037.6980214-139314-242106425287596=/home/gilesr/.ansible/tmp/ansible-tmp-1659437037.6980214-139314-242106425287596\n', b'')
redirecting (type: modules) community.general.cloudflare_dns to community.general.net_tools.cloudflare_dns
Using module file /home/gilesr/.ansible/collections/ansible_collections/community/general/plugins/modules/net_tools/cloudflare_dns.py
PUT /home/gilesr/.ansible/tmp/ansible-local-139283peiolve9/tmprdv8_tcn TO /home/gilesr/.ansible/tmp/ansible-tmp-1659437037.6980214-139314-242106425287596/AnsiballZ_cloudflare_dns.py
SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=600s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=30 -o 'ControlPath="~/.ssh/sockets/ansible-ssh-%C"' '[localhost]'
(0, b'sftp> put /home/gilesr/.ansible/tmp/ansible-local-139283peiolve9/tmprdv8_tcn /home/gilesr/.ansible/tmp/ansible-tmp-1659437037.6980214-139314-242106425287596/AnsiballZ_cloudflare_dns.py\n', b'')
ESTABLISH SSH CONNECTION FOR USER: None
SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=600s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=30 -o 'ControlPath="~/.ssh/sockets/ansible-ssh-%C"' localhost '/bin/sh -c '"'"'chmod u+x /home/gilesr/.ansible/tmp/ansible-tmp-1659437037.6980214-139314-242106425287596/ /home/gilesr/.ansible/tmp/ansible-tmp-1659437037.6980214-139314-242106425287596/AnsiballZ_cloudflare_dns.py && sleep 0'"'"''
(0, b'', b'')
ESTABLISH SSH CONNECTION FOR USER: None
SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=600s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=30 -o 'ControlPath="~/.ssh/sockets/ansible-ssh-%C"' -tt localhost '/bin/sh -c '"'"'/usr/bin/python3 /home/gilesr/.ansible/tmp/ansible-tmp-1659437037.6980214-139314-242106425287596/AnsiballZ_cloudflare_dns.py && sleep 0'"'"''
(1, b'\r\n{"failed": true, "msg": "API bad request; Status: 400; Method: GET: Call: /zones?name= VALUE_SPECIFIED_IN_NO_LOG_PARAMETER; Error details: code: 6003, error: Invalid request headers; code: 6103, error: Invalid format for X-Auth-Key header; ", "invocation": {"module_args": {"zone": " VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "record": "test", "type": "A", "value": "127.0.0.1", "account_email": " VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "account_api_key": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "priority": 1, "proxied": false, "state": "present", "timeout": 30, "ttl": 1, "weight": 1, "api_token": null, "algorithm": null, "cert_usage": null, "hash_type": null, "key_tag": null, "port": null, "proto": null, "selector": null, "service": null, "solo": null}}}\r\n', b'Shared connection to localhost closed.\r\n')
Failed to connect to the host via ssh: Shared connection to localhost closed.
ESTABLISH SSH CONNECTION FOR USER: None
SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=600s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=30 -o 'ControlPath="~/.ssh/sockets/ansible-ssh-%C"' localhost '/bin/sh -c '"'"'rm -f -r /home/gilesr/.ansible/tmp/ansible-tmp-1659437037.6980214-139314-242106425287596/ > /dev/null 2>&1 && sleep 0'"'"''
(0, b'', b'')
fatal: [localhost]: FAILED! => changed=false
invocation:
module_args:
account_api_key: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
account_email: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
algorithm: null
api_token: null
cert_usage: null
hash_type: null
key_tag: null
port: null
priority: 1
proto: null
proxied: false
record: giles-test
selector: null
service: null
solo: null
state: present
timeout: 30
ttl: 1
type: A
value: 127.0.0.1
weight: 1
zone: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
msg: 'API bad request; Status: 400; Method: GET: Call: /zones?name=; Error details: code: 6003, error: Invalid request headers; code: 6103, error: Invalid format for X-Auth-Key header; '
Code of Conduct
- [X] I agree to follow the Ansible Code of Conduct
Files identified in the description:
If these files are incorrect, please update the component name
section of the description or use the !component
bot command.
click here for bot help
This is happening to me as well.
Alright I figured my issue out. I was confused between tokens and keys. Tokens don't need an email address but keys do (which seems backwards to me but that's what it is). And tokens are the preferred ones to use as well. I got a token and then was able to make it work.
ahhhh that got it....
I tried every combo, looks like if you set the email and token it upsets it too....
so email+key OR token on its own...dont set email and token
Files identified in the description:
If these files are incorrect, please update the component name
section of the description or use the !component
bot command.
click here for bot help