主机:全部
任务:
wget http://rpms.famillecollet.com/RPM-GPG-KEY-remi \ -O /etc/pki/rpm-gpg/RPM-GPG-KEY-remi
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-remi
rpm -Uvh --quiet \
http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
yum install epel-release
yum --enablerepo=epel install node
编译时出现以下错误:ERROR! Syntax Error while loading YAML.
该错误似乎出在'/home/shahzad/playbook.yml'中:第7行,第3列,但根据确切的语法问题,该错误可能在文件的其他位置。
违规行似乎是:
wget http://rpms.famillecollet.com/RPM-GPG-KEY-remi \ -O /etc/pki/rpm-gpg/RPM-GPG-KEY-remi
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-remi
^ here
exception type: <class 'yaml.scanner.ScannerError'>
exception: while scanning a simple key
in "<unicode string>", line 6, column 3
could not find expected ':'
in "<unicode string>", line 7, column 3
答案 0 :(得分:0)
wget
,则需要使用shell模块:- name: Import Remi GPG key
shell: wget ...
“:”是yaml中的特殊字符,请阅读官方ansible文档中的YAML Syntax page,以进行引用。
对于yum命令,您可以使用ansible的yum模块。
最佳做法是,您可以使用http://www.yamllint.com/调试YAML语法,检查解析器失败的确切行和列。
答案 1 :(得分:0)
我已经按照上面的说明安装了所有内容,但是我使用安装程序alien
在Ubuntu 18.04上转换和安装rpm packages
。
但是,由于某些软件包不在列表中,因此您将无法与yum一起安装。
使用外星人:
# apt install alien # apt install -y
# cd /tmp
# wget http://rpms.famillecollet.com/RPM-GPG-KEY-remi \ -O /etc/pki/rpm-gpg/RPM-GPG-KEY-remi
# wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
# alien -kiv remi-release-6.rpm
# ls -l
# wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
# alien epel-release-latest-8.noarch.rpm
# ls -l
# alien -k epel-release-latest-8.noarch.rpm ; alien -i epel-release-latest-8.noarch.rpm
# cd /home/user
# apt install curl gcc g++ make # apt install -y
# curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
# apt install nodejs # apt install -y
# curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
# echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
# apt update ; sudo apt install yarn # apt install -y
# apt install nodejs ; apt upgrade ; passwd -dl root ; reboot # apt install -y
但是我仍然遇到相同的错误Invalid YAML: could not find expected ':':
,但是在命令networkctl
上,对我来说更好了,它说failed
(尽管在安装node.js之前是remi-release ,epel-release并没有像这样签名)哪些接口配置不正确。
IDX LINK TYPE OPERATIONAL SETUP
1 lo loopback carrier unmanaged
2 ens11 ether off unmanaged
3 enp2t1 ether routable configured
4 br0 ether off failed
5 vlan5 ether off configuring
这些已安装的软件包可让您深入查看接口错误,此方法有效!!!!!! Shahzad Adil shaikh谢谢您!