I am trying to learn ansible and starting to configure. After all configuration such as specifying the path for sshkey in group_vars and my makefile. I still somehow cannot succeed with the task.
Error Running ansible playbooks
When running ansible-playbook provision_instances.yml
I get the following error. I seems that it is refusing connection to the localhost.
I ran make add-ssh after that I tried 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 list gives me
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