[ansible-project] inventory file in jenkins server

2016-09-01 Thread Edson Noboru Yamada
I have several hosts to manage and, in order to access them, i have to use a couple of different ssh keys (and I set the ansible_ssh_private_key_file in the inventory file to tell ansible which key to use). The thing is that i've been maintaining 2 inventory files versions (which is a pain): one

Re: [ansible-project] Stuck deploying templated configs for multiple users with with_items

2016-09-01 Thread Patrick Laimbock
Hi Kai, On 01-09-16 22:46, Kai Stian Olstad wrote: Are you trying to make all the users on all the sites? If so, check out with_nested https://docs.ansible.com/ansible/playbooks_loops.html#nested-loops Thank you for your suggestion. That was the solution :) In #ansible agaffney mentioned

[ansible-project] docker_login and GCR

2016-09-01 Thread Dmitry Makovey
is anyone using docker_login with Google Cloud Registry? I am attempting to do so by defining variable for auth token: gcloud_token_file: gcp_sa_account.json gcloud_token: "{{ lookup('file', gcloud_token_file) }}" and then trying to login: docker_login: username="_json_key" password="{{

[ansible-project] Reuse a role in different playbooks

2016-09-01 Thread Alan Evangelista
I current have one playbook for each application in my infrastructure: one for Gerrit, one for Jenkins, etc. Current filesystem structure: playbooks | gerrit | --- roles | postfix jenkins | ---

Re: [ansible-project] Stuck deploying templated configs for multiple users with with_items

