[ansible-project] Ansible winrm problem

2016-03-30 Thread David O'Brien
Hi guys, I'm spinning up EC2 instances on AWS and I'm getting the following error: TASK [setup] *** <10.178.73.194> ESTABLISH WINRM CONNECTION FOR USER: Administrator on PORT 5986 TO 10.178.73.194 fatal: [ip-10-178-73-194.ap-southea

[ansible-project] How can i specify --rm with Docker run command to make sure the containers are cleaned up on exit ?

2016-03-30 Thread ishan jain
As per the Docker docs for Docker run - https://docs.docker.com/engine/reference/run/ In the section clean up, it is mentioned that - *to automatically clean up the container and remove the file system when the container exits, you can add the --rm flag* But i can't see any option in Ansible's

Re: [ansible-project] How to pass inventory information to modules

2016-03-30 Thread James Martin
Miroslav, Here is one work around -- design your inventory something like this: [routers] router1 ansible_connection=local router_user=foo router_password=bar router2 ansible_connection=local router_user=baz router_password=biz router3 ansible_connection=local router_user=fax router_passwor

Re: [ansible-project] How to pass inventory information to modules

2016-03-30 Thread Brian Coca
On Wed, Mar 30, 2016 at 3:13 PM, Miroslav Hudec wrote: > That's why I decided to make a piece of code that would go trough the > hosts file and read usernames etc. for each host. But at this point I've > realized that I don't know how to tell that module the name of the host to > look for. When t

Re: [ansible-project] Ansible lineinfile not working as expected (newbie question)

2016-03-30 Thread Matt Martz
You haven't actually created a group reference. You have to wrap what you want to reference in () to create a group So maybe something like: regexp='^(This.*)' line='#\\1' On Wednesday, March 30, 2016, Boyd J wrote: > I'm learning Ansible for a new project, and I'm stuck on what looks like a

Re: [ansible-project] Different ssh behavior on Linux and MacOSX

2016-03-30 Thread Brian Coca
Change the default transport to ssh and set `connection: paramiko` for the tasks that use the password and push the keys. That should minimize the issue, for browny points set the connection conditionally to paramiko when localhost is OS X. -- Brian Coca -- You received this message bec

Re: [ansible-project] Re: Ansible Vault

2016-03-30 Thread Brian Coca
you can also do this: group_vars//vault.yml You can have multiple files on a group named dir. -- -- Brian Coca -- 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, sen

[ansible-project] Ansible lineinfile not working as expected (newbie question)

2016-03-30 Thread Boyd J
I'm learning Ansible for a new project, and I'm stuck on what looks like a basic issue. Using lineinfile with backrefs and \1 doesn't work for me. Simplified playbook to comment out a line starting with "This": --- - hosts: localhost tasks: - name: comment out This lineinfile: dest=test

Re: Correct quoting of arguments for raw module (was: [ansible-project] Bootstrapping FreeBSD with Ansible 2.0: RAW module does not work anymore?)

2016-03-30 Thread Uditha Desilva
Quoting the "=" seems to do the trick at least in my trivial test: $ ansible -v -m raw -a 'env -i ABC\=blah /usr/bin/printenv' localhost Using /etc/ansible/ansible.cfg as config file localhost | SUCCESS | rc=0 >> ABC=blah On Tuesday, 29 March 2016 19:49:37 UTC+1, Johannes Kastl wrote: > > Am 29.

[ansible-project] Re: not able to match a string in a var list.

2016-03-30 Thread Uditha Desilva
Looks to me like you're actually building a dict of dicts, rather than a simple list. For example, this works for me: --- - hosts: localhost vars: deploy: api: app:v2.41.0 develop:v0.23.2 tool: v0.24.0 consumers: v0.16.0

Re: [ansible-project] not able to match a string in a var list.

2016-03-30 Thread Uditha Desilva
Looks to me like you're actually building a list of dicts, rather than a simple list. For example, this works for me: --- - hosts: localhost vars: deploy: api: app:v2.41.0 develop:v0.23.2 tool: v0.24.0 consumers: v0.16.0

Re: [ansible-project] Re: Ansible Vault

2016-03-30 Thread Johannes Kastl
Am 30.03.16 schrieb Arbab Nazar: > just create the all directory inside the /etc/ansible/group_vars/ > and move the azureservers.yml vault.yml windows.yml winservers.yml > inside it. That complete contradicts the 'one file per group' scheme that is the basis for the group_vars folder. Just cop

[ansible-project] How to pass inventory information to modules

2016-03-30 Thread Miroslav Hudec
Hello everyone, as a part of my Bachelor thesis I'm trying to make few modules for ansible, which would be used to configure MikroTik devices using API. I'm currently having troubles finding a way to "tell" the module things like hostname, username and password. I have these stored in hosts fil

Re: [ansible-project] How can you set multiple hosts on the same machine with dynamic inventories

2016-03-30 Thread Uditha Desilva
Are you sure that's quite right? I'd have expected the "ansible_host" value within each host entry to be the same, otherwise you wouldn't have had the problem in the first place...? On Wednesday, 30 March 2016 17:05:05 UTC+1, ryangr...@outlook.com wrote: > > Thanks for your (quick!) suggestion.

[ansible-project] Re: Ansible Vault

2016-03-30 Thread Uditha Desilva
"vault.yml" is not a magical filename, you still need to use a "use_vars:" task to pull in the contents of that file. If you have provided the vault password (either via --ask-vault or via a vault password file), then that file will be decrypted and the variables within it will be evaluated. On

[ansible-project] Re: Ansible Hosts

2016-03-30 Thread John Buxton
I see you've posted this the Development Ansible group too. See my answer over there. On Wednesday, 30 March 2016 14:46:22 UTC+1, anil kumar wrote: > > When I try playbook I see below error > > > ok: [resoxapp-ch2f-01c.email.comcast.net] > > ERROR! the field 'hosts' is required but was not set > >

[ansible-project] Re: Ansible Hosts

2016-03-30 Thread John Buxton
See my answer here: https://groups.google.com/forum/#!topic/ansible-devel/hzCOJJT9qyE On Wednesday, 30 March 2016 14:46:22 UTC+1, anil kumar wrote: > > When I try playbook I see below error > > > ok: [resoxapp-ch2f-01c.email.comcast.net] > > ERROR! the field 'hosts' is required but was not set >

[ansible-project] Best practices for multiple data centers and multi tenancy

2016-03-30 Thread Yves Vogl
Hi, I'm a former Chef user and recently gave Ansible a try because of its lightweight and agentless approach. I'm wondering how I should structure my inventories to meet my requirements: 1. I have different customers for whom I manage a certain number of servers. 2. Customers are distributed o

Re: [ansible-project] Re: Ansible Vault

2016-03-30 Thread Arbab Nazar
just create the all directory inside the /etc/ansible/group_vars/ and move the azureservers.yml vault.yml windows.yml winservers.yml inside it. On Wed, Mar 30, 2016 at 9:59 PM, Mark Matthews wrote: > Hi Arbab > > So currently I have /etc/ansible/group_vars and in that folder I have the > foll

[ansible-project] Re: Possible to set Serial per task ( needed when using delegate_to ) ?

2016-03-30 Thread lukasz . leszczuk
When I tried to use it I'm getting error: FAILED! => {"failed": true, "reason": "ERROR! this task 'serialize' has > extra params, which is only allowed in the following modules: command, > shell, script, include, include_vars, add_host, group_by, set_fact, raw > , meta\n\nThe error appears to ha

[ansible-project] Re: Ansible Vault

2016-03-30 Thread Mark Matthews
Hi Arbab So currently I have /etc/ansible/group_vars and in that folder I have the following: azureservers.yml vault.yml windows.yml winservers.yml Do you want me to now create the following folder, /etc/ansible/group_vars/all Or must it be a new group_vars folder structure, /etc/ansible/g

[ansible-project] Re: ansible won't install python-keyczar on selected hosts - manual apt-get install python-keyczar -y works

2016-03-30 Thread Arbab Nazar
did you make the become: yes in your playbook? and also change the state=present try this and let us know. On Wednesday, March 30, 2016 at 8:24:55 PM UTC+5, Stuart Cracraft wrote: > > I get this series of errors when trying to do a service install using the > apt module with Ansible on an Ubunt

[ansible-project] Re: Ansible Vault

2016-03-30 Thread Arbab Nazar
can you create the directory /etc/ansible/group_vars folder/all and put everything in it instead of /etc/ansible/group_vars folder? On Wednesday, March 30, 2016 at 9:51:21 PM UTC+5, Mark Matthews wrote: > > Hi > > Its definitely a step further! > > But I get the following error now: > fatal: [10

[ansible-project] Re: Ansible Vault

2016-03-30 Thread Mark Matthews
Hi Its definitely a step further! But I get the following error now: fatal: [10.10.3.168]: FAILED! => {"failed": true, "msg": "'winservers_password' is undefined"} Its as if it doesn't know where to look for the variable? Should it just know to ready the variable from the 'vault.yml' file?

[ansible-project] Re: Ansible Vault

2016-03-30 Thread Jorge L.
What about: ansible_ssh_pass: "{{ winservers_password }}" ? On Wednesday, March 30, 2016 at 6:25:50 PM UTC+2, Mark Matthews wrote: > > Hi > > I am am trying to setup Ansible vault and running into errors. > > In my /etc/ansible/group_vars folder I have muliple vars files for > specific server g

[ansible-project] Ansible Vault

2016-03-30 Thread Mark Matthews
Hi I am am trying to setup Ansible vault and running into errors. In my /etc/ansible/group_vars folder I have muliple vars files for specific server groups in the host files. These vars files (winservers.yml) have the servers login details...for example: ansible_ssh_user: Administrator ansible_

Re: [ansible-project] How can you set multiple hosts on the same machine with dynamic inventories

2016-03-30 Thread ryangrannell
> > Thanks for your (quick!) suggestion. That worked perfectly, thank you. > For reference by anyone reading this question, the working solution looks > roughly like this: > { "example-1": { "vars": { "ansible_host": "example-1.com", "ansible_port": 5513

[ansible-project] ansible won't install python-keyczar on selected hosts - manual apt-get install python-keyczar -y works

2016-03-30 Thread Stuart Cracraft
I get this series of errors when trying to do a service install using the apt module with Ansible on an Ubuntu 14.x box. On most of the other Ubuntu 14.x boxes it works fine. There's a handful that it doesn't run on. The relevant area of the playbook in tasks main yaml: - name: Install the re

Re: [ansible-project] How can you set multiple hosts on the same machine with dynamic inventories

2016-03-30 Thread Matt Martz
Just as with ini formatted inventories, if you want to use the same IP or hostname for 2 different "hosts", you need to create an alias for them, and specify the hostname using ansible_host (ansible_ssh_host for versions before v2) An ini would look like: host1 ansible_host=example-0.com ansible_

[ansible-project] Re: Escape special characters in a variable

2016-03-30 Thread Baptiste BOUCHEREAU
The urlencode filter works perfectly, it's simple and elegant. Thanks a lot! Le mercredi 30 mars 2016 15:46:33 UTC+2, Baptiste BOUCHEREAU a écrit : > > Hello, > > I am facing an issue trying to clone a git repository. Whenever the user > has a password with '@' or ':' the authentication failed b

[ansible-project] How can you set multiple hosts on the same machine with dynamic inventories

2016-03-30 Thread ryangrannell
Hi, I'm currently setting up two VMs that are accessible behind a single domain name but on different ports. I cannot figure out how to specifiy host-vars seperately for each host. My aim is to allow ansible to SSH into each of these machines; I'm not currently using hostvars for anything else

[ansible-project] Re: HowTo: combine two lists in vars section/file

2016-03-30 Thread Jard Leex
To make my request a bit more clear: I'd like to have the entries of *level1keyB* in the path list of the hostname bar. The key 'addonpath' is just an guessed construct by me. Maybe this would also work. - level1keyA: - hostname: foo state: present path:

[ansible-project] Re: HowTo: combine two lists in vars section/file

2016-03-30 Thread Jard Leex
To make my request a bit more clear: I'd like to add the entries of level1keyB to the list 'path' in the specific 'level1keyA' entry with the 'hostname' "bar". Hope that helps a bit. Thank you. Am Mittwoch, 30. März 2016 15:46:22 UTC+2 schrieb Jard Leex: > > Hello together, > > i'd like to co

Re: [ansible-project] Escape special characters in a variable

2016-03-30 Thread Matt Martz
You could probably use the `urlencode` filter provided by jinja2 ( http://jinja.pocoo.org/docs/dev/templates/#urlencode) repo_ssh_url: "https://{{ repository_login }}:{{ repository_password|urlencode }}@bitbucket.org/path/project.git" On Wed, Mar 30, 2016 at 7:48 AM, Baptiste BOUCHEREAU < baptis

[ansible-project] How to display JSON when async does not return valid JSON

2016-03-30 Thread Ed
Hi, I'm trying to debug a problem where Ansible is reporting that the async task failed to return valid JSON. Is there a way to see the invalid JSON content that was returned? I'm running into a response similar to what's described in this post

[ansible-project] Escape special characters in a variable

2016-03-30 Thread Baptiste BOUCHEREAU
Hello, I am facing an issue trying to clone a git repository. Whenever the user has a password with '@' or ':' the authentication failed because the repo url become invalid. Here is the configuration. vars_prompt: - name: "repository_login" prompt: "Type in your bitbucket login" - name

[ansible-project] Ansible Hosts

2016-03-30 Thread anil kumar
When I try playbook I see below error ok: [resoxapp-ch2f-01c.email.comcast.net] ERROR! the field 'hosts' is required but was not set my inventory file [hosts] resoxapp-ch2f-01c.email.comcast.net resoxapp-ch2f-02c.email.comcast.net resoxui-ch2f-02c.email.comcast.net resoxui-ch2f-01c.ema

[ansible-project] use environment variables of the remote host

2016-03-30 Thread mondher khas
environment variables - Hello , i use ansible to run tasks in remote machine , i want to work with variables from this remote machine . i tried to use lookup module but it return the variables of my machine to the remote one . i have no idea haw to do it . thanks in advance. ANS

[ansible-project] HowTo: combine two lists in vars section/file

2016-03-30 Thread Jard Leex
Hello together, i'd like to combine two lists directly in a vars section/file. I've tried the combine filter but as i understood it, it is for dicts and not lists. Also the union filter did not worked for me as i tried it I assume that i did something wrong. Can someone here make the example be

[ansible-project] [os_port] Add allowed-address-pairs to an existing openstack server port

2016-03-30 Thread Jorge L.
I want to set up nginx HA with keepalived and I'm preparing an ansible role for this purpose in an openstack environment (I'm using ansible 2). I would like to update the server port, that is already existing, to add allowed_address_pairs with a single pair (the virtual IP and the host mac addr

Re: [ansible-project] Ansible 2 upgrade broke roles directory lookup

2016-03-30 Thread Johannes Kastl
Am 28.03.16 schrieb Alastair Brayne: > My `sites.yml` looks like: > > - include: roles/ec2/tasks/load_ec2_group_foo.yml > > - hosts: foo > roles: > - common > - java Any reason why you are not using that like your other roles? - hosts: foo roles: - common - java - ec2

Re: [ansible-project] unarchive always unzips

2016-03-30 Thread Dag Wieers
On Tue, 2 Feb 2016, Tuomas-Matti Soikkeli wrote: I believe it's because zip doesn't support it like tar does. So I suppose there is no fix for that other than manually comparing the contents with python ZipFile api. Unfortunately zip lacks most of the unixy features which tar provides like user/

Re: [ansible-project] strange issue when using variable in shell module

2016-03-30 Thread Cai Elvis
I think it works, please see my whole yml file. --- # file: test.yml - hosts: mytest gather_facts: yes roles: - role: dnsclient nameservers: - 1.1.1.1 - 2.2.2.2 - 3.3.3.3 search: - sh.cn.ao.abcompany.se - cn.ao.abcompany.se - ao.ab

Re: [ansible-project] strange issue when using variable in shell module

2016-03-30 Thread Cai Elvis
I think it works, please see my whole yml file. --- # file: test.yml - hosts: mytest gather_facts: yes roles: - role: dnsclient nameservers: - 1.1.1.1 - 2.2.2.2 - 3.3.3.3 search: - sh.cn.ao.abcompany.se - cn.ao.abcompany.se - ao.ab

Re: [ansible-project] Different ssh behavior on Linux and MacOSX

2016-03-30 Thread spice
Brian, thnx for answer! Unfortunately, we are using passwords on the initial deployment phase, keys are used later For avoiding problem in this case we use simple trick in our playebooks - name: Finish prepare (restart) vars: ansible_ssh_pass: "{{ new_generated_pass_stored_in_host_

[ansible-project] Re: ec2_win_password comes back empty

2016-03-30 Thread David O'Brien
Solution, wait for the resource to come back with a password: - name: obtain initial passwords for win ec2 instances ec2_win_password: instance_id: "{{ item.id }}" key_file: "~/aws-creds/ec2key.pem" wait: yes wait_timeout: 600 with_items: win_ec2_instances.instances register:

[ansible-project] ec2_win_password comes back empty

2016-03-30 Thread David O'Brien
Hi all, I'm running Ansible 2.0.1 and I'm trying to get a newly provisioned EC2 instance's Windows password. However, something is off. Anybody got an idea? TASK [cube : get the Administrator password] *** task path: /container/ansible/roles/cube/tasks/main.yml:41