Commit 274b8a7c authored by Alain Takoudjou's avatar Alain Takoudjou

Merge branch 'logging' into 'master'

Logging into master

Changes to set eth1 as default routes when ansible configure IMT vm

See merge request !10
parents 780f9780 c7fac123
......@@ -58,6 +58,9 @@
- name: adding entry from workspace
lineinfile: dest=/etc/resolv.conf line="nameserver"
- name: Delete default nameserver
lineinfile: dest=/etc/resolv.conf line="nameserver" state=absent
- name: ping current host
script: ping host {{ lookup('file', '/etc/opt/ipv4') }} {{ lookup('file', '/etc/opt/hostname') }}
when: hostname_file.stat.exists == True
......@@ -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
- name: Download network geteway ip
get_url: url= 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
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment