Skip to main content

Obscene ansible runner

Project description

Bigsudo is an opinionated command line wrapper to ansible-playbook.

It accepts as first argument: role name, path or url, or playbook path or url:

bigsudo role.name # download role and run tasks/main.yml on localhost

bigsudo role.name update # do tasks/update.yml
bigsudo role.name user@host update # do tasks/update.yml on host
bigsudo role.name @host update # with current user
bigsudo role.name @host update foo=bar # custom variable
bigsudo role.name {"foo":"bar"} # also accepts json without space
bigsudo role.name --become # forwards any ansible-playbook argument

Note that bigsudo will automatically call ansible-galaxy install on requirements.yml it finds in any role, recursively on each role that it got galaxy to install. This means that yourlabs.docker/requirements.yml will also be installed by bigsudo if your repo has this requirements.yml:

- src: git+https://yourlabs.io/oss/yourlabs.docker

The gotcha is that you cannot pass values to a short-written argument (because it’s my opinion that ansible commands are more readable as such), ie:

# works:
$ ./example/playbook.yml --tags=foo
ansible-playbook --tags=foo -c local -i localhost, -e apply_tasks='["main"]' ./example/playbook.yml

# does NOT work: parser doesn't detect that foo is the value of -t:
$ ./example/playbook.yml -t foo
ansible-playbook -t -c local -i localhost, -e apply_tasks='["foo"]' ./example/playbook.yml

# does NOT work: parser doesn't detect that foo is the value of --tags:
$ ./example/playbook.yml --tags foo
ansible-playbook --tags -c local -i localhost, -e apply_tasks='["foo"]' ./example/playbook.yml

Using gitlab-ci you can define multiline env vars, ie a with $STAGING_HOST=deploy@yourstaging and json string for $STAGING_VARS:

{
  "security_salt": "yoursecretsalf",
  "mysql_password": "...",
  // ....
}

Then you can define a staging deploy job as such in .gitlab-ci.yml:

image: yourlabs/python

# example running tasks/update.yml, using the repo as role
script: bigsudo . update $STAGING_HOST $STAGING_VARS

# example running playbook update.yml
script: bigsudo ./update.yml $STAGING_HOST $STAGING_VARS

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bigsudo-0.2.0.tar.gz (2.2 kB view details)

Uploaded Source

File details

Details for the file bigsudo-0.2.0.tar.gz.

File metadata

  • Download URL: bigsudo-0.2.0.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

File hashes

Hashes for bigsudo-0.2.0.tar.gz
Algorithm Hash digest
SHA256 d9144f3835c83cea6087856f9bf093b4a97d5009044e2d563a032bf3a2e0a832
MD5 1af746002c451d973ba0ca4cdb211373
BLAKE2b-256 f05e40907f0cb44366bc56c97164082dbcbfe98c50323757531887e1654b9cb0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page