Metadata-Version: 2.1
Name: opswork
Version: 0.5.0
Summary: OpsWork Swiss Knife.
Home-page: https://github.com/Clivern/OpsWork/
Author: Clivern
Author-email: hello@clivern.com
License: MIT
Project-URL: Documentation, https://github.com/Clivern/OpsWork/
Project-URL: Source, https://github.com/Clivern/OpsWork/
Project-URL: Changelog, https://github.com/Clivern/OpsWork/blob/main/CHANGELOG.rst
Project-URL: Tracker, https://github.com/Clivern/OpsWork/issues
Project-URL: Download, https://pypi.org/project/OpsWork/#files
Platform: any
Classifier: Development Status :: 5 - Production/Stable
Classifier: Programming Language :: Python
Classifier: License :: OSI Approved :: MIT License
Description-Content-Type: text/x-rst; charset=UTF-8
License-File: LICENSE.txt
Requires-Dist: click (<=8.1.4)
Requires-Dist: ansible-runner (<=2.3.3)
Requires-Dist: prettytable (<=3.8.0)
Requires-Dist: PyYAML (<=6.0)
Requires-Dist: cryptography (<=41.0.1)
Requires-Dist: importlib-metadata (<=6.8.0) ; python_version < "3.8"

.. image:: https://img.shields.io/pypi/v/opswork.svg
    :alt: PyPI-Server
    :target: https://pypi.org/project/opswork/
.. image:: https://github.com/clivern/opswork/actions/workflows/ci.yml/badge.svg
    :alt: Build Status
    :target: https://github.com/clivern/opswork/actions/workflows/ci.yml

|

=======
OpsWork
=======

To use opswork, follow the following steps:

1. Create a python virtual environment or use system wide environment

.. code-block::

    $ python3 -m venv venv
    $ source venv/bin/activate


2. Install opswork package with pip.

.. code-block::

    $ pip install opswork


3. Get opswork command line help

.. code-block::

    $ opswork --help


4. Init the config file and the sqlite database

.. code-block::

    $ opswork config init


5. To edit configs

.. code-block::

    $ opswork config init


6. Add a recipe

.. code-block::

    $ opswork recipe add <recipe_name> -p <recipe_relative_path>

    # Some examples
    $ opswork recipe add clivern/ping -p recipe/ping -f
    $ opswork recipe add clivern/nginx -p recipe/nginx -f
    $ opswork recipe add clivern/motd -p recipe/motd -f


7. To list recipes

.. code-block::

    $ opswork recipe list

    # Get recipes as a JSON
    $ opswork recipe list -o json | jq .


8. To get a recipe

.. code-block::

    $ opswork recipe get <recipe_name>


9. To delete a recipe

.. code-block::

    $ opswork recipe delete <recipe_name>


10. Add a host

.. code-block::

    $ opswork host add <host_name> -i <host_ip> -p <ssh_port> -u <ssh_username> -s <ssh_key_path>

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

    # Add the localhost
    $ opswork host add localhost -i localhost -c local


11. To list hosts

.. code-block::

    $ opswork host list

    # Get hosts as a JSON
    $ opswork host list -o json | jq .


12. To get a host

.. code-block::

    $ opswork host get <host_name>


13. To SSH into a host

.. code-block::

    $ opswork host ssh <host_name>


14. To delete a host

.. code-block::

    $ opswork host delete <host_name>


15. Run a recipe towards a host

.. code-block::

    $ opswork recipe run <recipe_name> -h <host_name> -v key=value

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