[ansible-project] unable to fit the piece of code in ansible

2018-04-11 Thread Bishwajit Samanta
Hi all, I am a beginner in ansible. If anyone can help me in finding the answer. It would be great. My problem was finding a phrase in ansible which one of the person have helped me. But unfortunately i am not able to fit the piece of code in my playbook. hostinfo: host001': ip:

[ansible-project] How to use the same dictionary to loop over two tasks? is it possible using block?

2018-04-11 Thread Tony Chia
I.e. instead of doing this which does win_iis_website,win_iis_website,etc then win_iis_webbinding,win_iis_webbinding, etc - name: Create IIS site win_iis_website: name: '{{ item.key }}' state: started application_pool: '{{

[ansible-project] Re: Can we selectively install Windows Updates with Ansible

2018-04-11 Thread Jordan Borean
Hi With Ansible 2.5 you can now select a blacklist of updates to skip when running the task. An example can be seen on the module documentation page http://docs.ansible.com/ansible/latest/modules/win_updates_module.html. Another way of doing it if you have a WSUS setup is to not approve the

Re: [ansible-project] Ansible error : ERROR! The tasks/main.yml file for role 'xyz' must contain a list of tasks

2018-04-11 Thread Brian Coca
`tasks:` should only appear in a play, not a tasks list for a role, remove it and it should work. -- -- 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,

[ansible-project] Ansible error : ERROR! The tasks/main.yml file for role 'xyz' must contain a list of tasks

2018-04-11 Thread Irfan Sayed
Hello, i have following simple YAML play file --- tasks: - name: Execute the command in remote shell; stdout goes to the specified file on the remote. shell: echo hi but when running ansible-playbook command: getting following error ERROR! The tasks/main.yml file for role 'xyz' must

Re: [ansible-project] Ansible 2.4 to 2.5 files - file module change

2018-04-11 Thread Jan Fader
Hi Mike Am Tue 10. Apr. 2018, hat Mike Garris geschrieben: > Am I reading the docs correctly with regards to the file module being > changed? The module file.py in plugins still "Sets attributes of files" https://github.com/ansible/ansible/blob/stable-2.5/lib/ansible/modules/files/file.py in

[ansible-project] Re: Ansible module for vRA

2018-04-11 Thread Luis Bonilla
Hey Ivan, Did you find something? I found this today while searching for an Ansible module that will request base OS blueprints from VRA. Let me know. https://github.com/LinuxArchitects/Ansible-VMware-vRealize-Automation On Friday, September 29, 2017 at 5:24:12 AM UTC-7, Ivan Pacheco wrote: >

Re: [ansible-project] Where to put files and templates that don't belong to a role

2018-04-11 Thread Kai Stian Olstad
On Wednesday, 11 April 2018 15.13.51 CEST Clayton Louden wrote: > Hi everyone, > > Where do you usually put files or templates that are just used in a certain > play but are not part of a role? For the most part in a role. > Currently I do have them just alongside my > playbooks organised by

Re: [ansible-project] Re: finding a phrase through ansible script

2018-04-11 Thread Bishwajit Samanta
Hi, thanks for sharing the docs link. In the meanwhile i am not able to go in the right direction of solving the problem. so far what i have done is :: 1. converted the text file to json through python. 2. write some ansible codes, which in return it is dumping the contents but i am not able to

Re: [ansible-project] Re: vsphere wait for vm powered off

2018-04-11 Thread Kai Stian Olstad
On Wednesday, 11 April 2018 11.05.42 CEST Zeljko Dokman wrote: > Hi, thank you, your suggestion works. > I am wondering are this options documented some where? or how can I list > this option for a module? > Ansible documentation is not covering all this options or I haven't been > able to find

Re: [ansible-project] Re: finding a phrase through ansible script

2018-04-11 Thread Matt Martz
Templating in Ansible is handled by Jinja2. You can find documentation on Jinja2 at http://jinja.pocoo.org/docs/dev/templates/ For the `first` filter specifically: http://jinja.pocoo.org/docs/dev/templates/#first On Wed, Apr 11, 2018 at 11:47 AM, Bishwajit Samanta <

[ansible-project] Re: finding a phrase through ansible script

