Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.package
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Arnaud Véron
slapos.package
Commits
c7fac123
Commit
c7fac123
authored
Aug 03, 2015
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ansible VM: Configure default route to interface eth1 if it exists
parent
3408304d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
0 deletions
+27
-0
playbook/roles/vm-bootstrap/tasks/main.yml
playbook/roles/vm-bootstrap/tasks/main.yml
+1
-0
playbook/roles/vm-bootstrap/tasks/network.yml
playbook/roles/vm-bootstrap/tasks/network.yml
+26
-0
No files found.
playbook/roles/vm-bootstrap/tasks/main.yml
View file @
c7fac123
...
...
@@ -23,6 +23,7 @@
when
:
netconfig_file.stat.exists == True
ignore_errors
:
True
-
include
:
network.yml
-
include
:
hostname.yml
-
include
:
user.yml
-
include
:
sudo.yml
...
...
playbook/roles/vm-bootstrap/tasks/network.yml
0 → 100644
View file @
c7fac123
---
-
name
:
Download network geteway ip
get_url
:
url=http://10.0.2.100/gateway dest=/etc/opt/gateway mode=666
ignore_errors
:
True
-
name
:
stat /etc/opt/gateway
stat
:
path=/etc/opt/gateway
register
:
gateway_file
-
name
:
Check default route
shell
:
/sbin/ip route list | grep default
register
:
default_route
ignore_errors
:
True
-
name
:
Check interface eth1 exists
shell
:
/sbin/ifconfig | grep eth1 | wc -l
register
:
iface_eth1
-
name
:
Delete default route to eth0
command
:
/sbin/ip route del default
when
:
gateway_file.stat.exists == True and iface_eth1.stdout == '1' and 'eth0' in default_route.stdout
-
name
:
Set eth1 as default route
command
:
/sbin/ip route add default via {{ lookup('file', '/etc/opt/gateway') }} dev eth1
when
:
gateway_file.stat.exists == True and iface_eth1.stdout == '1' and not 'eth1' in default_route.stdout
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment