|
OS:centos6.8
- sysctl:
name: net.ipv4.ip_local_reserved_ports
value: 21,22,80
sysctl_set: yes
state: present
https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/system/sysctl.py
def get_token_curr_value(self, token):if self.platform == 'openbsd':# openbsd doesn't support -e, just drop itthiscmd = "%s -n %s" % (self.sysctl_cmd, token)else:thiscmd = "%s -e -n %s" % (self.sysctl_cmd, token)rc, out, err = self.module.run_command(thiscmd)if rc != 0:return Noneelse:return out [root@lianke ~]# sysctl -e -n net.ipv4.ip_local_reserved_ports
21-22,24
由此可知,net.ipv4.ip_local_reserved_ports在proc文件系统会将连续的端口使用“-”连接,yml文件中的value是逗号分割,而获取到的value中有中横线分隔。 |
|
|