Skip to content

Commit d52faff

Browse files
authored
Update README add tool usage and project status
1 parent ff25d75 commit d52faff

1 file changed

Lines changed: 40 additions & 1 deletion

File tree

README.md

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@ Okonf also focuses on excellent performance by running asynchronously.
1515

1616
Inspired 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
2127
from 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

5695
Okonf provides two types of collections to group tasks into new higher level

0 commit comments

Comments
 (0)