bundles/pppd: add dyndns capability
This commit is contained in:
parent
10732efa36
commit
f405dca771
4 changed files with 37 additions and 0 deletions
24
bundles/pppd/files/dyndns
Normal file
24
bundles/pppd/files/dyndns
Normal file
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import requests
|
||||
from sys import argv
|
||||
|
||||
INTERFACE = argv[1]
|
||||
LOCAL_IP = argv[4]
|
||||
|
||||
UPDATE_URL = '${url}'
|
||||
USERNAME = '${username}'
|
||||
PASSWORD = '${password}'
|
||||
|
||||
r = requests.get(
|
||||
UPDATE_URL.format(
|
||||
ip=LOCAL_IP,
|
||||
),
|
||||
auth=(
|
||||
USERNAME,
|
||||
PASSWORD,
|
||||
)
|
||||
)
|
||||
|
||||
with open('/var/tmp/dyndns.monitoring', 'w') as s:
|
||||
s.write(str(r.status_code))
|
|
@ -76,6 +76,13 @@ files = {
|
|||
},
|
||||
}
|
||||
|
||||
if 'dyndns' in node.metadata['pppd']:
|
||||
files['/etc/ppp/ip-up.d/dyndns'] = {
|
||||
'content_type': 'mako',
|
||||
'context': node.metadata['pppd']['dyndns'],
|
||||
'mode': '0755',
|
||||
}
|
||||
|
||||
svc_systemd = {
|
||||
'pppoe': {
|
||||
'needs': {
|
||||
|
|
|
@ -3,6 +3,7 @@ defaults = {
|
|||
'packages': {
|
||||
'ppp': {},
|
||||
'pppoe': {},
|
||||
'python3-requests': {},
|
||||
'ndisc6': {},
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue