[ansible-project] Dynamic inventory shows some internal host incorrectly

2017-06-19 Thread Anthony Cheng
I am currently using dynamic inventory with ec2.ini set to use private_dns_name & private_ip_address However certain host in a different subnet are showing up as ip-x.x.x.x.ec2-internal as opposed to just returning their private IP (which they have). Does anyone have an idea why this is happen

[ansible-project] Ansible asks for SSH passphrase if private key is encrypted by vault

2017-05-02 Thread Anthony Cheng
Anyone using ansible vault to encrypt ssh private key? Seems like it will always prompt for passphrase if the key file is encrypted. If the key is not encrypted by vault then it works as is; ansible.cfg has the configuration for the vault passphrase file. Also in my case the ssh file does not h

Re: [ansible-project] Set variable before hosts in playbook?

2017-04-06 Thread Anthony Cheng
Thanks! Somehow I missed that vars (and IDE missed it as well..) On Thursday, April 6, 2017 at 1:38:48 PM UTC-4, Kai Stian Olstad wrote: > > On 06. april 2017 19:32, Anthony Cheng wrote: > > Are you sure that it actually works? It didn't when I tested it (looks >

Re: [ansible-project] Set variable before hosts in playbook?

2017-04-06 Thread Anthony Cheng
Are you sure that it actually works? It didn't when I tested it (looks like order matters). On Thursday, April 6, 2017 at 1:22:43 PM UTC-4, Kai Stian Olstad wrote: > > On 06. april 2017 18:57, Anthony Cheng wrote: > > Is it possible to set variable before hosts in playbook? &

[ansible-project] Set variable before hosts in playbook?

2017-04-06 Thread Anthony Cheng
Is it possible to set variable before hosts in playbook? Something like this doesn't work: var: VARHOSTNAME: test - hosts: "{{ VARHOSTNAME }}" gather_facts: true become: yes I know I can set variable in vars file or pass in environment values at command line but wanted to know if i can ju

[ansible-project] register variable value + string

2016-09-25 Thread Anthony Cheng
Does anyone know how I would go about to register values into variable + string (within a loop), so something like: register: "{{ item }}"_LIST with_items: "{{ LIST.stdout_lines }}" or register: {{ item }}_LIST -- You received this message because you are subscribed to the Google Gr

[ansible-project] Ansible lookup on file format issue

2016-09-23 Thread Anthony Cheng
I have been struggling to use the lookup for vars feature, specifically tried something like: vars: BUCKET_LIST: "{{ lookup('file', 'test') }}" vars: BUCKET_LIST: "{{ lookup('file', 'test') |to_json }}" Where test is basically just a flat text file, new line separated What I want

[ansible-project] Re: JSON formatting on register value.

2016-09-23 Thread Anthony Cheng
FYI I figured it out that I needed to use with_item to parse the JSON. On Thursday, September 22, 2016 at 2:26:10 PM UTC-4, Anthony Cheng wrote: > > I have a playbook that use the S3 module to list items: > > - name: List s3 bucket > local_action: >module: s3 >bucke

[ansible-project] JSON formatting on register value.

2016-09-22 Thread Anthony Cheng
I have a playbook that use the S3 module to list items: - name: List s3 bucket local_action: module: s3 bucket: "{{ S3_BUCKET_NAME }}" mode: list register: S3_LIST_ITEM The result I output to a file using lineinfile: name: Output to folder local_action: module: lineinfile c

[ansible-project] from_json on registered variable

2016-09-22 Thread Anthony Cheng
I have a playbook that use the S3 module to list items: {code} - name: List s3 bucket local_action: module: s3 bucket: "{{ S3_BUCKET_NAME }}" mode: list register: S3_LIST_ITEM {code} The result I output to a file using lineinfile: {code} name: Output to folder local_action:

[ansible-project] Become (priv escalation) on localhost fails for file content lookup

