Skip to content

Instantly share code, notes, and snippets.

@tgerla
Created March 21, 2013 17:50
Show Gist options
  • Select an option

  • Save tgerla/5215088 to your computer and use it in GitHub Desktop.

Select an option

Save tgerla/5215088 to your computer and use it in GitHub Desktop.
---
- name: networking test
hosts: linux1
tasks:
- name: Ensure repository host entries exist
lineinfile: dest=/etc/hosts regexp="$item" line="$item" state=present
with_items:
- "192.168.0.1 test.server1"
- "192.168.0.2 test.server2"
- name: Ensure static route is set correctly
lineinfile: dest=/etc/sysconfig/network-scripts/route-eth0 create=yes
regexp="^10\.xxx\.yyy\.zzz" line="10.xxx.yyy.zzz/15 via ${ansible_default_ipv4.gateway}"
- name: restart networking
service: name=network state=restarted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment