|
23 | 23 | Content-Type: application/json
|
24 | 24 | Authorization: Bearer {{ algo_do_token }}
|
25 | 25 | register: _do_regions
|
26 |
| - no_log: true |
| 26 | + no_log: "{{ algo_no_log | default(true) }}" |
| 27 | + failed_when: false |
| 28 | + |
| 29 | +- name: Check DigitalOcean API response |
| 30 | + fail: |
| 31 | + msg: | |
| 32 | + {% if _do_regions.status == 401 %} |
| 33 | + DigitalOcean API authentication failed (401 Unauthorized) |
| 34 | +
|
| 35 | + Your API token is invalid or expired. Please: |
| 36 | + 1. Go to https://cloud.digitalocean.com/settings/api/tokens |
| 37 | + 2. Create a new token with 'Read' and 'Write' scopes |
| 38 | + 3. Run the deployment again with the new token |
| 39 | +
|
| 40 | + {% elif _do_regions.status == 403 %} |
| 41 | + DigitalOcean API access denied (403 Forbidden) |
| 42 | +
|
| 43 | + Your API token lacks required permissions. Please: |
| 44 | + 1. Go to https://cloud.digitalocean.com/settings/api/tokens |
| 45 | + 2. Ensure your token has both 'Read' and 'Write' scopes |
| 46 | + 3. Consider creating a new token with full access |
| 47 | +
|
| 48 | + {% elif _do_regions.status == 429 %} |
| 49 | + DigitalOcean API rate limit exceeded (429 Too Many Requests) |
| 50 | +
|
| 51 | + You've hit the API rate limit. Please: |
| 52 | + 1. Wait 5-10 minutes before retrying |
| 53 | + 2. Check if other applications are using your token |
| 54 | +
|
| 55 | + {% elif _do_regions.status == 500 or _do_regions.status == 502 or _do_regions.status == 503 %} |
| 56 | + DigitalOcean API server error ({{ _do_regions.status }}) |
| 57 | +
|
| 58 | + DigitalOcean is experiencing issues. Please: |
| 59 | + 1. Check https://status.digitalocean.com for outages |
| 60 | + 2. Wait a few minutes and try again |
| 61 | +
|
| 62 | + {% elif _do_regions.status is undefined %} |
| 63 | + Failed to connect to DigitalOcean API |
| 64 | +
|
| 65 | + Could not reach api.digitalocean.com. Please check: |
| 66 | + 1. Your internet connection |
| 67 | + 2. Firewall rules (port 443 must be open) |
| 68 | + 3. DNS resolution for api.digitalocean.com |
| 69 | +
|
| 70 | + {% else %} |
| 71 | + DigitalOcean API error (HTTP {{ _do_regions.status }}) |
| 72 | +
|
| 73 | + An unexpected error occurred. Please: |
| 74 | + 1. Verify your API token at https://cloud.digitalocean.com/settings/api/tokens |
| 75 | + 2. Check https://status.digitalocean.com for service issues |
| 76 | + {% endif %} |
| 77 | +
|
| 78 | + For detailed error messages: Set 'algo_no_log: false' in config.cfg and run again |
| 79 | + when: _do_regions.status != 200 |
27 | 80 |
|
28 | 81 | - name: Set facts about the regions
|
29 | 82 | set_fact:
|
|
0 commit comments