I'm running a playbook on localhost, and I've already installed ansible and the required packaged like boto3. The playbook works fine when it is performing tasks on a remote host, but outputs the following error when running locally.
Command:
ansible-playbook app.yaml
Error:
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (botocore or boto3) on DESKTOP-9NTDHK1'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"}
Ansible version:
ansible 2.10.3
config file = /home/user/ansible/ansible.cfg
configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/user/ansible/venv/lib/python3.8/site-packages/ansible
executable location = /home/user/ansible/venv/bin/ansible
python version = 3.8.5 (default, Jul 28 2020, 12:59:40) [GCC 9.3.0]
Boto3 version:
(venv) user@DESKTOP-9NTDHK1:~/ansible$ pip show boto3ersion"
Name: boto3
Version: 1.16.18
Summary: The AWS SDK for Python
Home-page: https://github.com/boto/boto3
Author: Amazon Web Services
Author-email: UNKNOWN
License: Apache License 2.0
Location: /home/user/ansible/venv/lib/python3.8/site-packages
Requires: s3transfer, botocore, jmespath
Required-by:
app.yaml
---
- hosts: localhost
connection: local
gather_facts: no
vars:
user: *****
AWS_PREFIX: *****
tasks:
# provision AWS
- name: Provision VPC
ec2_vpc_net:
cidr_block: *****
region: *****
name: *****
state: present
register: vpc_data