0

I am using below ansible yml file to install python, pip, etc.

roles/python/main.yml:

---

- name: python
  apt:
    pkg: python

- name: python-pip
  apt:
    pkg: python-pip

- name: mongopy
  pip:
    pkg: mongopy

- name: mtools
  pip:
    pkg: mtools

when I run ansible-playbook on this script, I get below

PLAY [ec2] ***********************************************************************************************************************************************************************************************

TASK [Gathering Facts] ***********************************************************************************************************************************************************************************
ok: [xxxxx.ap-southeast-2.compute.amazonaws.com]

PLAY RECAP ***********************************************************************************************************************************************************************************************
xxxxxap-southeast-2.compute.amazonaws.com : ok=1    changed=0    unreachable=0    failed=0

there is no error on them but I checked these apps are not installed on the remote host. What wrong with my yml file? Is there any place I can check what the error is?

below is my playbook:

python.yml:

---

- hosts: ec2
  remote_user: ubuntu
  roles:
    - python

below is the command I run:

ansible-playbook -i hosts python.yml

techraf
  • 64,883
  • 27
  • 193
  • 198
Joey Yi Zhao
  • 37,514
  • 71
  • 268
  • 523

1 Answers1

0

There are no tasks in your python role. Please have a look at the role structure.

If roles/x/tasks/main.yml exists, tasks listed therein will be added to the play

Tasks file (main.yml) should be placed in the tasks subdirectory of the role, not in the main role's directory.


And this has nothing to do with how you described the problem (installing Python or Pip). Even if you replaced the tasks with a single debug task which displays Hello world by default, it would not run.

techraf
  • 64,883
  • 27
  • 193
  • 198