File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,7 +15,13 @@ Okonf also focuses on excellent performance by running asynchronously.
1515
1616Inspired by: [ pyinfra] ( ) , [ Ansible] ( ) , [ SaltStack] ( ) .
1717
18- ## Usage
18+ ## Status
19+
20+ Okonf is still in early development, and it's API is subject to changes.
21+
22+ Suggestions and contributions are welcome.
23+
24+ ## Usage as a library
1925
2026``` python
2127from okonf.connectors import LocalHost
@@ -51,6 +57,39 @@ loop.run_until_complete(
5157)
5258```
5359
60+ ## Usage as a tool
61+
62+ Declare your infrastructure in a Python file (here named ` infra.py ` ) with your two dictionnaries named ` hosts ` and ` configs ` .
63+ For example, we like to have ` vim ` , ` tree ` and ` htop ` installed on our systems:
64+
65+ ``` python
66+ from okonf.connectors import LocalHost
67+ from okonf.facts.apt import AptPresent
68+
69+ hosts = {
70+ ' laptop' : LocalHost(),
71+ }
72+
73+ configs = {
74+ ' laptop' : Sequence(
75+ AptPresent(pkg) for pkg in
76+ [' vim' , ' htop' , ' tree' ' ]
77+ ),
78+ }
79+ ```
80+
81+ If you installed Okonf via `pip` , you should then be able to check the current state with :
82+ ```bash
83+ okonf check infra.py laptop
84+ ```
85+
86+ And to apply your configuration using:
87+ ```bash
88+ okonf apply infra.py laptop
89+ ```
90+
91+ Now that you got the basics, you can replace the connector with an `SSHHost` , and look at other facts you want to use.
92+
5493# # Collections
5594
5695Okonf provides two types of collections to group tasks into new higher level
You can’t perform that action at this time.
0 commit comments