前言
基本上依照官网文档就行了,先做before deploy,再做three side guide.md。
以下是可能呈现的问题
这个AnsibleUndefinedVariable: ‘ansible_ssh_host‘ is undefined.
是必定会遇到的,参考我这篇
安全性限度
ansible提醒
warning: now open files is 1024, and need to turn up tp 64000,warning: now max user process is 1024, and need to turn up tp 64000
依据官网手册,在(每一个机器的)配置文件/etc/security/limits.conf
和/etc/security/limits.d/20-nproc.conf
写入`
`即可。我关上的时候文件外面排列的整整齐齐的,我倡议也手动空格跟他们一样参差。
批改实现后有可能虚拟机的内存不够大,依然会呈现这个warning,此时须要把虚拟机内存调大,18G左右就够用了。
sudo password
ansible日志呈现 msg:missing sudo password
批改增加Ansible_project_path/environment/prod/hosts
中的ansible_become_pass=
为sudo的明码(不是root明码,是转换为sudo的本账户明码)。
如果你是装置官网文档新建的app用户的话,那app应该是不在sudoer
file外面的,这个都加进去sudoer就行了,能够参考这个。
呈现no erlang package matching
ansible日志呈现 no package matching erlang found available
。
yum install epel-release
,或者用其余办法装置epel即可。
python tools报错
报错信息no module named pkg_resources
日志信息failed to import the required python libarary(seuptools) on xx's python /usr/bin/python. please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the document on ansible_python_interpreter
乍一看我认为是用错了python解释器了,因为Linux默认的/usr/bin/python是2.7。批改掉/usr/bin/python的软连贯到新下载的miniconda后(危险,不倡议这样做),又会报错python2 is required
的相似谬误,遂改了回python2。
看来不是解释器的问题。看样子得自行下载python2的一个包。然而py2甚至都没有pip工具!
还好我参考了这个,下载了pip2工具。然而pip2 install pkg_resources
发现没有version_matching!
搞了良久,才晓得不是pip2 install pkg_resources
,而是应该pip2 install distribution
!装置后依然报错,然而如同曾经装置胜利了
再次deploy曾经不再呈现pkg resources
的报错了。
结尾
其余根本没什么了,查看ansible日志之后,发现没有warning、没有fail,就部署胜利了。