Ansible fails with /bin/sh: 1: /usr/bin/python: not found

I’m running into an error I’ve never seen before. Here is the command and the error: $ ansible-playbook create_api.yml PLAY [straw] ****************************************************************** GATHERING FACTS *************************************************************** failed: [104.55.47.224] => {“failed”: true, “parsed”: false} /bin/sh: 1: /usr/bin/python: not found TASK: [typical | install required system packages] ***************************** FATAL: no hosts matched or all hosts have already failed … Read more

Ansible: How to delete files and folders inside a directory?

The below code only deletes the first file it gets inside the web dir. I want to remove all the files and folders inside the web directory and retain the web directory. How can I do that? – name: remove web dir contents file: path=”/home/mydata/web/{{ item }}” state=absent with_fileglob: – /home/mydata/web/* Note: I’ve tried rm … Read more

How to ignore ansible SSH authenticity checking?

Is there a way to ignore the SSH authenticity checking made by Ansible? For example when I’ve just setup a new server I have to answer yes to this question: GATHERING FACTS *************************************************************** The authenticity of host ‘xxx.xxx.xxx.xxx (xxx.xxx.xxx.xxx)’ can’t be established. RSA key fingerprint is xx:yy:zz:…. Are you sure you want to continue connecting … Read more

How to run only one task in ansible playbook?

Is there a way to only run one task in ansible playbook? For example, in roles/hadoop_primary/tasks/hadoop_master.yml. I have “start hadoop job tracker services” task. Can I just run that one task? hadoop_master.yml file: # Playbook for Hadoop master servers – name: Install the namenode and jobtracker packages apt: name={{item}} force=yes state=latest with_items: – hadoop-0.20-mapreduce-jobtracker – … Read more

Safely limiting Ansible playbooks to a single machine?

I’m using Ansible for some simple user management tasks with a small group of computers. Currently, I have my playbooks set to hosts: all and my hosts file is just a single group with all machines listed: # file: hosts [office] imac-1.local imac-2.local imac-3.local I’ve found myself frequently having to target a single machine. The … Read more

Specify sudo password for Ansible

How do I specify a sudo password for Ansible in non-interactive way? I’m running Ansible playbook like this: $ ansible-playbook playbook.yml -i inventory.ini \ –user=username –ask-sudo-pass But I want to run it like this: $ ansible-playbook playbook.yml -i inventory.ini \ –user=username` **–sudo-pass=12345** Is there a way? I want to automate my project deployment as much … Read more