Giter VIP home page Giter VIP logo

ansible-role-systemd-networkd's Introduction

Ansible Role: systemd_networkd

Ansible role to configure systemd-networkd.

Role Variables

# links
systemd_networkd_link: {}

# netdevs
systemd_networkd_netdev: {}

# networks
systemd_networkd_network: {}

# does the role have to restart systemd-networkd to apply the new configuration?
systemd_networkd_apply_config: false

# enable or not systemd_resolved
systemd_networkd_enable_resolved: true

# remove configuration files matching a prefix
systemd_networkd_cleanup: false
systemd_networkd_cleanup_prefix: ''
systemd_networkd_cleanup_prefix_is_regex: false

Dependencies

None

Example Playbook

  1. Configure a network interface
systemd_networkd_network:
  eth0:
    - Match:
      - Name: "eth0"
    - Network:
      - DHCP: "no"
      - IPv6AcceptRouterAdvertisements: "no"
      - DNS: 8.8.8.8
      - DNS: 8.8.4.4
      - Domains: "your.tld"

      - Address: "192.0.2.176/24"
      - Gateway: "192.0.2.1"

      - Address: "2001:db8::302/64"
      - Address: "fc00:0:0:103::302/64"
      - Gateway: "2001:db8::1"

It will create a eth0.network file in /etc/systemd/network/, and enable systemd-networkd and systemd-resolved.

Every key under systemd_networkd_* corresponds to the file name to create (.network in systemd_networkd_network, .link in systemd_networkd_link, etc…). Then every key under the file name is a section documented in systemd-networkd, which contains the couples of option: value pairs. Each couple is then converted to the format option=value.

  1. Configure a bonding interface
systemd_networkd_netdev:
  bond0:
    - NetDev:
      - Name: "bond0"
      - Kind: "bond"
    - Bond:
      - Mode: "802.3ad"
      - LACPTransmitRate: "fast"

systemd_networkd_network:
  bond0:
    - Match:
      - Name: "eth*"
    - Network:
      - DHCP: "yes"
      - Bond: "bond0"

What will create an LACP bond interface bond0, containing all interfaces starting by eth.

License

Tool under the BSD license. Do not hesitate to report bugs, ask me some questions or do some pull request if you want to!

ansible-role-systemd-networkd's People

Contributors

aruhier avatar grzegorzkoper avatar imp1sh avatar lahwaacz avatar markgoddard avatar ndf-dw avatar pieterlexis avatar stackhpc-ci avatar stejoo avatar tszym avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.