Ansible:如何在 nmcli 模块中指定 ipv6.method?

问题描述 投票:0回答:1

为了使用 nmcli 在 RHEL7 中设置手动 ipv6 地址,可以这样做:

nmcli con modify eth1 ipv6.method manual ipv6.addresses "abba::cafe/64"

但是,我不知道如何对 ansible 的

nmcli
模块执行相同的操作。 我有以下任务:

- name: "setup ipv6 address (eth1)"
  nmcli:
    conn_name: "eth1"
    type: ethernet
    ip6: "{{ networking_ipv6_eth1_addr }}"
    gw6: "{{ networking_ipv6_eth1_gw }}"
    state: present

问题是没有

method
参数,在某些情况下,当
ipv6.method
值与设置手动 IPv6 地址不兼容时,会导致错误:

Error: Failed to modify connection 'eth1': ipv6.addresses: this property is not allowed for 'method=ignore

我可能可以通过在这之前的 shell 任务中将

ipv6.method
设置为
auto
(它不会引发错误)并在之后设置为
manual
来解决此问题,但这是一个糟糕的解决方案。

有没有合适的方法来实现这一目标?

ansible ipv6 nmcli
1个回答
0
投票
nmcli con modify eth1 ipv6.addresses "" ipv6.gateway "" ipv6.method disabled
© www.soinside.com 2019 - 2024. All rights reserved.