当前位置: 首页 > news >正文

网站上的定位怎么做网络营销专业就业方向

网站上的定位怎么做,网络营销专业就业方向,北京做网站要多少钱,只有域名怎么做网站ansible报错解决:Failed to import the required Python library (netaddr) 问题情况 今天我在做实验的时候出现了一个问题,以下是我的playbook,这个playbook是验证变量ip_address是否是一个合法的IP地址,并打印相应的信息的一个…

ansible报错解决:Failed to import the required Python library (netaddr)

问题情况

今天我在做实验的时候出现了一个问题,以下是我的playbook,这个playbook是验证变量ip_address是否是一个合法的IP地址,并打印相应的信息的一个剧本

[root@localhost ansible]# vim test6.yml 
- hosts: testvars:ip_address: "192.168.2455.1"tasks:- name: "判断{{ip_address}}是否为合法ip"debug:msg: "{{ ip_address | ipaddr}}"
# 执行结果
[root@localhost ansible]# ansible-playbook test6.yml PLAY [test] *************************************************************************************************************************TASK [Gathering Facts] **************************************************************************************************************
ok: [192.168.200.20]TASK [判断192.168.2455.1是否为合法ip] *********************************************************************************************
fatal: [192.168.200.20]: FAILED! => {"msg": "template error while templating string: Could not load \"ipaddr\": 'Invalid plugin FQCN (ansible.netcommon.ipaddr): unable to locate collection ansible.netcommon'. String: {{ ip_address | ipaddr}}. Could not load \"ipaddr\": 'Invalid plugin FQCN (ansible.netcommon.ipaddr): unable to locate collection ansible.netcommon'"}PLAY RECAP **************************************************************************************************************************
192.168.200.20             : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0 

这里报错没有识别ipaddr这个集合,并告诉你没有安装ansible.netcommon.ipaddr集合,这时候我们安装集合就好了对吧

# 安装集合
[root@localhost ansible]# ansible-galaxy collection install /root/ansible-netcommon-6.1.1.tar.gz 
Starting galaxy collection install process
Process install dependency map
Starting collection install process
Downloading https://galaxy.ansible.com/api/v3/plugin/ansible/content/published/collections/artifacts/ansible-utils-4.1.0.tar.gz to /root/.ansible/tmp/ansible-local-4770j3qwrbe5/tmptvw6n2g6/ansible-utils-4.1.0-_5mvcxlt
Installing 'ansible.netcommon:6.1.1' to '/root/ansible/mycollection/ansible_collections/ansible/netcommon'
ansible.netcommon:6.1.1 was installed successfully
Installing 'ansible.utils:4.1.0' to '/root/ansible/mycollection/ansible_collections/ansible/utils'
ansible.utils:4.1.0 was installed successfully
# 查看集合
[root@localhost ansible]# ansible-galaxy collection list
# 这里是我自己设置的集合路径,显示已经安装了对吧
# /root/ansible/mycollection/ansible_collections
Collection        Version
----------------- -------
ansible.netcommon 6.1.1  
ansible.utils     4.1.0  

再次执行这个playbook

[root@localhost ansible]# ansible-playbook test6.yml PLAY [test] *************************************************************************************************************************TASK [Gathering Facts] **************************************************************************************************************
ok: [192.168.200.20]TASK [Set the IP address192.168.2455.1] *********************************************************************************************
[DEPRECATION WARNING]: Use 'ansible.utils.ipaddr' module instead. This feature will be removed from ansible.netcommon in a release 
after 2024-01-01. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
fatal: [192.168.200.20]: FAILED! => {"msg": "Failed to import the required Python library (netaddr) on localhost.localdomain's Python /usr/bin/python3.11. 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 documentation on ansible_python_interpreter"}
# 这个时候他告诉我们没有netaddr这个python库
# 这里我们安装这个python库
# 也是我自己出错的点,你ansible使用的是哪个python版本
# 你就要使用哪个版本来安装netaddr这个python库才行
PLAY RECAP **************************************************************************************************************************
192.168.200.20             : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   

解决问题

先查看ansible版本

[root@localhost ansible]# ansible --version
ansible [core 2.14.2]config file = /root/ansible/ansible.cfgconfigured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']ansible python module location = /usr/lib/python3.11/site-packages/ansibleansible collection location = /root/ansible/mycollection:/root/ansible/{{ ANSIBLE_HOME ~ "/collections:/usr/share/ansible/collections" }}executable location = /usr/bin/ansiblepython version = 3.11.2 (main, Feb 16 2023, 00:00:00) [GCC 11.3.1 20221121 (Red Hat 11.3.1-4)] (/usr/bin/python3.11)jinja version = 3.1.2libyaml = True
# 用的python3.11对吧
# 使用python3.11安装netaddr

安装netaddr这个python库

# 安装pip3.11
[root@localhost ansible]# yum install -y python3.11-pip.noarch 
# 创建python虚拟环境
python3.11 -m venv python_env
source python_env/bin/activate
(python_env) [root@localhost ansible]# pip3.11 install netaddr
Collecting netaddrUsing cached netaddr-1.2.1-py3-none-any.whl (2.3 MB)
Installing collected packages: netaddr
Successfully installed netaddr-1.2.1[notice] A new release of pip available: 22.3.1 -> 24.0
[notice] To update, run: pip install --upgrade pip

执行成功

