Closed dalanmiller closed 7 years ago
"Please, ensure that your API token is not read-only"
You token needs write permissions
Sorry forgot to mention @dguido, the API token is definitely not read-only.
No joke, there are sometimes weird errors we get intermittently with DigitalOcean that just go away when you run the installer again. Have you been able to get this error more than once?
Just did:
git reset --hard
pip install virtualenv && virtualenv env && source env/bin/activate && pip install -r requirements.txt
Now getting:
TASK [cloud-digitalocean : Creating a droplet...] ******************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: NameError: name 'basestring' is not defined
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "name 'basestring' is not defined"}
PLAY RECAP *********************************************************************
localhost : ok=8 changed=1 unreachable=0 failed=1
Should also mention I'm using Python 3.6.0?
You need Python 2
For posterity, this fixed it for me:
pip install virtualenv && virtualenv -p python2.7 env && source env/bin/activate && pip install -r requirements.txt
Great!
Hit this as well, the Python 2 requirement should really be stated up front.
Edit: granted, it's already stated.
OS / Environment
macOS 10.12.3
Ansible version
ansible --version ansible 2.2.0.0
Version of components from
requirements.txt
ansible==2.2.0.0 apache-libcloud==1.5.0 appdirs==1.4.3 asn1crypto==0.22.0 azure==2.0.0rc5 azure-batch==0.30.0rc5 azure-common==1.1.4 azure-graphrbac==0.30.0rc5 azure-mgmt==0.30.0rc5 azure-mgmt-authorization==0.30.0rc5 azure-mgmt-batch==0.30.0rc5 azure-mgmt-cdn==0.30.0rc5 azure-mgmt-cognitiveservices==0.30.0rc5 azure-mgmt-commerce==0.30.0rc5 azure-mgmt-compute==0.30.0rc5 azure-mgmt-keyvault==0.30.0rc5 azure-mgmt-logic==0.30.0rc5 azure-mgmt-network==0.30.0rc5 azure-mgmt-notificationhubs==0.30.0rc5 azure-mgmt-nspkg==1.0.0 azure-mgmt-powerbiembedded==0.30.0rc5 azure-mgmt-redis==0.30.0rc5 azure-mgmt-resource==0.30.0rc5 azure-mgmt-scheduler==0.30.0rc5 azure-mgmt-storage==0.30.0rc5 azure-mgmt-web==0.30.0rc5 azure-nspkg==1.0.0 azure-servicebus==0.20.2 azure-servicemanagement-legacy==0.20.3 azure-storage==0.32.0 boto==2.46.1 boto3==1.4.4 botocore==1.5.31 certifi==2017.1.23 cffi==1.10.0 chardet==2.3.0 cryptography==1.8.1 docutils==0.13.1 dopy==0.3.5 enum34==1.1.6 idna==2.5 isodate==0.5.4 Jinja2==2.8 jmespath==0.9.2 keyring==10.3.1 MarkupSafe==1.0 msrest==0.4.1 oauthlib==2.0.2 packaging==16.8 paramiko==2.1.2 pyasn1==0.2.3 pycparser==2.17 pycrypto==2.6.1 pyOpenSSL==16.2.0 pyparsing==2.2.0 python-dateutil==2.6.0 PyYAML==3.12 requests==2.13.0 requests-oauthlib==0.8.0 s3transfer==0.1.10 six==1.10.0
Summary of the problem
When trying to setup DO droplet, issue comes about when trying to delete existing Algo SSH keys.
Steps to reproduce the behavior
Unsure. Only behavior I've witnessed.
The way of deployment (cloud or local)
local
Expected behavior
Expected DO droplet to be spun up
Actual behavior
Dies when deleting previous keys.
Full log
TASK [setup] *** ok: [localhost]
TASK [Generate the SSH private key] **** ok: [localhost -> localhost]
TASK [Generate the SSH public key] ***** ok: [localhost -> localhost]
TASK [Change mode for the SSH private key] ***** ok: [localhost -> localhost]
TASK [Ensure the dynamic inventory exists] ***** ok: [localhost]
TASK [cloud-digitalocean : Set the DigitalOcean Access Token fact] ***** ok: [localhost]
TASK [cloud-digitalocean : Delete the existing Algo SSH keys] ** fatal: [localhost]: FAILED! => {"failed": true, "msg": "The conditional check 'ssh_keys.changed != true' failed. The error was: error while evaluating conditional (ssh_keys.changed != true): 'dict object' has no attribute 'changed'"}
TASK [cloud-digitalocean : Collect the fail error] ***** An exception occurred during task execution. To see the full traceback, use -vvv. The error was: dopy.manager.DoError: Unable to authenticate you. fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "Unable to authenticate you."} ...ignoring
TASK [cloud-digitalocean : debug] ** ok: [localhost] => { "ssh_keys": { "changed": false, "exception": "Traceback (most recent call last):\n File \"/var/folders/hg/flsstncd6bd1yx0r4p0ykvbr0000gp/T/ansible_g0zm57af/ansible_module_digital_ocean.py\", line 464, in main\n core(module)\n File \"/var/folders/hg/flsstncd6bd1yx0r4p0ykvbr0000gp/T/ansible_g0zm57af/ansible_module_digital_ocean.py\", line 417, in core\n key = SSH.find(name)\n File \"/var/folders/hg/flsstncd6bd1yx0r4p0ykvbr0000gp/T/ansible_g0zm57af/ansible_module_digital_ocean.py\", line 319, in find\n keys = cls.list_all()\n File \"/var/folders/hg/flsstncd6bd1yx0r4p0ykvbr0000gp/T/ansible_g0zm57af/ansible_module_digital_ocean.py\", line 327, in list_all\n json = cls.manager.all_ssh_keys()\n File \"/Users/dalanmiller/Repos/algo/env/lib/python3.6/site-packages/dopy/manager.py\", line 271, in all_ssh_keys\n json = self.request('/account/keys')\n File \"/Users/dalanmiller/Repos/algo/env/lib/python3.6/site-packages/dopy/manager.py\", line 424, in request\n resp = self.request_v2(url, params=params, headers=headers, method=method)\n File \"/Users/dalanmiller/Repos/algo/env/lib/python3.6/site-packages/dopy/manager.py\", line 482, in request_v2\n raise DoError(json['message'])\ndopy.manager.DoError: Unable to authenticate you.\n", "failed": true, "msg": "Unable to authenticate you." } }
TASK [cloud-digitalocean : fail] *** fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "Please, ensure that your API token is not read-only."}
PLAY RECAP ***** localhost : ok=8 changed=0 unreachable=0 failed=1