Cyclosible is a project backed by Cycloid in order to manage Ansible with a REST API.
The goal of Cyclosible is to be a lightweight application opensourced as a free alternative to Ansible Tower.
Cyclosible is used internally at Cycloid to let our customers use their own CI and interact with our deployment stack.
Cyclosible is built upon these technologies:
To start with Cyclosible, you will need to install redis. For this we suggest to create a redis docker container
First, install virtualenv:
sudo pip install virtualenv
sudo pip install virtualenvwrapper
Then, create the virtualenv:
mkvirtualenv cyclosible27 --no-site-packages -p /usr/bin/python2.7
I suggest here to install python 2.7 as ansible does not support python 3 yet.
Now, to work in your virtual environment, you can enable it with:
workon cyclosible27
You will need to clone this repository. Then you will be able to install the requirements:
pip install cyclosible
When you activate your virtual environment, you should be able to use cyclosible
script:
which cyclosible
S3 bucket is optional if you enable the S3 storage plugin.
You will need to activate the Website Hosting on your S3 bucket, and apply this permission (where cycloid-cyclosible is the name of your bucket):
{
"Version":"2012-10-17",
"Statement":[{
"Sid":"PublicReadGetObject",
"Effect":"Allow",
"Principal": "*",
"Action":["s3:GetObject"],
"Resource":["arn:aws:s3:::cycloid-cyclosible/*"
]
}
]
}
By default, there is some fields pre-configured in the cyclosible/Cyclosible/settings.py
file.
To make things easier to configure and to not loose your modifications after an upgrade of the package, you can override these settings providing your own settings file.
For this, create an environment variable named CYCLOSIBLE_CONFIG
and point it to your settings file, for example in /etc/cyclosible/settings.py
.
Now you just have top copy the content from the settings.py to your custom settings.py.
Before starting the application, we need to create the database. You can also configure the DATABASE settings, by default it will create a SQLite3 database. Please refer to the django website (link is above this parameter) to configure it correctly.
Then, apply the schema:
CYCLOSIBLE_CONFIG=/etc/cyclosible/settings.py cyclosible migrate
It will populate the database. Then you need to create a superuser:
CYCLOSIBLE_CONFIG=/etc/cyclosible/settings.py cyclosible createsuperuser
The best way to run the application on production is to use supervisord.
There are 3 applications to start :
- This one will start the webserver (DEV mode):
CYCLOSIBLE_CONFIG=/etc/cyclosible/settings.py cyclosible runserver
- This one will start the worker which will run the playbook:
CYCLOSIBLE_CONFIG=/etc/cyclosible/settings.py cyclosible celery worker
- This one will check if there are some tasks ton run on crontabs (actually optional):
CYCLOSIBLE_CONFIG=/etc/cyclosible/settings.py cyclosible celery beat
Now you should be able to connect on the admin interface: http://<yourip>:8000/admin/
All unit tests are run with tox:
pip install tox
Then, run tox at the root of the project:
tox