kubespray 使用遇到的问题

1 问题:

FAILED! => {“changed”: false, “module_stderr”: “sudo: sorry, you must have a tty to run sudo\n”, “module_stdout”: “”, “msg”: “MODULE FAILURE\nSee stdout/stderr for the exact error”, “rc”: 1}

解决 visudo,将 Defaults requiretty 注释掉

2.

FAILED! => {“changed”: false, “msg”: “Failed to reload sysctl: vm.max_map_count = 262144\nnet.ipv4.ip_forward = 1\nsysctl: cannot stat /proc/sys/net/bridge/bridge-nf-call-ip6tables: No such file or directory\nsysctl: cannot stat /proc/sys/net/bridge/bridge-nf-call-iptables: No such file or directory\n”}
解决:

modprobe br_netfilter

bash debug line number

当遇到很长 bash 脚本,尤其包含很多逻辑的时候,需要用 bash 行号进行debug,方法是设置 PS4 变量。

[vagrant@centos7-work ~]$ sh foobar.sh 
foobar
[vagrant@centos7-work ~]$ export PS4='(${BASH_SOURCE}:${LINENO}): - [${SHLVL},${BASH_SUBSHELL},$?] $ '
[vagrant@centos7-work ~]$ sh -x foobar.sh 
(foobar.sh:2) $ echo foobar
foobar

参考:
https://coderwall.com/p/wil8da/debug-bash-scripts-with-line-numbers-more-info