2018-04-11 Thread Bishwajit Samanta
@Matt Martz : I am sorry to ask silly questions, regarding ansible as by seeing the small piece of code, i can understand you must be an ansible expert. If possible you can help me in my problem explanation a bit. And any such links for learning you want to refer, please refer me. As i

[ansible-project] Re: win_package

2018-04-11 Thread lpescatore via Ansible Project
Hi Bill, Try this: become: yes become_method: runas become_user: SYSTEM On Wednesday, April 11, 2018 at 9:24:28 AM UTC-7, William Dossett wrote: > > Hi, > > Fairly new to Ansible, but I am just finishing a fairly extensive course > on Linux Academy. I have some good use cases... the

[ansible-project] win_package

2018-04-11 Thread William Dossett
Hi, Fairly new to Ansible, but I am just finishing a fairly extensive course on Linux Academy. I have some good use cases... the first one is configuring windows VMs to have a number of packages installed automatically. Currently I can uninstall old versions of java and install the most

[ansible-project] Re: finding a phrase through ansible script

2018-04-11 Thread Bishwajit Samanta
I am glad you replied so fast, but sorry to say i am not an ansible expert . I am just a beginner . I just typed the code. Can you help me in understanding where i am not correct. --- - hosts: devops tasks: - debug: msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto',

Re: [ansible-project] finding a phrase through ansible script

2018-04-11 Thread Matt Martz
The following task will find that: - debug: msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto', 'ess')|first|first }}" That takes the `hostinfo` dict, turns it into a list of tuples, selects where `hostclass` equals `ess`, gets the first result (there should only be one

[ansible-project] finding a phrase through ansible script

2018-04-11 Thread Bishwajit Samanta
i am having a problem in finding solution. I have a piece of file which contains data in below format (json type with quotes)::- hostinfo: 'host001': ip: x.x.x.x hostclass: 'puppet' 'host002': ip: y.y.y.y hostclass: 'ess' 'host003': ip: z.z.z.z hostclass: 'mdb'

Re: [ansible-project] Ternary filter vs conditional expressions

2018-04-11 Thread Brian Coca
Even though Ansible is written in Python, Python devs are not the main target of the tool, so being 'pythonic' is not really an aim of it. The `ternary` filter is easier for people that are not familiar with Python, but non programmers and those used to ternary structures in other languages. --

[ansible-project] How to recover from expected connection loss?

2018-04-11 Thread Uwe Sauter
Hi all, I'm trying to reduce the size of the locale archive on CentOS 7.4 as described in [1] and [2]. Ansible version is 2.4.2.0-2.el7 For this I have a script on the client, that calls the needed commands: ## /root/bin/rebuild_locale.sh #!/bin/bash LOCALES="en_US:de_DE" mv

Re: [ansible-project] Ansible Python API 2.0 - capture warnings

2018-04-11 Thread Brian Coca
Warnings are not currently handled by callbacks, the Display class handles them. -- -- 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, send an email to

Re: [ansible-project] create tepdir and copy file into it?

2018-04-11 Thread Michael Renner
Moin, [...] > > If I understand you correctly you want to download to localhost, and then > copy it out to all the host in the play. > If so you need to add run_once and delegate_to. you need to add run_once > and delegate_to [...] CU -- You received this message because you are

Re: [ansible-project] Re: Where to put files and templates that don't belong to a role

2018-04-11 Thread Clayton Louden
Hi Mike, On 11.04.2018 15:25, Mike Garris wrote: > I am in the boat of treating everything as a role.  [...] > Just an opinion on the "everything as a role" comment.  An extra opinion is very welcome. If I'm the only person who doesn't treat "everything as a role" then maybe it's time to think

[ansible-project] Re: Where to put files and templates that don't belong to a role

2018-04-11 Thread Mike Garris
I am in the boat of treating everything as a role. |some_app | |site.yml | |roles | | |some_app_name | | | |vars | | | |tasks | | | |defaults | | | |files | | | |templates Now you could, if needed, create a site.yml that would have variables to execute, or

[ansible-project] Where to put files and templates that don't belong to a role

2018-04-11 Thread Clayton Louden
Hi everyone, Where do you usually put files or templates that are just used in a certain play but are not part of a role? Currently I do have them just alongside my playbooks organised by play someplay.yml files/ someplay/somefile someotherplay/someotherfile templates

[ansible-project] Possible Bug in azure_rm_networkinterface module (Ansible 2.5.0)

