A collection of classes and commands for automated command line scripting using Python.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

205 lines
3.6 KiB

[update system repos]
system: update
[upgrade the system]
system: upgrade
[reboot the system]
system: reboot
[function for setting up apache]
func = apache_setup
[install apache]
install: apache2
func: apache_setup
[install wsgi]
install: mod_wsgi
func: apache_setup
[enable wsgi]
apache.enable_module: mod_wsgi
func: apache_setup
[disable the default site in function]
apache.disable_site = default
func: apache_setup
[restart apache]
apache: restart
func: apache_setup
[call apache setup]
run: apache_setup
[disable the default site]
apache.disable_site = default
[enable mod SSL]
apache.enable_module = mod_ssl
[enable more than one apache module at once]
apache.enable_module = $item
items = mod_wsgi, mod_rewrite
[make sure apache can be reloaded]
apache: test
[restart apache outside of function]
apache: restart
condition: $apache_checks_out -eq 0
[install the virtualenv package]
pip = virtualenv
[install django debug toolbar]
pip: django-debug-toolbar
env: development
tags: python, project
[create a virtual environment]
virtualenv = python
cd = /path/to/project
tags = python, project
[install pillow]
pip = Pillow
cd = /path/to/project
upgrade = yes
venv = python
tags = python, project
[apply database migrations]
django.migrate:
cd: /path/to/project
venv: python
[run a custom django command]
django = custom_command arg1 arg2
cd = /path/to/project
venv = python
settings = tenants.example_app.settings
quiet = yes
[collect the project's static files]
django: collectstatic
cd: /path/to/project
venv: python
[load data fixtures]
django.loaddata: categories
cd: /path/to/project
venv: python
[dump data fixtures]
django.dumpdata: projects
cd: /path/to/project
venv: python
[reload a service]
reload: postfix
[restart a service]
restart: postfix
[stop a service]
stop: postfix
[start a service]
start: postfix
[install a package]
install: python3
[remove a package]
uninstall: apache-top
[add to a file]
append: /path/to/file.txt
content: this is a test
[copy a file]
copy: /path/to/file.txt /new/path/to/file.txt
[write (overwrite) a file]
write: /path/to/file.txt
content: this replaces all text in the file
[create a directory]
mkdir: /path/to/dir
mode: 755
[move a file]
move: /path/to/file.txt /path/to/file.txt.b
[set permissions on a file]
perms: /path/to/file.txt
group: www-data
mode: 755
owner: deploy
recursive: yes
[remove a file]
remove: /path/to/file.txt
[sync a directory]
rsync: /path/to/source /path/to/target
[copy a file to remote server]
scopy: /path/to/file.txt /path/to/server/file.txt
host: example.com
[replace text in a file]
sed: /path/to/file.txt
find: logging = no
replace: logging = yes
[create a symlink]
symlink: /var/www/domains
[touch a file]
touch: /path/to/file.txt
[create a postgres user/role]
pgsql.user: example_app
[create a postgres database]
pgsql.create: example_app
owner: example_app
[determine whether a postgres database exists]
pgsql.exists: example_app
[export a postgres database]
pgsql.dump: testing
[drop a postgres user/role]
pgsql.user: testing
op: drop
[drop a postgres database]
pgsql.drop: testing
[run an SQL command on a postgres database]
pgsql.sql: "SELECT * FROM projects WHERE category = 'testing'"
database: example_app
owner: example_app
[create a file archive]
archive: /var/www/domains/example_com
[extract a file archive]
extract: /var/www/domains/example_com.tgz
[create a file from a template]
template: good.j2.txt tests/tmp/good.txt
testing: {{ testing }}
times: 123
[create a bunch of files using templates]
template: $item.txt tests/tmp/$item
items: simple.sh.txt, simple.txt
testing: {{ testing }}
times: 123