Ansible无法重新加载sysctl

时间:2018-07-27 12:09:12

标签: ansible sysctl

我正在尝试通过ansible添加以下内容

---
  - name: Set sysctl for all.accept_ra=0
    sysctl:
      name: net.ipv6.conf.all.accept_ra
      value: 0
      state: present

并且不断给我错误:

TASK [ami : Set sysctl for all.accept_ra=0] ***************************************************************************************************
Friday 27 July 2018  17:35:20 +0530 (0:00:12.267)       0:00:12.327 *********** 
fatal: [172.16.14.152]: FAILED! => {"changed": false, "failed": true, "msg": "Failed to reload sysctl: sysctl: cannot stat /proc/sys/net/ipv6/conf/all/accept_ra: No such file or directory\n"}

我尝试了很多类似

的变体
---
  - name: Set sysctl for all.accept_ra=0
    sysctl:
      name: net.ipv6.conf.all.accept_ra
      value: 0
      sysctl_set: yes
      state: present
      sysctl_file: /etc/sysctl.conf
      reload: yes

但是错误仍然存​​在,我不确定为什么它一直走到路径/proc/sys/net/ipv6/conf/all/accept_ra

有帮助吗?

1 个答案:

答案 0 :(得分:0)

错误已清除。由于某种原因该文件不存在。是否启用了IPv6?

cannot stat /proc/sys/net/ipv6/conf/all/accept_ra: No such file or directory