我有一个应根据特定主机名为主机分配的IPv6地址列表。例如:
IPv4 addresses are already assigned. Question: what is the best way to assign these addresses using Ansible?
答案 0 :(得分:0)
以下是解决问题的方法:
创建v6.yaml文件:
myhost-dev1.example.com: fd00:1::1
myhost-dev2.example.com: fd00:1::2
添加了以下两项任务:
- name: Load IPv6 addresses list
include_vars:
file: 'v6.yml'
name: ipv6_addr
- name: Apply IPv6 addresses
blockinfile:
path: '/etc/sysconfig/network-scripts/ifcfg-eth0'
block: |
IPV6INIT=yes
IPV6ADDR={{ ipv6_addr[ansible_fqdn] }}
IPV6_DEFAULTGW=fd00:1::100