-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
trying to figure out why route applying only works once.
- Loading branch information
1 parent
a5bd6d0
commit 6eb6e6a
Showing
1 changed file
with
20 additions
and
9 deletions.
There are no files selected for viewing
29 changes: 20 additions & 9 deletions
29
resources/playbook/roles/bibigrid/templates/slurm/worker_userdata.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,23 @@ | ||
#cloud-config | ||
{% set cloud_identifier = item.cloud_identifier %} | ||
|
||
bootcmd: | ||
- /usr/bin/ip route add 10.0.0.0/24 via {{ hostvars[item].private_v4 }} dev ens3 | ||
{% for cluster_cidr in cluster_cidrs %} | ||
{% if cluster_cidr.cloud_identifier != hostvars[item].cloud_identifier %} | ||
{% for provider_cidr in cluster_cidr.provider_cidrs %} | ||
- /usr/bin/ip route add {{ provider_cidr }} via {{ hostvars[item].private_v4 }} dev ens3 | ||
{% endfor %} | ||
{% endif %} | ||
{% endfor %} | ||
# Create a shell script to apply routes | ||
write_files: | ||
- content: | | ||
#!/bin/bash | ||
echo Adding IP Routes | ||
/usr/bin/ip route add 10.0.0.0/24 via {{ hostvars[item].private_v4 }} | ||
{% for cluster_cidr in cluster_cidrs %} | ||
{% if cluster_cidr.cloud_identifier != hostvars[item].cloud_identifier %} | ||
{% for provider_cidr in cluster_cidr.provider_cidrs %} | ||
/usr/bin/ip route add {{ provider_cidr }} via {{ hostvars[item].private_v4 }} | ||
{% endfor %} | ||
{% endif %} | ||
{% endfor %} | ||
echo "IP Routes Added" | ||
path: /usr/local/bin/apply-routes.sh | ||
permissions: '0755' | ||
|
||
# Execute the shell script | ||
runcmd: | ||
- /usr/local/bin/apply-routes.sh |