feat: replace ansible templating with makejinja (#1156)
This commit is contained in:
1 parent
a4731906d9
commit
f9481d6202
114 files changed
+555
-906
No files matched your search
@@ -0,0 +1,21 @@
|
||||
import netaddr, bcrypt
|
||||
|
||||
def nthhost(value: str, query: int) -> str:
|
||||
value = netaddr.IPNetwork(value)
|
||||
|
||||
try:
|
||||
nth = int(query)
|
||||
if value.size > nth:
|
||||
return str(value[nth])
|
||||
|
||||
except ValueError:
|
||||
return False
|
||||
|
||||
return value
|
||||
|
||||
def encrypt(value: str) -> str:
|
||||
return bcrypt.hashpw(value.encode(), bcrypt.gensalt(rounds=10)).decode("ascii")
|
||||
|
||||
class Loader:
|
||||
def filters(self):
|
||||
return [nthhost, encrypt]
|
||||
Reference in new issue
Block a user