[geeks] ansible - aws - nudge needed

Brian Dunbar brian.dunbar at gmail.com
Sun Jun 16 23:17:50 CDT 2013


I'm playing with

AWS EC2
Ansible

What I want to do is,
- Using AWS command line tools on server1, create an EC2 server, server2-
done!
- Using server1, run ansible playbook against server2, copy some files,
execute them.

Runs fine.  Problem is when ansible-playbook runs 'download.sh' on server2
it blows up with ..

stderr: sudo: sorry, you must have a tty to run sudo

Which is _fixable_ by removing that directive from sudoers on server2. But
that's the way it comes from AWS and having to manually hack that file
rather defeats the purpose of having ansible do stuff _for_ me.

Gah.  Help me, please.  Nudge, a hint.  I'm going to wander around and make
coffee and stare at the moon.


The Script

# download.sh
#! /bin/bash
sudo wget -O /tmp/foo.txt http://somewebsite.com/foo.txt

Playbook looks like this

# sampleplaybook.yml
---
- hosts:
  - security_group_bob
  user: ec2-user
  connection: paramiko
  gather_facts: false
  tasks:
  - name: Download Shell
    copy: src=files/download.sh dest=/tmp/ mode=0555
  - name: Exec download
    action: command /tmp/download.sh



-- 
Brian Dunbar

"Display some adaptability"


More information about the geeks mailing list