我正在努力学习ansible和开始配置。毕竟,在group_vars和my makefile中指定sshkey的路径之类的配置。不知何故,我还是无法完成这项任务。
运行“ansible”游戏手册时出错
在运行ansible-playbook provision_instances.yml时,我会得到以下错误。我似乎拒绝连接到本地主机。
之后,我运行了make - add-ssh,然后我尝试了ansible-playbook provision_instances.yml。
`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"
}Pip列表给了我
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发布于 2022-01-01 18:18:29
module_stderr告诉您Ansible找不到Python解释器。您需要将其设置在某个地方,例如在库存中。根据您的情况,您可能必须更改实际路径。应该像这样。
[groupname]
ansible_python_interpreter=/usr/bin/python3还可以通过设置变量将其设置在剧本本身中。
- hosts: localhost
vars:
ansible_python_interpreter: /usr/bin/python3
tasks:
.....https://stackoverflow.com/questions/70549472
复制相似问题