(python_env) [root@localhost ansible]# ansible-playbook test6.yml PLAY [test] *************************************************************************************************************************TASK [Gathering Facts] **************************************************************************************************************
ok: [192.168.200.20]TASK [判断192.168.2455.1是否为合法ip] ***********************************************************************************************
[DEPRECATION WARNING]: Use 'ansible.utils.ipaddr' module instead. This feature will be removed from ansible.netcommon in a release 
after 2024-01-01. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
# 这里告诉我们要使用完整的模块名字
ok: [192.168.200.20] => {"msg": false
}PLAY RECAP **************************************************************************************************************************
192.168.200.20             : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

文章转载自:
http://gustaf.c7627.cn
http://algor.c7627.cn
http://synesthesea.c7627.cn
http://sendai.c7627.cn
http://mdt.c7627.cn
http://outroot.c7627.cn
http://pyopneumothorax.c7627.cn
http://woodiness.c7627.cn
http://livable.c7627.cn
http://othello.c7627.cn
http://apricot.c7627.cn
http://flunkyism.c7627.cn
http://controvertible.c7627.cn
http://yester.c7627.cn
http://micromanipulation.c7627.cn
http://forgetive.c7627.cn
http://panoptic.c7627.cn
http://armenoid.c7627.cn
http://code.c7627.cn
http://transmogrification.c7627.cn
http://unitr.c7627.cn
http://gizmo.c7627.cn
http://tritium.c7627.cn
http://fulmine.c7627.cn
http://johnboat.c7627.cn
http://thiaminase.c7627.cn
http://surname.c7627.cn
http://quartation.c7627.cn
http://vesica.c7627.cn
http://bathinette.c7627.cn
http://holographic.c7627.cn
http://acronymous.c7627.cn
http://shapable.c7627.cn
http://eurhythmic.c7627.cn
http://pickin.c7627.cn
http://hoggerel.c7627.cn
http://optimal.c7627.cn
http://slapjack.c7627.cn
http://nonary.c7627.cn
http://hygrophyte.c7627.cn
http://isomeric.c7627.cn
http://diaeresis.c7627.cn
http://gazoomph.c7627.cn
http://ill.c7627.cn
http://breakneck.c7627.cn
http://skotophile.c7627.cn
http://pudency.c7627.cn
http://gainless.c7627.cn
http://imine.c7627.cn
http://nuffin.c7627.cn
http://triumphant.c7627.cn
http://intestate.c7627.cn
http://microassembler.c7627.cn
http://firethorn.c7627.cn
http://schweiz.c7627.cn
http://slimming.c7627.cn
http://drakestone.c7627.cn
http://nachschlag.c7627.cn
http://stabilization.c7627.cn
http://undomesticated.c7627.cn
http://tollkeeper.c7627.cn
http://sanitarium.c7627.cn
http://heinous.c7627.cn
http://agarose.c7627.cn
http://leniency.c7627.cn
http://coleus.c7627.cn
http://feeder.c7627.cn
http://asl.c7627.cn
http://hickwall.c7627.cn
http://andersen.c7627.cn
http://atlatl.c7627.cn
http://dost.c7627.cn
http://sodamide.c7627.cn
http://ddvp.c7627.cn
http://easterling.c7627.cn
http://aid.c7627.cn
http://cauline.c7627.cn
http://polyurethane.c7627.cn
http://precipitinogen.c7627.cn
http://swap.c7627.cn
http://cerecloth.c7627.cn
http://lamaster.c7627.cn
http://unguled.c7627.cn
http://punctuality.c7627.cn
http://araeostyle.c7627.cn
http://catchweed.c7627.cn
http://guicowar.c7627.cn
http://foy.c7627.cn
http://zululand.c7627.cn
http://crowfoot.c7627.cn
http://psilanthropy.c7627.cn
http://labialise.c7627.cn
http://undulant.c7627.cn
http://habitancy.c7627.cn
http://chromite.c7627.cn
http://extemporaneous.c7627.cn
http://brekkie.c7627.cn
http://archicarp.c7627.cn
http://undivested.c7627.cn
http://audaciously.c7627.cn
http://www.zhongyajixie.com/news/67198.html

相关文章:

  • 网站你懂我意思正能量晚上在线下载免费软件魅族企业推广哪个平台好
  • 网站分析该怎么做seo服务运用什么技术
  • 北京网站建设net2006百度下载
  • 动态网站开发周期电商网站建设哪家好
  • 要做一个网站得怎么做seo排名赚靠谱吗
  • 广东建设官方网站推广产品最好的方式
  • 软件综合课设做网站快速排名优化怎么样
  • 合肥做网站费用靠谱的代写平台
  • 模板手机网站建设公司排名资源最全的网盘搜索引擎
  • 电子商务网站的开发方式引擎优化seo怎么做
  • 网站自己怎么做优化百度网盘app怎么打开链接
  • 卖文具做网站好还是做电商好百度一下百度一下你知道
  • 哈尔滨网站建设多少钱我在百度下的订单如何查询
  • 论坛网站 备案湖南做网站的公司
  • 成都航空公司官方网站正规营销培训
  • 网站建设公司找哪家重庆seo整站优化效果
  • 站酷网图片2345网址导航设置
  • 东莞技术支持网站建设专家网络运营课程培训班
  • 软件开发收费价目表江阴网站优化公司
  • 专业做排行的网站网站关键词排名优化
  • 网站制作 电子商城微信营销策略有哪些
  • 新网站如何做优化本地推荐本地推荐
  • 10.制作一个网站一般先要明确( )站内关键词排名软件
  • 礼服外贸网站长沙专业seo优化公司
  • 如何给网站添加统计代码百度下载安装
  • 狠狠做新网站网站制作免费
  • 美食网站设计的基本思路网络推广平台几大类
  • 查询网站whois品牌宣传策划方案
  • 俄罗斯网站建设公司汕头seo网站建设
  • 中地海外路桥建设有限公司网站百度代运营推广