2016-07-26 Thread Anthony Cheng
I think this is a bug (https://github.com/ansible/ansible/issues/16833) where file lookup doesn't get sudo permission on localhost even with become=true. In my testing, shell command on localhost requiring sudo works fine with become=true. -- You received this message because you are subscrib

[ansible-project] Retrieving value from nested list?

2016-07-23 Thread Anthony Cheng
Let's say if I got this ugly debug output (nested list?), how about would I go to retrieve this value? ok: [127.0.0.1] => { "foo.stdout": [ [ [ "bar" ] ] ] } Tried: with_items: "{{ foo.stdout }}" with_items: "{{ foo.stdout[0] }

[ansible-project] Re: Permissions to Create Azure Blob and Container

2016-07-23 Thread Anthony Cheng
Try using debug -vvv and then manually run the command that fails; that should give you some clues as to what kind of issue. On Saturday, July 23, 2016 at 9:27:51 AM UTC-4, bar...@bossanova.com wrote: > > Hello all, > > I'm attempting to use the azure_rm functionality I appear to be having an

[ansible-project] Re: AWS dynamic inventory and filter out unreachable host

2016-07-19 Thread Anthony Cheng
w only «all_instances = False» (by default) in ec2.ini, to exclude > stopped. > Unreachable hosts will be skipped by Ansible, but error messages will be > displayed. > > On Tuesday, July 19, 2016 at 3:59:48 PM UTC+5, Anthony Cheng wrote: >> >> I want to use the ec2

[ansible-project] AWS dynamic inventory and filter out unreachable host

2016-07-19 Thread Anthony Cheng
I want to use the ec2_facts module to gather info, e.g. - hosts: all gather_facts: false become: no tasks: - name: Get instance ec2 facts action: ec2_facts register: ec2_facts Is there a way to filter out the SSH unreachable (maybe not on first run) but maybe give them a specifi

Re: [ansible-project] Re: ssh difference between ansible ad-hoc and ansible-playbook for localhost

2016-07-07 Thread Anthony Cheng
gt; at the same version? > > ansible --version > ansible-playbook --version > > Maybe there's some symlink spaghetti going on or something?? > > If not, that sounds like a bug, I'd file an issue. > > On 7 July 2016 at 20:08, Anthony Cheng > wrote: > >

[ansible-project] Re: ssh difference between ansible ad-hoc and ansible-playbook for localhost

2016-07-07 Thread Anthony Cheng
To be more specific, ad-hoc command checks in ~/.ssh/authorized key whereas playbook does not. I didn't specific any user in the playbook whereas I try to run as root/ubuntu/none with ad-hoc (-u). -- You received this message because you are subscribed to the Google Groups "Ansible Project" g

[ansible-project] ssh difference between ansible ad-hoc and ansible-playbook for localhost

2016-07-07 Thread Anthony Cheng
I noticed in troubleshooting SSH authentication that there is a difference between ansible ad-hoc and ansible-playbook in terms of SSH for localhost. Specifically, I was able to get a playbook targeted at localhost to work but not ansible ad-hoc command targeted at localhost. -- You received t

Re: [ansible-project] Re: What does {{ vars|random }} do ?

2016-07-05 Thread Anthony Cheng
cs.ansible.com/ansible/playbooks_filters.html#random-number-filter > > > On Tuesday, July 5, 2016 at 3:59:08 PM UTC+1, Anthony Cheng wrote: >> >> Looking over some ansible ec2 script I see reference to: >> >> "{{ vars|random }}" >> >> e.g. >> >> vpc

[ansible-project] What does {{ vars|random }} do ?

2016-07-05 Thread Anthony Cheng
Looking over some ansible ec2 script I see reference to: "{{ vars|random }}" e.g. vpc_subnet_id: "{{ ec2_subnet_id|random }}" (http://allandenot.com/devops/2015/01/31/provisioning-ec2-hosts-with-ansible.html) Does this randomly select the variable, if so why would anyone would to do that? -

Re: [ansible-project] Re: Ansible bastion host unreachable?

2016-06-24 Thread Anthony Cheng
ou are attempting to reach set up as the ip that ec2.py > returns (x.x.x.x in your pasted output) in your ~/.ssh/config or as the > devtest3 hostname you connected to in your SSH debug output? > On Jun 22, 2016 9:31 AM, "Anthony Cheng" > wrote: > >> I am trying t

[ansible-project] Re: Ansible bastion host unreachable?

2016-06-22 Thread Anthony Cheng
I am trying to access an EC2 instance with Ansible installed on another EC2 instance; my hosts are setup with a bastion host. I have been following this post http://blog.scottlowe.org/2015/12/24/running-ansible-through-ssh-bastion-host/ which seems fairly straight forward. I can ssh directly

[ansible-project] Re: Ansible bastion host unreachable?

2016-06-22 Thread Anthony Cheng
Here's ssh setting of the ansible.cfg: [ssh_connection] ssh_args = -F /root/.ssh/config -o ControlMaster=auto -o ControlPersist=10m control_path = ~/.ssh/ansible-%%r@%%h:%%p -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from

[ansible-project] Ansible bastion host unreachable?

2016-06-22 Thread Anthony Cheng
I am trying to access an EC2 instance with Ansible installed on another EC2 instance; my hosts are setup with a bastion host. I have been following this post http://blog.scottlowe.org/2015/12/24/running-ansible-through-ssh-bastion-host/ which seems fairly straight forward. I can ssh directly

[ansible-project] Re: yum_repository module (has anyone thought of doing it...)

2016-05-10 Thread Anthony Cheng
New link is here http://docs.ansible.com/ansible/yum_repository_module.html -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@google

[ansible-project] Is there a cache of some sort in vsphere_guest (or possibly pysphere)?

2016-03-07 Thread Anthony Cheng
The reason I am asking is because I made some modification in my playbook /w vsphere_guest module; specifically the host and datastore location but I find that when I run the playbook it is still using the previous host and datastore setting. -- You received this message because you are subscr