A Lightweight and Flexible Ansible Command Line Tool.


Keywords
ansible, flook
License
MIT
Install
pip install flook==0.4.1

Documentation

PyPI-Server

Build Status

Flook

A Lightweight and Flexible Ansible Command Line Tool.

To use flook, follow the following steps:

  1. Create a python virtual environment or use system wide environment
$ python3 -m venv venv
$ source venv/bin/activate
  1. Install flook package with pip.
$ pip install flook
  1. Get flook command line help
$ flook --help
  1. Init the config file and the sqlite database
$ flook config init
  1. To edit configs
$ flook config init
  1. Add a recipe
$ flook recipe add <recipe_name> -p <recipe_relative_path>

# Some examples
$ flook recipe add clivern/ping -p recipe/ping -f
$ flook recipe add clivern/nginx -p recipe/nginx -f
$ flook recipe add clivern/motd -p recipe/motd -f
  1. To list recipes
$ flook recipe list

# Get recipes as a JSON
$ flook recipe list -o json | jq .
  1. To get a recipe
$ flook recipe get <recipe_name>
  1. To delete a recipe
$ flook recipe delete <recipe_name>
  1. Add a host
$ flook host add <host_name> -i <host_ip> -p <ssh_port> -u <ssh_username> -s <ssh_key_path>

# Add a remote host
$ flook host add example.com -i 127.0.0.1 -p 22 -u root -s /Users/root/.ssh/id_rsa.pem

# Add the localhost
$ flook host add localhost -i localhost -c local
  1. To list hosts
$ flook host list

# Get hosts as a JSON
$ flook host list -o json | jq .
  1. To get a host
$ flook host get <host_name>
  1. To SSH into a host
$ flook host ssh <host_name>
  1. To delete a host
$ flook host delete <host_name>
  1. Run a recipe towards a host
$ flook recipe run <recipe_name> -h <host_name>

# Some examples
$ flook recipe run clivern/nginx -h example.com
$ flook recipe run clivern/ping -h localhost