Ansible ec2: “boto required for this module”

前端 未结 1 997
情深已故
情深已故 2021-01-01 21:01

When I run this simple Ansible playbook:

- name: EC2 Test Example
  hosts: localhost
  connection: local
  gather_facts: False

  tasks:
  - name: EC2 Instan         


        
1条回答
  •  执笔经年
    2021-01-01 21:52

    The root cause of your problem is the -i localhost, hack. You don't need to use it anymore in Ansible.

    You can just run:

    ansible-playbook playbook.yml
    

    And with connection: local in the play Ansible will use the Python executable set by venv.


    When you use the -i localhost, hack, Ansible calls its default /usr/bin/python.

    In this case you still can add the ansible_python_interpreter parameter to tell Ansible to use this specific environment:

    ansible-playbook -i localhost, playbook.yml --extra-vars "ansible_python_interpreter=/Users/admin/temp/ansec2/venv/bin/python" 
    

    But I think you should avoid it and use the first method.

    0 讨论(0)
提交回复
热议问题