---
- name: Configure the network
hosts: managed-node-01.example.com
tasks:
- name: Configure a network bond that uses two Ethernet ports
include_role:
name: rhel-system-roles.network
vars:
network_connections:
# Define the bond profile
- name: bond0
type: bond
interface_name: bond0
ip:
address:
- "192.0.2.1/24"
- "2001:db8:1::1/64"
gateway4: 192.0.2.254
gateway6: 2001:db8:1::fffe
dns:
- 192.0.2.200
- 2001:db8:1::ffbb
dns_search:
- example.com
bond:
mode: active-backup
state: up
# Add an Ethernet profile to the bond
- name: bond0-port1
interface_name: enp7s0
type: ethernet
controller: bond0
state: up
# Add a second Ethernet profile to the bond
- name: bond0-port2
interface_name: enp8s0
type: ethernet
controller: bond0
state: up
----name: Configure the network
hosts:managed-node-01.example.comtasks:-name: Configure a network bond that uses two Ethernet ports
include_role:name: rhel-system-roles.network
vars:network_connections:# Define the bond profile-name: bond0
type: bond
interface_name: bond0
ip:address:-"192.0.2.1/24"-"2001:db8:1::1/64"gateway4: 192.0.2.254
gateway6: 2001:db8:1::fffe
dns:- 192.0.2.200
- 2001:db8:1::ffbb
dns_search:- example.com
bond:mode: active-backup
state: up
# Add an Ethernet profile to the bond-name: bond0-port1
interface_name: enp7s0
type: ethernet
controller: bond0
state: up
# Add a second Ethernet profile to the bond-name: bond0-port2
interface_name: enp8s0
type: ethernet
controller: bond0
state: up
Copy to ClipboardCopied!Toggle word wrapToggle overflow
运行 playbook:
ansible-playbook ~/bond-ethernet.yml
# ansible-playbook ~/bond-ethernet.yml
Copy to ClipboardCopied!Toggle word wrapToggle overflow