2016-09-01 Thread Kai Stian Olstad
On 01. sep. 2016 22:20, Patrick Laimbock wrote: Variables: --- openvpn_networks: site1: openvpn_config: site1-server1 site2: openvpn_config: site2-server1 openvpn_users: - name: patrick base: /home/ - name: test base: /home/ The task below works (apologies for the

[ansible-project] Stuck deploying templated configs for multiple users with with_items

2016-09-01 Thread Patrick Laimbock
Hi, I want to deploy a couple of OpenVPN configs to multiple users. It works for a single user but now I'm stuck trying to make it work for multiple users. Anyone have a suggestion how to make this work? Variables: --- openvpn_networks: site1: openvpn_config: site1-server1 site2:

[ansible-project] Generate number sequence for dynamic server inventory

2016-09-01 Thread titleistfour
Hello, I'm currently building some servers in AWS. A set of servers will need a sequence of keys generated for each server like so, with a template that get's pushed out. # server 1 9011 9012 9013 # server 2 9021 9022 9023 # server 3 9031 9032 9033 If my inventory is dynamic, what is a

Re: [ansible-project] How to set a variable in vars/main.yml conditionally?

2016-09-01 Thread ZillaYT
Much better solution. Thanks! I ended up doing this - include_vars: "roles/syslog/vars/{{ ansible_os_family }}-{{ ansible_distribution_major_version }}.yml" On Thursday, September 1, 2016 at 2:07:23 PM UTC-4, Allen Sanabria wrote: > > include_vars is your friend. > > For instance in tasks you

Re: [ansible-project] How to set a variable in vars/main.yml conditionally?

2016-09-01 Thread Matt Martz
Additionally you can make syslog_service a dictionary value with keys for the different versions: vars/main.yml syslog_service: "6": syslog "7": rsyslog Then just do: - name: Ensure syslog is running service: name="{{ syslog_service[ansible_distribution_major_version] }}"

Re: [ansible-project] How to set a variable in vars/main.yml conditionally?

2016-09-01 Thread Allen Sanabria
include_vars is your friend. For instance in tasks you can say.. ```yaml - include_vars: RedHat6.yml when: ansible_os_family == "RedHat" and ansible_lsb.major_release == "6" - include_vars: RedHat7.yml when: ansible_os_family == "RedHat" and ansible_lsb.major_release == "7" ``` On Thu, Sep

Re: [ansible-project] How to set a variable in vars/main.yml conditionally?

2016-09-01 Thread Allen Sanabria
include_vars is your friend. For instance in tasks/main.yml you can say.. - include_vars: RedHat6.yml when: ansible_os_family == "RedHat" and ansible_lsb.major_release == "6" - include_vars: RedHat7.yml when: ansible_os_family == "RedHat" and ansible_lsb.major_release == "7" On Thursday,

Re: [ansible-project] How to set a variable in vars/main.yml conditionally?

2016-09-01 Thread ZillaYT
Having a lot of -name/when task blocks is just ugly infrastructure. I have to think of a better way. There's GOT to be a better way. On Thursday, September 1, 2016 at 1:45:02 PM UTC-4, Kai Stian Olstad wrote: > > On 01. sep. 2016 18:02, ZillaYT wrote: > > I'm writing a role to configure syslog,

Re: [ansible-project] How to set a variable in vars/main.yml conditionally?

2016-09-01 Thread Kai Stian Olstad
On 01. sep. 2016 18:02, ZillaYT wrote: I'm writing a role to configure syslog, and of course the service is different between Linux instances. How do I do this in var/main.yml? The directory must be vars not var. # pseudo-code in vars/main.yml if Redhat7.x syslog_service: rsyslog else if

Re: [ansible-project] Is there a way to define a list of values in vars?

2016-09-01 Thread Kai Stian Olstad
On 01. sep. 2016 16:57, synova.market...@gmail.com wrote: Hi, Is there a way to do the same as "with_items" but globally for the playbook? For example something like : variable1: - {url: 'http://someting', dest: 'something', src: 'something'} - {url: 'http://someting2', dest:

[ansible-project] Re: Installation of .exe on windows remote node get hung

2016-09-01 Thread 'J Hawkesworth' via Ansible Project
try win_package - win_msi is *only* for (well behaved) msi files. also win_chocolatey is an option for a lot of places if it meets your security requirements. A lot of (older) .exe programs will assume there is a user and pop up some kind of dialog box, which will cause the module to hang

Re: [ansible-project] How to get the ansible command line information like current tags, skip-tags, limit, etc?

2016-09-01 Thread Matt Martz
So I guess to answer your question directly, there is no way to access tags, skip tags, limit and most other command line options from within a play. It's really only achievable via a callback. On Thu, Sep 1, 2016 at 11:26 AM, Jordan Cohen wrote: > The callback plugin is

Re: [ansible-project] How to get the ansible command line information like current tags, skip-tags, limit, etc?

2016-09-01 Thread Jordan Cohen
The callback plugin is really nice, i didn't know it existed. For my purposes though, I would like to use the slack module so that I can more custom tailor the message, the channel to post to, and when to skip a slack message (for local/dev environments) But thank you, this is cool. On

Re: [ansible-project] How to get the ansible command line information like current tags, skip-tags, limit, etc?

2016-09-01 Thread Matt Martz
Jordan, Have you looked at the slack callback plugin that is already bundled with ansible? In your ansible.cfg you would need to have something like: [defaults] callback_whitelist = slack The docstring for the callback has information about what environment variables need to be set up for it

Re: [ansible-project] Re: Version (and other) problems with Ansible Azure Modules

2016-09-01 Thread Matt Davis
That's not us calling that, it's the Azure Python SDK calling itself, so something is internally out of sync (possibly stale .pyc files?). The way they package "azure" as a empty meta-package that depends on lots of other packages makes it really easy for things to get out of sync, especially

[ansible-project] How to set a variable in vars/main.yml conditionally?

2016-09-01 Thread ZillaYT
I'm writing a role to configure syslog, and of course the service is different between Linux instances. How do I do this in var/main.yml? # pseudo-code in vars/main.yml if Redhat7.x syslog_service: rsyslog else if RedHat6.x syslog_service: syslog end So then I can just do this in

Re: [ansible-project] Re: Unusual WinRM connection issue

2016-09-01 Thread Mike Fennemore
So courtesy of a few colleagues we have a solution. By specifying the fqdn in the inventory rather than the ip, and making sure the Ansible control machine could resolve the fqdn to the ip, the connection is now successful. -- You received this message because you are subscribed to the Google

[ansible-project] Is there a way to define a list of values in vars?

2016-09-01 Thread synova . marketing
Hi, Is there a way to do the same as "with_items" but globally for the playbook? For example something like : variable1: - {url: 'http://someting', dest: 'something', src: 'something'} - {url: 'http://someting2', dest: 'something2', src: 'something2'} and use it like this in the playbook.

Re: [ansible-project] Missing something with host directory/file paths

2016-09-01 Thread Jon Langemak
I'll answer this for myself. Seems like just using the command module and doing the copy that way is the best approach. Thanks for putting me on the right track! On Wednesday, August 31, 2016 at 7:09:22 PM UTC-5, Jon Langemak wrote: > > Thank you! Is there a better means to recursively copy

[ansible-project] win_user fails to change password, but password changes!

2016-09-01 Thread Андрей З
The whole test playbook is here; - hosts: windows gather_facts: false tasks: - name: Change Administrator password win_user: name=Administrator password=Quaiqu6I password_never_expires=yes Running with ansible 2.1.1.0, and Windows 2012 R2 as client. http://pastebin.com/2Wg9qYMt

[ansible-project] Define group in hosts file based on intersection of 2 groups

2016-09-01 Thread Iain M. Conochie
Hello, It is possible to limit the hosts the ansible command runs against by specifying patterns on the command line like so: ansible webservers:!staging -m ping Is it possible to use the same technique to define groups in the inventory file, so that the new group is defined by the

[ansible-project] Thoughts on role for creating multiple users

2016-09-01 Thread appeltabak
Hi, Currently, I'm transforming my user role from creating one user to creating multiple users. In many examples I've seen this is done by adding with_items to every tasks related to the creation of the user (create user, add authorized key, etc). This would result in executing every tasks for

[ansible-project] How to get the ansible command line information like current tags, skip-tags, limit, etc?

2016-09-01 Thread Jordan Cohen
I am integrating some automated slack messaging in ansible to inform on ansible runs and it would be useful to display information such as: Current tags in push Current skip-tags in push Current limit (though I know i can use play_hosts for listing the servers) To be honest, the whole ansible

Re: [ansible-project] ansible 2.2.0 - ios_facts module

2016-09-01 Thread Rukka Pal
Hi Peter, many thanks for your help, it works now! On Tuesday, August 30, 2016 at 4:26:08 AM UTC+2, Peter Sprygada wrote: > > Hi Rukka, > > See sample playbook here: > https://gist.github.com/privateip/f473d9ce25dd699b14c9987264159616 > > > > On Mon, Aug 29, 2016 at 5:23 AM, Rukka Pal

[ansible-project] Installation of .exe on windows remote node get hung

2016-09-01 Thread srcr2801
Hi, I'm trying to install a software(.exe file) using raw module in windows but failed to do. - hosts : all remote_user: administrator tasks: - raw : xxx.exe /s Is there any other module to install software from .exe files?? I tried win_msi but it didnt work. -- You received this

[ansible-project] with_nested and empty lists

2016-09-01 Thread Pim Rupert
I have the following task which uses with_nested with variables that could be empty. - name: Authorize SSH keys for all website users. authorized_key: user="{{ item.0.user | default(websites_default_user) }}" key="{{ lookup('file', 'data/public-ssh-keys/' ~ item.1.key) }}"

[ansible-project] Re: ansible requiring ansible_ssh_pass

2016-09-01 Thread Graham O'Regan
To provide a bit more detail, if I have this in my inventory file; ec2-XXX-XXX-XXX-XXX.eu-west-1.compute.amazonaws.com ansible_ssh_user=ec2-user ansible_ssh_pass=dummy And run this; $ ansible all -i inventory/aws -m ping - No config file found; using defaults Loaded callback minimal of

[ansible-project] ansible requiring ansible_ssh_pass

2016-09-01 Thread Graham O'Regan
I'm running Ansible 2.1.1.0 on OS X 10.11.6 and I'm having a problem that I haven't had before. The issue the same as outlined in this SO question; https://stackoverflow.com/questions/37213551/ansible-ssh-connection-fail If I don't put ansible_ssh_pass in the inventory file then SSH doesn't

[ansible-project] Re: Ansible installed from yum is unable to connect to windows while Ansible installed via source file is working fine from the same host

2016-09-01 Thread 'J Hawkesworth' via Ansible Project
to get round that issue you need to set ansible_winrm_server_cert_validation: ignore In your inventory / group vars its documented here: http://docs.ansible.com/ansible/intro_windows.html#inventory Hope this helps, Jon On Thursday, September 1, 2016 at 11:13:02 AM UTC+1, ishan jain wrote: >

Re: [ansible-project] Re: Location of host and group configuration

2016-09-01 Thread Kai Stian Olstad
On 01. sep. 2016 12:39, Uwe Sauter wrote: Yes, that I've alredy figured out. But what if I want to group my playbooks inside different folders but the group and host vars should be the same? Is there an option to tell Ansible where to look for those folders? I don't think that is possible.

Re: [ansible-project] including a pre_tasks

2016-09-01 Thread Kai Stian Olstad
On 01. sep. 2016 11:00, fanvalt wrote: Hello, I want to set variables with set_fact in a pre_tasks section. This is working well, but it is 50 lines long and I want to have these lines to be set in all my playbooks. Is there a way to include a pre_tasks ? Here is what I would expect: -

[ansible-project] Re: Location of host and group configuration

2016-09-01 Thread Uwe Sauter
Yes, that I've alredy figured out. But what if I want to group my playbooks inside different folders but the group and host vars should be the same? Is there an option to tell Ansible where to look for those folders? I imagine a dir tree like: . ├── group_vars │ ├── group1.yaml │ └──

[ansible-project] Re: Location of host and group configuration

2016-09-01 Thread ankur . cool
It can be inside the same folder as the playbook. root -- group_vars/all.yml -- host_vars/some_host.yml -- myPlaybook.yml On Thursday, September 1, 2016 at 2:40:10 PM UTC+5:30, Uwe Sauter wrote: > > Hi all, > > I'm currently struggling with how to tell Ansible where it can find >

[ansible-project] Running ansible from python

2016-09-01 Thread ankur . cool
Hi I have a need to call ansible from python. I was looking at http://docs.ansible.com/ansible/developing_api.html#python-api-2-0 but doc doesn't seem to be very clear. I need to execute a module or a playbook which ever is easy and want the response of it. Basically this is my custom module

[ansible-project] Ansible installed from yum is unable to connect to windows while Ansible installed via source file is working fine from the same host

2016-09-01 Thread ishan jain
I am making some centOS based docker containers to be used as Ansible host. Initially, i created a container and installed Ansible from source files. To connect to windows hosts, i installed some modules as and when required. (honestly, i am not sure what all modules i installed) Now i created

[ansible-project] Location of host and group configuration

2016-09-01 Thread Uwe Sauter
Hi all, I'm currently struggling with how to tell Ansible where it can find host_vars and group_vars folders. Is there an environmet variable for it? Does it have to be inside the same folder as the playbook? Regards, Uwe -- You received this message because you are subscribed to the

[ansible-project] including a pre_tasks

2016-09-01 Thread fanvalt
Hello, I want to set variables with set_fact in a pre_tasks section. This is working well, but it is 50 lines long and I want to have these lines to be set in all my playbooks. Is there a way to include a pre_tasks ? Here is what I would expect: pre_tasks: - name: variables Instance 1

Re: [ansible-project] unable to evaluate conditional

2016-09-01 Thread fanvalt
ok thank you for the explanation REgards Le mercredi 31 août 2016 12:50:55 UTC+2, Kai Stian Olstad a écrit : > > On 31. aug. 2016 11:43, fanvalt wrote: > > Hello, > > > > I don't understand where I am doing wrong in this simple tasks: > > > > - name: Search for bin directory > > stat: >

[ansible-project] Re: win_copy failing (timeout)

2016-09-01 Thread 'J Hawkesworth' via Ansible Project
win_copy is still unfortunately not great for large files. From the testing that I did earlier in the year it is still slower than fetching the same size file via http and there seems to be a max size, although this isn't something I've hit myself. What I do is add an http server (nginx) to

Re: [ansible-project] Re: EC2 dynamic inventory: SSH rules

2016-09-01 Thread Hagai Kariti
You can try setting it to public_dns_name. It should resolve to the private IP when you're inside the vpc, and to the public IP when your outside. On Wed, Aug 31, 2016, 23:22 Soren Olegnowicz wrote: > Sure! > > Currently I run: " ansible all -m ping -i ec2.py " > >