[geeks] ansible - aws - nudge needed

Brian Dunbar brian.dunbar at gmail.com
Mon Jun 17 01:04:22 CDT 2013


Fixed it.  Next time, he continued talking to himself, read the documents
well _and_ ask for help much sooner.

Inserted these directives in the yml

  sudo_user: root
  sudo: True

And replaced the lame one-liners with actual directives i.e.

 action: command wget -O /tmp/foo.txt http://somewebsite.com/foo.txt

I _think_ the one-liners were an effort to save time because I did not know
about the sudo_user/sudo directives and or there was some confusion about
the action directive in quotes that led me down the wrong trail.

tl:dr shortcuts ain't.




On Sun, Jun 16, 2013 at 11:17 PM, Brian Dunbar <brian.dunbar at gmail.com>wrote:

> 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"
>



-- 
Brian Dunbar

"Display some adaptability"


More information about the geeks mailing list