## auton project
[](https://pypi.org/project/auton/)
[](https://pypi.org/project/auton/)
[](https://hub.docker.com/r/decryptus/auton)
[](https://auton.readthedocs.io/)
auton is a free and open-source, we develop it to run programs and command-lines on remote servers through HTTP protocol.
There are two programs, auton for client side and autond for server side.
auton is just a helper to transform command-lines into HTTP protocol, it is able to transform basic arguments, file arguments and environment variables.
For example, you can use auton from CI/CD to run on remote servers, you just need to configure your endpoints:
- [ansible](https://github.com/ansible/ansible)
- [curl](https://github.com/curl/curl)
- [terraform](https://github.com/hashicorp/terraform)
You can also use auton if you need to execute a new version of a software but you can't install it on a legacy server
or tests programs execution.
## Quickstart
Using autond in Docker
`docker-compose up -d`
See [docker-compose.yml](docker-compose.yml)
## Installation
### autond for server side
`pip install autond`
### auton for client side
`pip install auton`
## Environment variables
### autond
| Variable | Description | Default |
|:-----------------|:----------------------------|:--------|
| `AUTOND_CONFIG` | Configuration file contents<br />(e.g. `export AUTOND_CONFIG="$(cat auton.yml)"`) | |
| `AUTOND_LOGFILE` | Log file path | /var/log/autond/daemon.log |
| `AUTOND_PIDFILE` | autond pid file path | /run/auton/autond.pid |
| `AUTON_GROUP` | auton group | auton or root |
| `AUTON_USER` | auton user | auton or root |
### auton
| Variable | Description | Default |
|:-----------------------|:----------------------------|:--------|
| `AUTON_AUTH_USER` | user for authentication | <span/> |
| `AUTON_AUTH_PASSWD` | password for authentication | <span/> |
| `AUTON_ENDPOINT` | name of endpoint | <span/> |
| `AUTON_LOGFILE` | Log file path | /var/log/auton/auton.log |
| `AUTON_NO_RETURN_CODE` | Do not exit with return code if present | False |
| `AUTON_UID` | auton job uid | random uuid |
| `AUTON_URI` | autond URI(s)<br />(e.g. http://auton-01.example.org:8666,http://auton-02.example.org:8666) | <span/> |
## Autond configuration
See configuration example [etc/auton/auton.yml.example](etc/auton/auton.yml.example)
### Endpoints
In this example, we declared three endpoints: ansible-playbook-ssh, ansible-playbook-http, curl.
They used subproc plugin.
```yaml
endpoints:
ansible-playbook-ssh:
plugin: subproc
config:
prog: ansible-playbook
timeout: 3600
args:
- '/etc/ansible/playbooks/ssh-install.yml'
- '--tags'
- 'sshd'
become:
enabled: true
env:
DISPLAY_SKIPPED_HOSTS: 'false'
ansible-playbook-http:
plugin: subproc
config:
prog: ansible-playbook
timeout: 3600
args:
- '/etc/ansible/playbooks/http-install.yml'
- '--tags'
- 'httpd'
become:
enabled: true
env:
DISPLAY_SKIPPED_HOSTS: 'false'
curl:
plugin: subproc
config:
prog: curl
timeout: 3600
```
### Authentication
To enable authentication, you must add `auth_basic` and `auth_basic_file` lines in section `general`:
```yaml
auth_basic: 'Restricted'
auth_basic_file: '/etc/auton/auton.passwd'
```
Use `htpasswd` to generate `auth_basic_file`:
`htpasswd -c -s /etc/auton/auton.passwd foo`
And you have to add for each modules route `auth: true`:
```yaml
modules:
job:
routes:
run:
handler: 'job_run'
regexp: '^run/(?P<endpoint>[^\/]+)/(?P<id>[a-z0-9][a-z0-9\-]{7,63})$'
safe_init: true
auth: true
op: 'POST'
status:
handler: 'job_status'
regexp: '^status/(?P<endpoint>[^\/]+)/(?P<id>[a-z0-9][a-z0-9\-]{7,63})$'
auth: true
op: 'GET'
```
Use section `users` to specify users allowed by endpoint:
```yaml
ansible-playbook-ssh:
plugin: subproc
users:
maintainer: true
bob: true
config:
prog: ansible-playbook
timeout: 3600
args:
- '/etc/ansible/playbooks/ssh-install.yml'
- '--tags'
- 'sshd'
become:
enabled: true
env:
DISPLAY_SKIPPED_HOSTS: 'false'
```
### Plugin subproc
subproc plugin executes programs with python `subprocess`.
Predefined AUTON environment variables during execution:
| Variable | Description |
|:-------------------|:----------------------------------------------|
| `AUTON` | Mark the job is executed in AUTON environment |
| `AUTON_JOB_TIME` | Current time in local time zone |
| `AUTON_JOB_GMTIME` | Current time in GMT |
| `AUTON_JOB_UID` | Current job uid passed from client |
| `AUTON_JOB_UUID` | Unique ID of the current job |
Use keyword `prog` to specify program path:
```yaml
endpoints:
curl:
plugin: subproc
config:
prog: curl
```
Use keyword `workdir` to change the working directory:
```yaml
endpoints:
curl:
plugin: subproc
config:
prog: curl
workdir: somedir/
```
Use keyword `search_paths` to specify paths to search `prog`:
```yaml
endpoints:
curl:
plugin: subproc
config:
prog: curl
search_paths:
- /usr/local/bin
- /usr/bin
- /bin
```
Use section `become` to execute with an other user:
```yaml
endpoints:
curl:
plugin: subproc
config:
prog: curl
become:
enabled: true
user: foo
```
Use keyword `timeout` to raise an exception after n seconds (default: 60 seconds):
```yaml
endpoints:
curl:
plugin: subproc
config:
prog: curl
timeout: 3600
```
Use section `args` to define arguments always present:
```yaml
endpoints:
curl:
plugin: subproc
config:
prog: curl
args:
- '-s'
- '-4'
```
Use keyword `disallow-args` to disable arguments from client:
```yaml
endpoints:
curl:
plugin: subproc
config:
prog: curl
args:
- '-vvv'
- 'https://example.com'
disallow-args: true
```
Use section `argfiles` to define arguments files always present:
```yaml
endpoints:
curl:
plugin: subproc
config:
prog: curl
argfiles:
- arg: '--key'
filepath: /tmp/private_key
- arg: '-d@'
filepath: /tmp/data
```
Use keyword `disallow-argfiles` to disable arguments files from client:
```yaml
endpoints:
curl:
plugin: subproc
config:
prog: curl
argfiles:
- arg: '--key'
filepath: /tmp/private_key
- arg: '-d@'
filepath: /tmp/data
disallow-argfiles: true
```
Use section `env` to define environment variables always present:
```yaml
endpoints:
curl:
plugin: subproc
config:
prog: curl
env:
HTTP_PROXY: http://proxy.example.com:3128/
HTTPS_PROXY: http://proxy.example.com:3128/
```
Use keyword `disallow-env` to disable environment variables from client:
```yaml
endpoints:
curl:
plugin: subproc
config:
prog: curl
env:
HTTP_PROXY: http://proxy.example.com:3128/
HTTPS_PROXY: http://proxy.example.com:3128/
disallow-env: true
```
Use section `envfiles` to define environment variables files always present:
```yaml
endpoints:
curl:
plugin: subproc
config:
prog: curl
envfiles:
- somedir/foo.env
- somedir/bar.env
```
Use keyword `disallow-envfiles` to disable environment files from client:
```yaml
endpoints:
curl:
plugin: subproc
config:
prog: curl
envfiles:
- somedir/foo.env
- somedir/bar.env
disallow-envfiles: true
```
## Auton command-lines
### endpoint curl examples:
Get URL https://example.com:
`auton --endpoint curl --uri http://localhost:8666 -a 'https://example.com'`
Get URL https://example.com with auton authentication:
`auton --endpoint curl --uri http://localhost:8666 --auth-user foo --auth-passwd bar -a 'https://example.com'`
Add environment variable HTTP\_PROXY:
`auton --endpoint curl --uri http://localhost:8666 -a 'https://example.com' -e 'HTTP_PROXY=http://proxy.example.com:3128/'`
Import already declared environment variable with argument --imp-env:
`HTTPS_PROXY=http://proxy.example.com:3128/ auton --endpoint curl --uri http://localhost:8666 -a 'https://example.com' --imp-env HTTPS_PROXY`
Load environment variables from local files:
`auton --endpoint curl --uri http://localhost:8666 -a 'https://example.com' --load-envfile foo.env`
Tell to autond to load environment variables files from its local fs:
`auton --endpoint curl --uri http://localhost:8666 -a 'https://example.com' --envfile /etc/auton/auton.env`
Add multiple autond URIs for high availability:
`auton --endpoint curl --uri http://localhost:8666 --uri http://localhost:8667 -a 'https://example.com'`
Add arguments files to send local files:
`auton --endpoint curl --uri http://localhost:8666 -A '--cacert=cacert.pem' -a 'https://example.com'`
Add multiple arguments:
`auton --endpoint curl --uri http://localhost:8666 --multi-args '-vvv -u foo:bar https://example.com' --multi-argsfiles '-d@=somedir/foo.txt -d@=bar.txt --cacert=cacert.pem'`
Get file contents from stdin with `-`:
`cat foo.txt | auton --endpoint curl --uri http://localhost:8666 --multi-args '-vvv -u foo:bar sftp://example.com' --multi-argsfiles '--key=private_key.pem --pubkey=public_key.pem -T=-'`
Raw data
{
"_id": null,
"home_page": "https://github.com/decryptus/auton",
"name": "autond",
"maintainer": "",
"docs_url": null,
"requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*",
"maintainer_email": "",
"keywords": "",
"author": "Adrien Delle Cave",
"author_email": "pypi@doowan.net",
"download_url": "",
"platform": null,
"description": "## auton project\n\n[](https://pypi.org/project/auton/)\n[](https://pypi.org/project/auton/)\n[](https://hub.docker.com/r/decryptus/auton)\n[](https://auton.readthedocs.io/)\n\nauton is a free and open-source, we develop it to run programs and command-lines on remote servers through HTTP protocol.\nThere are two programs, auton for client side and autond for server side.\nauton is just a helper to transform command-lines into HTTP protocol, it is able to transform basic arguments, file arguments and environment variables.\nFor example, you can use auton from CI/CD to run on remote servers, you just need to configure your endpoints:\n - [ansible](https://github.com/ansible/ansible)\n - [curl](https://github.com/curl/curl)\n - [terraform](https://github.com/hashicorp/terraform)\n\nYou can also use auton if you need to execute a new version of a software but you can't install it on a legacy server\nor tests programs execution.\n\n## Quickstart\n\nUsing autond in Docker\n\n`docker-compose up -d`\n\nSee [docker-compose.yml](docker-compose.yml)\n\n## Installation\n\n### autond for server side\n\n`pip install autond`\n\n### auton for client side\n\n`pip install auton`\n\n## Environment variables\n\n### autond\n\n| Variable | Description | Default |\n|:-----------------|:----------------------------|:--------|\n| `AUTOND_CONFIG` | Configuration file contents<br />(e.g. `export AUTOND_CONFIG=\"$(cat auton.yml)\"`) | |\n| `AUTOND_LOGFILE` | Log file path | /var/log/autond/daemon.log |\n| `AUTOND_PIDFILE` | autond pid file path | /run/auton/autond.pid |\n| `AUTON_GROUP` | auton group | auton or root |\n| `AUTON_USER` | auton user | auton or root |\n\n### auton\n\n| Variable | Description | Default |\n|:-----------------------|:----------------------------|:--------|\n| `AUTON_AUTH_USER` | user for authentication | <span/> |\n| `AUTON_AUTH_PASSWD` | password for authentication | <span/> |\n| `AUTON_ENDPOINT` | name of endpoint | <span/> |\n| `AUTON_LOGFILE` | Log file path | /var/log/auton/auton.log |\n| `AUTON_NO_RETURN_CODE` | Do not exit with return code if present | False |\n| `AUTON_UID` | auton job uid | random uuid |\n| `AUTON_URI` | autond URI(s)<br />(e.g. http://auton-01.example.org:8666,http://auton-02.example.org:8666) | <span/> |\n\n## Autond configuration\n\nSee configuration example [etc/auton/auton.yml.example](etc/auton/auton.yml.example)\n\n### Endpoints\n\nIn this example, we declared three endpoints: ansible-playbook-ssh, ansible-playbook-http, curl.\nThey used subproc plugin.\n\n```yaml\nendpoints:\n ansible-playbook-ssh:\n plugin: subproc\n config:\n prog: ansible-playbook\n timeout: 3600\n args:\n - '/etc/ansible/playbooks/ssh-install.yml'\n - '--tags'\n - 'sshd'\n become:\n enabled: true\n env:\n DISPLAY_SKIPPED_HOSTS: 'false'\n ansible-playbook-http:\n plugin: subproc\n config:\n prog: ansible-playbook\n timeout: 3600\n args:\n - '/etc/ansible/playbooks/http-install.yml'\n - '--tags'\n - 'httpd'\n become:\n enabled: true\n env:\n DISPLAY_SKIPPED_HOSTS: 'false'\n curl:\n plugin: subproc\n config:\n prog: curl\n timeout: 3600\n```\n\n### Authentication\n\nTo enable authentication, you must add `auth_basic` and `auth_basic_file` lines in section `general`:\n\n```yaml\n auth_basic: 'Restricted'\n auth_basic_file: '/etc/auton/auton.passwd'\n```\n\nUse `htpasswd` to generate `auth_basic_file`:\n\n`htpasswd -c -s /etc/auton/auton.passwd foo`\n\nAnd you have to add for each modules route `auth: true`:\n\n```yaml\nmodules:\n job:\n routes:\n run:\n handler: 'job_run'\n regexp: '^run/(?P<endpoint>[^\\/]+)/(?P<id>[a-z0-9][a-z0-9\\-]{7,63})$'\n safe_init: true\n auth: true\n op: 'POST'\n status:\n handler: 'job_status'\n regexp: '^status/(?P<endpoint>[^\\/]+)/(?P<id>[a-z0-9][a-z0-9\\-]{7,63})$'\n auth: true\n op: 'GET'\n```\n\nUse section `users` to specify users allowed by endpoint:\n```yaml\n ansible-playbook-ssh:\n plugin: subproc\n users:\n maintainer: true\n bob: true\n config:\n prog: ansible-playbook\n timeout: 3600\n args:\n - '/etc/ansible/playbooks/ssh-install.yml'\n - '--tags'\n - 'sshd'\n become:\n enabled: true\n env:\n DISPLAY_SKIPPED_HOSTS: 'false'\n```\n\n### Plugin subproc\n\nsubproc plugin executes programs with python `subprocess`.\n\nPredefined AUTON environment variables during execution:\n\n| Variable | Description |\n|:-------------------|:----------------------------------------------|\n| `AUTON` | Mark the job is executed in AUTON environment |\n| `AUTON_JOB_TIME` | Current time in local time zone |\n| `AUTON_JOB_GMTIME` | Current time in GMT |\n| `AUTON_JOB_UID` | Current job uid passed from client |\n| `AUTON_JOB_UUID` | Unique ID of the current job |\n\nUse keyword `prog` to specify program path:\n```yaml\nendpoints:\n curl:\n plugin: subproc\n config:\n prog: curl\n```\n\nUse keyword `workdir` to change the working directory:\n```yaml\nendpoints:\n curl:\n plugin: subproc\n config:\n prog: curl\n workdir: somedir/\n```\n\nUse keyword `search_paths` to specify paths to search `prog`:\n```yaml\nendpoints:\n curl:\n plugin: subproc\n config:\n prog: curl\n search_paths:\n - /usr/local/bin\n - /usr/bin\n - /bin\n```\n\nUse section `become` to execute with an other user:\n```yaml\nendpoints:\n curl:\n plugin: subproc\n config:\n prog: curl\n become:\n enabled: true\n user: foo\n```\n\nUse keyword `timeout` to raise an exception after n seconds (default: 60 seconds):\n```yaml\nendpoints:\n curl:\n plugin: subproc\n config:\n prog: curl\n timeout: 3600\n```\n\nUse section `args` to define arguments always present:\n```yaml\nendpoints:\n curl:\n plugin: subproc\n config:\n prog: curl\n args:\n - '-s'\n - '-4'\n```\n\nUse keyword `disallow-args` to disable arguments from client:\n```yaml\nendpoints:\n curl:\n plugin: subproc\n config:\n prog: curl\n args:\n - '-vvv'\n - 'https://example.com'\n disallow-args: true\n```\n\nUse section `argfiles` to define arguments files always present:\n```yaml\nendpoints:\n curl:\n plugin: subproc\n config:\n prog: curl\n argfiles:\n - arg: '--key'\n filepath: /tmp/private_key\n - arg: '-d@'\n filepath: /tmp/data\n```\n\nUse keyword `disallow-argfiles` to disable arguments files from client:\n```yaml\nendpoints:\n curl:\n plugin: subproc\n config:\n prog: curl\n argfiles:\n - arg: '--key'\n filepath: /tmp/private_key\n - arg: '-d@'\n filepath: /tmp/data\n disallow-argfiles: true\n```\n\nUse section `env` to define environment variables always present:\n```yaml\nendpoints:\n curl:\n plugin: subproc\n config:\n prog: curl\n env:\n HTTP_PROXY: http://proxy.example.com:3128/\n HTTPS_PROXY: http://proxy.example.com:3128/\n```\n\nUse keyword `disallow-env` to disable environment variables from client:\n```yaml\nendpoints:\n curl:\n plugin: subproc\n config:\n prog: curl\n env:\n HTTP_PROXY: http://proxy.example.com:3128/\n HTTPS_PROXY: http://proxy.example.com:3128/\n disallow-env: true\n```\n\nUse section `envfiles` to define environment variables files always present:\n```yaml\nendpoints:\n curl:\n plugin: subproc\n config:\n prog: curl\n envfiles:\n - somedir/foo.env\n - somedir/bar.env\n```\n\nUse keyword `disallow-envfiles` to disable environment files from client:\n```yaml\nendpoints:\n curl:\n plugin: subproc\n config:\n prog: curl\n envfiles:\n - somedir/foo.env\n - somedir/bar.env\n disallow-envfiles: true\n```\n\n## Auton command-lines\n\n### endpoint curl examples:\n\nGet URL https://example.com:\n\n`auton --endpoint curl --uri http://localhost:8666 -a 'https://example.com'`\n\nGet URL https://example.com with auton authentication:\n\n`auton --endpoint curl --uri http://localhost:8666 --auth-user foo --auth-passwd bar -a 'https://example.com'`\n\nAdd environment variable HTTP\\_PROXY:\n\n`auton --endpoint curl --uri http://localhost:8666 -a 'https://example.com' -e 'HTTP_PROXY=http://proxy.example.com:3128/'`\n\nImport already declared environment variable with argument --imp-env:\n\n`HTTPS_PROXY=http://proxy.example.com:3128/ auton --endpoint curl --uri http://localhost:8666 -a 'https://example.com' --imp-env HTTPS_PROXY`\n\nLoad environment variables from local files:\n\n`auton --endpoint curl --uri http://localhost:8666 -a 'https://example.com' --load-envfile foo.env`\n\nTell to autond to load environment variables files from its local fs:\n\n`auton --endpoint curl --uri http://localhost:8666 -a 'https://example.com' --envfile /etc/auton/auton.env`\n\nAdd multiple autond URIs for high availability:\n\n`auton --endpoint curl --uri http://localhost:8666 --uri http://localhost:8667 -a 'https://example.com'`\n\nAdd arguments files to send local files:\n\n`auton --endpoint curl --uri http://localhost:8666 -A '--cacert=cacert.pem' -a 'https://example.com'`\n\nAdd multiple arguments:\n\n`auton --endpoint curl --uri http://localhost:8666 --multi-args '-vvv -u foo:bar https://example.com' --multi-argsfiles '-d@=somedir/foo.txt -d@=bar.txt --cacert=cacert.pem'`\n\nGet file contents from stdin with `-`:\n\n`cat foo.txt | auton --endpoint curl --uri http://localhost:8666 --multi-args '-vvv -u foo:bar sftp://example.com' --multi-argsfiles '--key=private_key.pem --pubkey=public_key.pem -T=-'`\n\n\n",
"bugtrack_url": null,
"license": "License GPL-3",
"summary": "autond",
"version": "0.2.23",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1e15cc7efe4f97d495b992b16a34dcf56b23d2050902a23aa0c38256efced549",
"md5": "7dba482fcd979b35bd088c006406973e",
"sha256": "a42b0eacd3750c719cd73ce6c2f53b961b3bdd236a422dbb77f3fb892d9d88d2"
},
"downloads": -1,
"filename": "autond-0.2.23-py2-none-any.whl",
"has_sig": false,
"md5_digest": "7dba482fcd979b35bd088c006406973e",
"packagetype": "bdist_wheel",
"python_version": "py2",
"requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*",
"size": 33064,
"upload_time": "2023-01-20T14:46:48",
"upload_time_iso_8601": "2023-01-20T14:46:48.419113Z",
"url": "https://files.pythonhosted.org/packages/1e/15/cc7efe4f97d495b992b16a34dcf56b23d2050902a23aa0c38256efced549/autond-0.2.23-py2-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "74946c0fd68fdfcd931b18dca9972a4e5e55b00aa7fe21d5d3579b9bea2653a1",
"md5": "c39138ea826bdcd6b67d519e9a056ca7",
"sha256": "20b6f8bcaa2260a32995e68c4b356dfa33cd81faf3bf97d67d9579e8c197fdf6"
},
"downloads": -1,
"filename": "autond-0.2.23-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c39138ea826bdcd6b67d519e9a056ca7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*",
"size": 33060,
"upload_time": "2023-01-20T14:46:52",
"upload_time_iso_8601": "2023-01-20T14:46:52.728848Z",
"url": "https://files.pythonhosted.org/packages/74/94/6c0fd68fdfcd931b18dca9972a4e5e55b00aa7fe21d5d3579b9bea2653a1/autond-0.2.23-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-20 14:46:48",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "decryptus",
"github_project": "auton",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "autond"
}