Upgrading to Ansible 2.0 with Digital Ocean api v2 Issues - json

I have a working vagrant + ansible setup to provision my digital ocean, it was running on api v1, but when DO deprecated it I got an error message telling me there was no support for v1 anymore. After a research I found out I needed to upgrade to ansible 2.0 + update my digital_ocean.py since the older one was still using client_id and api_key, the new one however now uses the api_token.
Basically I've updated
1.digital_ocean.py which I got from ansible repo module
2. digital_ocean.ini to contain the api_token
3. updated my api token from DO to make sure it's using the new one
but when I execute my ansible playbook I initially got this error
ERROR! The file provisioning/inventory/staging/digital_ocean.py looks like it should be an executable inventory script, but is not marked executable. Perhaps you want to correct this with `chmod +x provisioning/inventory/staging/digital_ocean.py`?
So naturally had to chmod +x it but when I did I get a new error which is
ERROR! The file provisioning/inventory/staging/digital_ocean.py is marked as executable, but failed to execute correctly. If this is not supposed to be an executable script, correct this with `chmod -x provisioning/inventory/staging/digital_ocean.py`.
ERROR! Inventory script (provisioning/inventory/staging/digital_ocean.py) had an execution error:
ERROR! provisioning/inventory/staging/digital_ocean.py:3: Error parsing host definition ''''': No closing quotation
The next one seem to be json parsing related, my only problem is that it's on line 3 which if you check on the code itself are still on the comment side
https://raw.githubusercontent.com/ansible/ansible/devel/contrib/inventory/digital_ocean.py

I received both errors mentioned and solved them with the following:
The dopy related error was due to the fact that my python and pip were installed differently. dopy was installed via pip which was installed via homebrew. I was using the system python. When I installed python via homebrew, the script found dopy just fine.
Regarding the second error, that is the result I got when not setting the DO_API_TOKEN. I set mine in the command itself with:
DO_API_TOKEN=<api_token> ansible -i digital_ocean.py all -m ping

Related

Heroku cannot detect my node buildpack for app, but when setting buildpack in cli it says the heroku/nodejs is already set up on app?

I have tried deploying app through heroku through cli and through linking git repo, through the git repo I am now getting
! Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.
Detected build packs: Python, Node.js
However, when I try to uninstall python build pack as explained here (https://devcenter.heroku.com/articles/buildpacks) it says it can't be detected. When I try to install Node build pack it says it cannot be detected. But when I press deploy branch it runs the python pack since it is apparently the first build pack in the list.
I have tried making a requirement.txt file as noted in other answers but that took me from error in the post title to the error listed above with multiple packs

'ALGOLIA_API_KEY' not recognized as an internal or external command

I am trying to run algolia for the first time but it seems that there is something wrong with my environment. I followed the detailed explanation here https://community.algolia.com/jekyll-algolia/getting-started.html.
I installed and configured everything that is needed from the previous steps but when I run the command
ALGOLIA_API_KEY=xxxxxxxxxxxxxx bundle exec jekyll algolia
I get an error:
'ALGOLIA_API_KEY' is not recognized as an internal or external command,
operable program or batch file.
I have been rereading the documentation for both jekyll and angolia but couldn't find anything that could be helpful.
Since you're running on Windows, you cannot set an environment variable for your command like you can do on UNIX.
As advised in this question, Setting and using variable within same command line in Windows cmd.exe, I believe you could use
set ALGOLIA_API_KEY=xxxxxxxxxxxxxx && bundle exec jekyll algolia

Elastic Beanstalk stops at EbExtensionPostBuild

I am having a problem deploying an EB instance with a custom .ebextensions file. This is the relevant part in that file:
container_commands:
01_migrate:
command: 'python db_migrate.py'
02_npm_build:
command: 'npm install && npm run prod'
As you can see, these commands are for migrating my PostgreSQL database (via a Flask backend) and building my React .jsx files.
If I leave these commands out, the deployment completes perfectly well. However, once I put them in, looking at the eb-activity.log it stalls at this part forever (as far as I can tell):
[2017-04-10T02:39:24.106Z] INFO [3023] - [Application deployment app-613e-170409_223418#1/StartupStage0/EbExtensionPostBuild] : Starting activity...
I also get this message on the Health overview in the console (this is after 1 day):
Performing application deployment (running for 1 day).
I have also tried to deploy it without those container_commands, and then including it back after the successful initial deployment. Then I get the same error message as before in eb-activity.log, and I also get this message on the Health overview:
Incorrect application version "app-2a3d-170409_214923" (deployment 1). Expected version "app-2a3d-170409_214923" (deployment 1).
Which is very strange because those two versions referenced are the same versions. I don't know what this means!
I found a solution.
Remove all you container_commands from .ebextensions/
Go ssh to instance, kill process with.
sudo killall python
Then Deploy new version without container_commands.
And start debuging all your container_commands, one by one on ssh..
Have fun.

Error in AWS ElasticBeanStalk python 27 application that was running fine

I had an py27 application running on aws ElasticBeanStalk for over a year. Recently it stopped working. So I tried to redeploy. During redeploy I got the following error in the logs:
Return code: 1 Output: [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook/03deploy.py]
command failed with error code 1:
/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py
New python executable in /opt/python/run/venv/bin/python27
Not overwriting existing python script /opt/python/run/venv/bin/python
(you must use /opt/python/run/venv/bin/python27)
Can somebody tell me where I will find /opt/python/run/venv/bin/python? How can I change it to
/opt/python/run/venv/bin/python27?
Thanks
When you redeployed, you opted into the latest beanstalk version, which uses a different AMI than the one originally used. If you're familiar with the concept of ebextensions then you're probably looking to add a file like this:
.ebextensions/python.config:
ln -s /opt/python/run/venv/bin/python27 /opt/python/run/venv/bin/python

PreInstall script execution failed during installation using packagekmaker

I have created pkg using packageMaker. It contain preinstall and postnatal script along with other plugin files. when i am trying to install it, its get installation failed message. I did research and find that preinstall scripting is failing this installation.
But when i tried to run preinstall script from terminal. script is working without any error.
Looking for some help.
Go to the log (Cmd + L) after the installation fails and see which specific line of your postinstall script failed.
I was also facing this issue with my project installer. The installer for me was failing as there was some issue in my script.
In my preinstaller script which was a shell script, I had some command for which the command line argument length was exceeding the permitted length for a shell command.
I am not sure the issue with you is same or not but u can check that or you can change your script from shell to perl in case it is shell.