A simple cronjob to update DynHost on OVH hosting.
forked from yjajkiew/dynhost-ovh
This repo provides a script to retrieve the public ip of an host and set a dynhost on OVH accordingly.
A docker image and a Chart is also provided for deployment on kubernetes.
You may also just use
cron
to run the script.
- The command
dig
is used to retrieve the IP address of your domain name. - The command
curl
(with the websiteifconfig.co
) is used to retrieve the current public IP address of your machine. - The two IPs are compared and if necessary a
curl
command to OVH is used to update your DynHost with your current public IP address.
curl
- HTTP callsdig
- DNS lookup
On ubuntu
dig
is provided by thednsutils
package
- Kubernetes
1.21
- helm
3.6.3
Other versions might work but were not tested.
- Download the
dynhost.sh
script and put it in the folder/etc/cron.hourly
(to check every hour) - Add execution permissions to file :
chmod +x dynhost.sh
- Rename
dynhost.sh
todynhost
(because.
at the end of the file name is not allowed in cron) - Modify the script with variables :
HOST
,LOGIN
,PASSWORD
The script uses environment variable as parameters.
Name | Description | Value |
---|---|---|
HOST |
Mandatory - The dynhost DNS name to update | "" |
LOGIN |
Mandatory - The dynhost identifier | "" |
PASSWORD |
Mandatory - The dynhost password | "" |
To install the chart:
git clone [REPO_CLONE_URL] && cd dynhost-ovh
helm install [RELEASE] chart \
--set dynhost.host=[DYNHOST_HOST] \
--set dynhost.login=[DYNHOST_USERNAME] \
--set dynhost.password=[DYNHOST_PASSWORD]
Make sure to replace the
[...]
accordingly.
You may also use a
values.yaml
file usinghelm install -f [FILE] ...
helm uninstall [RELEASE]
Name | Description | Value |
---|---|---|
dynhost.host * |
The dynhost DNS name to update | "" |
dynhost.login * |
The dynhost identifier | "" |
dynhost.password * |
The dynhost password | "" |
dynhost.externalSecretName |
The name of a secret containing the script's parameters to use instead of creating one | "" |
suspend |
Wether to suspend the cron or not | no |
schedule |
The schedule of the cronjob. Use cron syntax | 0 * * * * (every hour) |
image.repository |
The docker image repository | nox404/dynhost-ovh |
image.tag |
The docker image tag | 1.0.0 |
*
dynhost.host
,dynhost.login
,dynhost.password
are Mandatory unless you provide an external secret withdynhost.externalSecretName
.
Name | Description | Value |
---|---|---|
cronjobApiVersion |
Use this if the cronjob api has a different version in your cluster | batch/v1beta1 |
failedJobsHistoryLimit |
The number of failed jobs to keep | 1 |
successfulJobsHistoryLimit |
The number of successful jobs to keep | 1 |
backoffLimit |
The number of retries to attempt when the job fails | 0 |
image.pullPolicy |
Image pull policy | IfNotPresent |
imagePullSecrets |
Specify image pull secrets | [] |
serviceAccount.create |
Wether to create a service account | true |
serviceAccount.name |
Name of the service account to create and/or use | "" |
podAnnotations |
Extra pod annotations | {} |
podSecurityContext |
The pod security context | {} |
securityContext |
The container security context | {} |
resources |
Specify container resources | {} |
nodeSelector |
Constrain the pod to specific nodes | {} |
tolerations |
Pod tolerations | [] |
affinity |
Pod affinities | {} |
git clone [REPO_CLONE_URL] && cd dynhost-ovh
docker build -f docker/Dockerfile -t [REPOSITORY]:[TAG] .
docker push [REPOSITORY]:[TAG]