2018-04-11 Thread f . floimair . commend
Hi everyone! I am using Ansible 2.5.0 and I think I found a bug in the azure_rm_networkinterface module (either in the code or the documentation). When I create a network-interface that should be used with an already existing Network Security Group (NSG), it never uses the existing

[ansible-project] Can we selectively install Windows Updates with Ansible

2018-04-11 Thread Dinesh Vashisht
Hello Team, I am using *win_updates* module in playbook with *Ansible Version 2.4.2.0*. Have a requirement for Automation of Windows Security and Roll-up updates patching, therefore categories selected are: *SecurityUpdates*, *UpdateRollups*. Patches identified are: - 2018-01 Security and

[ansible-project] need help to install Visual studio code on linux machine through Ansible

2018-04-11 Thread Vishal Mane
I took a role to install vs code from github. now trying to run the role, it gets executes successfully, but vs code doesn't gets installed on the target machine. my playbook is - - --- - - hosts: - become: true - become_method: sudo - roles: - - {

[ansible-project] Proper handling of host specific credential files

2018-04-11 Thread Jean Helou
Hi, I am using ansible 2.5, I have gone through the best practices but I fail to understand how I am supposed to properly handle *host-specific* files. My exact use case is handling vpn certificates for

[ansible-project] Re: Hostnames with EC2 inventory plugin

2018-04-11 Thread flowerysong
On Wednesday, April 11, 2018 at 3:19:51 AM UTC-4, os...@apartum.com wrote: > > I'm testing the new Amazon EC2 dynamic inventory plugin. I need to set the > host names to the "Name" tag, but I don't understand the documentation. > Reading this: >

[ansible-project] Re: HP ILO set from ansible (no OS installed)

2018-04-11 Thread Benny Kusman
Hi Dave, So i got this stupid question, where is the library of to put this hpilo ? i was looking at https://github.com/ansible/ansible/issues/7633, but couldnt find the solution. Thank you On Tuesday, April 10, 2018 at 3:38:46 AM UTC, Dave H wrote: > > Hi Benny, > > There are a couple of

[ansible-project] Re: vsphere wait for vm powered off

2018-04-11 Thread Zeljko Dokman
Hi, thank you, your suggestion works. I am wondering are this options documented some where? or how can I list this option for a module? Ansible documentation is not covering all this options or I haven't been able to find it. here is a working code - name: Wait till {{ target }} is

[ansible-project] Ternary filter vs conditional expressions

2018-04-11 Thread rbarlik
I've been recently wondering about the ternary filter in Ansible. I've seen it used in a couple of places and it's also mentioned in the documentation. As you probably know, it's not a standard Jinja filter but one created in Ansible code. I would like to understand why was the ternary

[ansible-project] Ansible Python API 2.0 - capture warnings

2018-04-11 Thread Suren Baskaran
Hello All Been circling around the Callbackbase with all possible tries , but I could not find a way till now to capture these warnings from a playbook execution with the API output [WARNING]: * Failed to parse hosts/UAT/ dictionary, got: [WARNING]: * Failed to parse

[ansible-project] List of running processes form multiple linux hosts using with_items

2018-04-11 Thread smitconsultant2017
Hi I am trying to achieve all running processes on our linux machines via ansible and get output in a file along with each host name and processes. I have made below playbook but not getting to the point how to get list of processes for each host one by one and store in a file. Can anyone

[ansible-project] Hostnames with EC2 inventory plugin

2018-04-11 Thread oscar
Hi, I'm testing the new Amazon EC2 dynamic inventory plugin. I need to set the host names to the "Name" tag, but I don't understand the documentation. Reading this: http://docs.ansible.com/ansible/latest/plugins/inventory/aws_ec2.html I understand I should write something like this:

[ansible-project] Re: How do I loop a task with variables defined in another file?

2018-04-11 Thread Olof Lundgren
This is what the task "Include user database" debug message looks like when its *jsonprettyfied* TASK [Include user database]

[ansible-project] How do I loop a task with variables defined in another file?

2018-04-11 Thread Olof Lundgren
I have built a .yml file with a set of users that I want to push to my routers with vyos_user module. This is my *users.yml* users: - full_name: "Olof Lundgren" name:"olof" configured_password: "abcd1234" level: "admin"