【发布时间】:2022-01-01 14:23:54
【问题描述】:
我正在尝试学习 ansible 并开始配置。在完成所有配置之后,例如在 group_vars 和我的 makefile 中指定 sshkey 的路径。我仍然不知何故无法完成任务。
运行 ansible playbook 时出错
运行ansible-playbook provision_instances.yml 时出现以下错误。我似乎拒绝连接到本地主机。
我在尝试 ansible-playbook provision_instances.yml 之后运行了 make add-ssh
`TASK [security_groups : Create Network Security Group]********************************************************************************************`
The full traceback is:
Traceback (most recent call last):
File "/tmp/ansible_azure_rm_securitygroup_payload_vkggeut2/ansible_azure_rm_securitygroup_payload.zip/ansible_collections/azure/azcollection/plugins/module_utils/azure_rm_common.py", line 249, in <module>
from azure.mgmt.privatedns import PrivateDnsManagementClient
ModuleNotFoundError: No module named 'azure.mgmt.privatedns'
failed: [localhost -> 127.0.0.1] (item={'name': 'database', 'port_rules': [{'name': 'SSH', 'protocol': 'Tcp', 'destination_port_range': 22, 'access': 'Allow', 'priority': 1001, 'direction': 'Inbound', 'source_address_prefix': '0.0.0.0/0'}, {'name': 'MYSQL', 'protocol': 'Tcp', 'destination_port_range': 3306, 'access': 'Allow', 'priority': 1002, 'direction': 'Inbound', 'source_address_prefix': '0.0.0.0/0'}]}) => {
"ansible_loop_var": "group",
"changed": false,
"group": {
"name": "database",
"port_rules": [
{
"access": "Allow",
"destination_port_range": 22,
"direction": "Inbound",
"name": "SSH",
"priority": 1001,
"protocol": "Tcp",
"source_address_prefix": "0.0.0.0/0"
},
{
"access": "Allow",
"destination_port_range": 3306,
"direction": "Inbound",
"name": "MYSQL",
"priority": 1002,
"protocol": "Tcp",
"source_address_prefix": "0.0.0.0/0"
}
]
},
"invocation": {
"module_args": {
"ad_user": null,
"adfs_authority_url": null,
"api_profile": "latest",
"append_tags": true,
"auth_source": "auto",
"cert_validation_mode": null,
"client_id": null,
"cloud_environment": "AzureCloud",
"default_rules": null,
"location": null,
"log_mode": null,
"log_path": null,
"name": "database-sg",
"password": null,
"profile": null,
"purge_default_rules": false,
"purge_rules": true,
"resource_group": "DIDA-IDSA18-DV1617-H21-LP2",
"rules": [
{
"access": "Allow",
"description": null,
"destination_address_prefix": "*",
"destination_application_security_groups": null,
"destination_port_range": 22,
"direction": "Inbound",
"name": "SSH",
"priority": 1001,
"protocol": "Tcp",
"source_address_prefix": "0.0.0.0/0",
"source_application_security_groups": null,
"source_port_range": "*"
},
{
"access": "Allow",
"description": null,
"destination_address_prefix": "*",
"destination_application_security_groups": null,
"destination_port_range": 3306,
"direction": "Inbound",
"name": "MYSQL",
"priority": 1002,
"protocol": "Tcp",
"source_address_prefix": "0.0.0.0/0",
"source_application_security_groups": null,
"source_port_range": "*"
}
],
"secret": null,
"state": "present",
"subscription_id": null,
"tags": {
"StudentId": "idsa18"
},
"tenant": null
}
},
"msg": "Failed to import the required Python library (ansible[azure] (azure >= 2.0.0)) on DESKTOP-BADTR07's Python /usr/bin/python3. 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"
}
点子列表给我
adal 1.2.7
alembic 1.7.5
ansible 4.8.0
ansible-core 2.11.7
applicationinsights 0.11.10
argcomplete 1.12.3
azure 4.0.0
azure-applicationinsights 0.1.0
azure-batch 4.1.3
azure-cli-core 2.26.1
azure-cli-telemetry 1.0.6
azure-common 1.1.11
azure-core 1.21.1
azure-cosmosdb-nspkg 2.0.2
azure-cosmosdb-table 1.0.6
azure-datalake-store 0.0.52
azure-eventgrid 1.3.0
azure-graphrbac 0.61.1
azure-identity 1.7.0
azure-keyvault 1.0.0a1
azure-keyvault-secrets 4.3.0
azure-loganalytics 0.1.1
azure-mgmt 4.0.0
azure-mgmt-advisor 1.0.1
azure-mgmt-apimanagement 0.2.0
azure-mgmt-applicationinsights 0.1.1
azure-mgmt-authorization 0.51.1
azure-mgmt-automation 0.1.1
azure-mgmt-batch 5.0.1
azure-mgmt-batchai 2.0.0
azure-mgmt-billing 0.2.0
azure-mgmt-cdn 3.0.0
azure-mgmt-cognitiveservices 3.0.0
azure-mgmt-commerce 1.0.1
azure-mgmt-compute 10.0.0
azure-mgmt-consumption 2.0.0
azure-mgmt-containerinstance 1.4.0
azure-mgmt-containerregistry 2.0.0
azure-mgmt-containerservice 9.1.0
azure-mgmt-core 1.2.2
azure-mgmt-cosmosdb 0.5.2
azure-mgmt-datafactory 0.6.0
azure-mgmt-datalake-analytics 0.6.0
azure-mgmt-datalake-nspkg 2.0.0
azure-mgmt-datalake-store 0.5.0
azure-mgmt-datamigration 1.0.0
azure-mgmt-devspaces 0.1.0
azure-mgmt-devtestlabs 3.0.0
azure-mgmt-dns 2.1.0
azure-mgmt-eventgrid 1.0.0
azure-mgmt-eventhub 2.0.0
azure-mgmt-hanaonazure 0.1.1
azure-mgmt-hdinsight 0.1.0
azure-mgmt-iotcentral 0.1.0
azure-mgmt-iothub 0.7.0
azure-mgmt-iothubprovisioningservices 0.2.0
azure-mgmt-keyvault 1.1.0
azure-mgmt-loganalytics 1.0.0
azure-mgmt-logic 3.0.0
azure-mgmt-machinelearningcompute 0.4.1
azure-mgmt-managedservices 1.0.0
azure-mgmt-managementgroups 0.2.0
azure-mgmt-managementpartner 0.1.1
azure-mgmt-maps 0.1.0
azure-mgmt-marketplaceordering 0.1.0
azure-mgmt-media 1.0.1
azure-mgmt-monitor 3.0.0
azure-mgmt-msi 0.2.0
azure-mgmt-network 12.0.0
azure-mgmt-notificationhubs 2.0.0
azure-mgmt-nspkg 2.0.0
azure-mgmt-policyinsights 0.1.0
azure-mgmt-powerbiembedded 2.0.0
azure-mgmt-privatedns 0.1.0
azure-mgmt-rdbms 1.9.0
azure-mgmt-recoveryservices 0.4.0
azure-mgmt-recoveryservicesbackup 0.6.0
azure-mgmt-redis 5.0.0
azure-mgmt-relay 0.1.0
azure-mgmt-reservations 0.2.1
azure-mgmt-resource 10.2.0
azure-mgmt-scheduler 2.0.0
azure-mgmt-search 3.0.0
azure-mgmt-servicebus 0.5.3
azure-mgmt-servicefabric 0.2.0
azure-mgmt-signalr 0.1.1
azure-mgmt-sql 0.10.0
azure-mgmt-storage 11.1.0
azure-mgmt-subscription 0.2.0
azure-mgmt-trafficmanager 0.50.0
azure-mgmt-web 0.41.0
azure-nspkg 2.0.0
azure-servicebus 0.21.1
azure-servicefabric 6.3.0.0
azure-servicemanagement-legacy 0.20.7
azure-storage 0.35.1
azure-storage-blob 1.5.0
azure-storage-common 1.4.2
azure-storage-file 1.4.0
azure-storage-queue 1.4.0
bcrypt 3.2.0
boto 2.49.0
boto3 1.20.26
botocore 1.23.26
certifi 2021.10.8
cffi 1.15.0
chardet 4.0.0
click 8.0.3
colorama 0.4.4
cryptography 3.3.2
dnspython 2.1.0
dominate 2.6.0
email-validator 1.1.3
Flask 2.0.2
Flask-Bootstrap 3.3.7.1
Flask-Login 0.5.0
Flask-Migrate 3.1.0
Flask-Moment 1.0.2
Flask-SQLAlchemy 2.5.1
Flask-WTF 0.15.1
greenlet 1.1.2
gunicorn 20.1.0
humanfriendly 9.2
idna 2.10
isodate 0.6.1
itsdangerous 2.0.1
Jinja2 3.0.3
jmespath 0.10.0
knack 0.8.2
Mako 1.1.6
MarkupSafe 2.0.1
msal 1.16.0
msal-extensions 0.3.1
msrest 0.6.21
msrestazure 0.6.4
oauthlib 3.1.1
packaging 21.3
paramiko 2.9.1
pip 21.3.1
pkg_resources 0.0.0
pkginfo 1.8.2
portalocker 1.7.1
psutil 5.9.0
pycparser 2.21
Pygments 2.11.1
PyJWT 2.3.0
PyMySQL 1.0.2
PyNaCl 1.4.0
pyOpenSSL 21.0.0
pyparsing 3.0.6
python-dateutil 2.8.2
python-dotenv 0.19.1
PyYAML 6.0
requests 2.25.1
requests-oauthlib 1.3.0
resolvelib 0.5.4
s3transfer 0.5.0
setuptools 59.6.0
six 1.16.0
SQLAlchemy 1.4.28
tabulate 0.8.9
urllib3 1.26.7
visitor 0.1.3
Werkzeug 2.0.2
WTForms 3.0.0
xmltodict 0.12.0
【问题讨论】:
-
将no_log设置为false进行调试,错误可能是任何东西。
-
请edit your question 并在问题正文中添加代码、日志、输出、错误消息...作为代码块。为此使用图像有numerous disadvantages,并且在必读帮助文章How to ask 中被明确列为不好的做法。谢谢
-
@Zeitounator 现在好点了吗? :)
-
看起来像这样的副本:stackoverflow.com/questions/32429259/…