Re: [ansible-project] How to use ec2 modules user_data field?

2023-02-15 Thread Dick Visser
And your question is? On Wed, 15 Feb 2023 at 21:07, Cesar Ramirez wrote: > Hello Guys, new tot this Group, trying to provision an EC2 Windows using > Ansible with user_data. > > On Friday, October 7, 2016 at 5:21:06 PM UTC-7 einarc wrote: > >> Hey, >> >> You want to put your data in a varia

Re: [ansible-project] How to use ec2 modules user_data field?

2023-02-15 Thread Cesar Ramirez
Hello Guys, new tot this Group, trying to provision an EC2 Windows using Ansible with user_data. On Friday, October 7, 2016 at 5:21:06 PM UTC-7 einarc wrote: > Hey, > > You want to put your data in a variable, let's say in /defaults/main.yml > and then invoke that from the ec2_lc module: > >

Re: [ansible-project] How to use ec2 modules user_data field?

2016-10-07 Thread einarc
Hey, You want to put your data in a variable, let's say in /defaults/main.yml and then invoke that from the ec2_lc module: - ec2_lc: name: "{{env}}-render-premium-{{gitsha}}" ... user_data: "{ {my_user_data }}" I did that exact thing for Launch Configs and it works pref

Re: [ansible-project] How to use ec2 modules user_data field?

2015-12-07 Thread Bryan Larsen
On Friday, 26 December 2014 05:05:33 UTC-5, Catalin Costache wrote: > > Yaml has a notation for multiline string. I set user data like so: > > user_data: | > #!/bin/bash > echo "Defaults:{{admin_user}} !requiretty" > /etc/sudoers.d/ > disable_requiretty > I'm having trouble using th

Re: [ansible-project] How to use ec2 modules user_data field?

2014-12-26 Thread Catalin Costache
Yaml has a notation for multiline string. I set user data like so: user_data: | #!/bin/bash echo "Defaults:{{admin_user}} !requiretty" > /etc/sudoers.d/ disable_requiretty Note the pipeline character. # Join multiple lines without new line value: > part 1 part 2

Re: [ansible-project] How to use ec2 modules user_data field?

2014-12-26 Thread Daniel Neades
Chris, please ignore my previous response, which was premature. I had misinterpreted the (perhaps slightly ambiguous) documentation for the slurp module, and thought that it needed to be given a base64-encoded file. Apparently, it does not. If I give it a raw .tar.xz, your ec2.py revision seems

Re: [ansible-project] How to use ec2 modules user_data field?

2014-12-26 Thread Daniel Neades
Chris, thank you *very* much for looking at that. I have tried your modified ec2.py but, unfortunately, even using it exactly as you describe, the user data is still being stored on AWS in its base64 form. From within the instance: # fetch http://169.254.169.254/latest/user-data # cat user-dat

Re: [ansible-project] How to use ec2 modules user_data field?

2014-12-25 Thread Chris Church
One issue may be that boto is encoding unicode user data into utf-8, then base64-encoding it: https://github.com/boto/boto/blob/develop/boto/ec2/connection.py#L927 So, if we can somehow pass a str() instance to boto instead of a unicode() instance, it'll skip the utf-8 encoding step. I've imple

Re: [ansible-project] How to use ec2 modules user_data field?

2014-12-24 Thread Daniel Neades
Incidentally, I also tried using the file lookup plugin on a base64-encoded tar file, and then filtering that with Jinja2’s b64decode filter. That also fails, though I think it does so at a later stage than trying to use the file lookup plugin on a binary file. Using the b64decode filter on a l

Re: [ansible-project] How to use ec2 modules user_data field?

2014-12-24 Thread Daniel Neades
On Saturday, 25 October 2014 20:33:32 UTC+1, Chris Church wrote: > > The file lookup plugin is your friend. > It is – if one wishes to supply text-based user data. Unfortunately, I have a requirement to provide a binary blob of user data, and the file lookup plugin does not seem to handle that –

Re: [ansible-project] How to use ec2 modules user_data field?

2014-12-19 Thread Chris Church
I'm planning to get some of these roles onto Galaxy, but until then... The next tasks in that particular play are: - name: wait for instances to listen on port 5986 (winrm https) wait_for: state=started host={{ item.tagged_instances[0].public_ip }} port=5986 with_items: win_ec2.re

Re: [ansible-project] How to use ec2 modules user_data field?

2014-12-17 Thread Rob White
Hi Chris, What's your approach for logging in to your Win boxes using WinRM after this step? Ansible docs direct you to configure a vars file with ansible_ssh_pass set however every ec2 instance is going to have a different password. I've created a module for using boto to get the ec2 passwor

Re: [ansible-project] How to use ec2 modules user_data field?

2014-10-25 Thread Chris Church
The file lookup plugin is your friend. I'm using the following task for launching Windows instances and configuring PowerShell remoting: - ec2: aws_access_key: '{{ aws_access_key }}' aws_secret_key: '{{ aws_secret_key }}' region: '{{ win_ec2_region }}' instance_type: '{{ win_ec2_i

Re: [ansible-project] How to use ec2 modules user_data field?

2014-10-24 Thread Michael DeHaan
I don't believe YAML takes Python-like docstrings. So you would need to start with a single or double quote and escape any internal quotes as need be. The "file" lookup plugin may also be helpful. On Fri, Oct 24, 2014 at 12:06 PM, Erick Barros wrote: > I got the following error: > > ERROR: Syn

Re: [ansible-project] How to use ec2 modules user_data field?

2014-10-24 Thread Erick Barros
I got the following error: ERROR: Syntax Error while loading YAML script, /etc/ansible/playbooks/search /roles/aws/tasks/main.yml Note: The error may actually appear before this position: line 13, column 17 state: running user_data: """#!/bin/bash ^ This one looks easy to f

Re: [ansible-project] How to use ec2 modules user_data field?

2014-08-16 Thread Michael DeHaan
(a) can you please show the line from your playbook where you are using the user data variable? (b) with the above, how are you determining the way it fails? I.e. what does failure look like? On Fri, Aug 15, 2014 at 5:36 PM, Jonathan Nakatsui wrote: > From the ansible docs the ec2 module (

[ansible-project] How to use ec2 modules user_data field?

2014-08-15 Thread Jonathan Nakatsui
>From the ansible docs the ec2 module (http://docs.ansible.com/ec2_module.html) mentions a user_data field. However, there is no example showing the use of user_data. I've tried a variety of things to pass through to the user field to no avail including user_data: file.txt user_data: "{{ look