Re: [ansible-project] Create and add to a multi field array

2020-06-15 Thread Nicholas Britton
I dont have much data at the moment since I am using a few test playbooks with static set vars to see if nested include task statements would work. Which it did. The part I am missing is after the nested includes that run in a loop, I want to print a summary of specifc vars to the screen for con

[ansible-project] Inventory for playbooks with all uri calls ran local

2020-06-15 Thread Nicholas Britton
I am trying to see how I can setup an inventory file for an application that is all managed by uri calls. I have multiple end points that will end up with some different vars by host. But I have the host as 127.0.0.1 since everything runs local I thought that would be the way to do it. I am

Re: [ansible-project] ipaddr cidr_lookup

2020-06-15 Thread Ryan Merolle
Scott, I appreciate your patience here. Even when I said I am very familiar with the document, you pressed on and pointed me to the item that was right in front of my face! That worked perfectly Thanks! On Monday, June 15, 2020 at 8:14:18 PM UTC-4, Scott Sturdivant wrote: > > I think what yo

Re: [ansible-project] ipaddr cidr_lookup

2020-06-15 Thread Scott Sturdivant
I think what you're asking for can be found by looking at the example for "By specifying a network range as a query, you can check if a given value is in that range:" in the docs. An example playbook: --- - hosts: localhost connection: local tasks: - debug: msg: belongs whe

Re: [ansible-project] ipaddr cidr_lookup

2020-06-15 Thread Ryan Merolle
Hello Scott, I’m very familiar with the documented functions of the ipaddr filter. If you look at the link you just sent cidr_lookup is not a documented function, but it is listed in the source code of the filter as I linked to in my original post. Thanks! -- You received this message becaus

Re: [ansible-project] ipaddr cidr_lookup

2020-06-15 Thread Scott Sturdivant
Hi, There are some great examples on the ipaddr filter's documentation page: https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters_ipaddr.html#playbooks-filters-ipaddr Yes, one of the things you can do is check to see if an IP belongs to a subnet. On Mon, Jun 15, 2020 at 5:27 PM R

[ansible-project] ipaddr cidr_lookup

2020-06-15 Thread Ryan Merolle
Anyone use this filter function? It seems like a lookup to see if an IP or subnet is a member of a larger prefix. https://github.com/ansible-collections/ansible.netcommon/blob/master/plugins/filter/ipaddr.py#L665 I am just not sure on the proper usage. Thanks! -- You received this message be

Re: [ansible-project] print highest number of volume group

2020-06-15 Thread ravi teja
Thank you Dick Visser. It’s working for me. -- 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...@googlegroups.com. To view this discus

Re: [ansible-project] Conditional with dict2item is falied

2020-06-15 Thread Stefan Hornburg (Racke)
On 6/15/20 9:39 PM, Rafael Tomelin wrote: > > Hi guys, > > I have a task with equal below, but when I validate it is defined it not > recognized. > - name: include vars virtual_machine > include_tasks: virtual_machine.yml > when: > - gms_az_vm_action == 'create_virtual_machine' > - virtual_machi

Re: [ansible-project] print highest number of volume group

2020-06-15 Thread Dick Visser
Try: "{{ ansible_lvm.lvs | select('match', '^vg[0-9]+') | list | sort | last }}" On Mon, 15 Jun 2020 at 22:25, ravi teja wrote: > > Hello, > > I > Is there a way to print only volume group name on server with the highest > number? for eg if the server has vg00, vg01, vg02 I want to have print

[ansible-project] print highest number of volume group

2020-06-15 Thread ravi teja
Hello, I Is there a way to print only volume group name on server with the highest number? for eg if the server has vg00, vg01, vg02 I want to have print only highest number vg which is vg02. I am trying to use with ansible_lvm.vgs but couldnt able to. With shell command I am able to get the i

Re: [ansible-project] Conditional with dict2item is falied

2020-06-15 Thread Rafael Tomelin
OK, thanks! On Mon, Jun 15, 2020 at 4:42 PM Matt Martz wrote: > In the case of using `when` and `loop`, the `when` statements is applied > to each iteration of the `loop`, and not before it. > > As such, you cannot prevent a loop from happening using a when statement. > > Instead you want to do

[ansible-project] Re: Windows Domain/Ansible Kerberos Auth Issues Still

2020-06-15 Thread Dave York
The machines being managed here are windows machines - but the ansible tower server itself is linux (obviously) - I wonder if the kerberos configuration on the tower machine may be running into a flavor of what you're suggesting - but im not sure exactly how I would point the tower server direc

Re: [ansible-project] Conditional with dict2item is falied

2020-06-15 Thread Matt Martz
In the case of using `when` and `loop`, the `when` statements is applied to each iteration of the `loop`, and not before it. As such, you cannot prevent a loop from happening using a when statement. Instead you want to do this in loop, like: loop: '{{ virtual_machine|default({})|dict2items }}'

[ansible-project] Conditional with dict2item is falied

2020-06-15 Thread Rafael Tomelin
Hi guys, I have a task with equal below, but when I validate it is defined it not recognized. - name: include vars virtual_machine include_tasks: virtual_machine.yml when: - gms_az_vm_action == 'create_virtual_machine' - virtual_machine is defined loop: "{{ virtual_machine|dict2items }}" How I

[ansible-project] Re: ansible 2.9.4 - task with delegate_to: works, subsequent tasks fail

2020-06-15 Thread Andrew Caldwell
In hindsight this is pretty obvious -- I did not realize I was stepping on some ansible built-ins like become_method and whatnot. adding a set_fact task after the windows execution solved this issue... On Monday, 15 June 2020 09:07:40 UTC-4, Andrew Caldwell wrote: > > @Racke, > > These are my an

Re: [ansible-project] Sending ansible output to python function

2020-06-15 Thread Brian Coca
You can use a callback plugin, they are the ones that process 'output' from a play/task. -- -- 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 em

Re: [ansible-project] Create and add to a multi field array

2020-06-15 Thread Dick Visser
Hi The question is a bit abstract - can you provide some more tangible code/playbooks/data? On Mon, 15 Jun 2020 at 17:00, Nicholas Britton wrote: > > I am trying to find away that i can create an array that i can reference > later that would be built through a series of include_task plays. T

[ansible-project] Create and add to a multi field array

2020-06-15 Thread Nicholas Britton
I am trying to find away that i can create an array that i can reference later that would be built through a series of include_task plays. Through the plays i will specific pieces of data that i care to keep for use later. My layout is as: main.yml -- inlcude_tasks.yml with loop -- in

[ansible-project] Re: Run multiple plays in parallel.

2020-06-15 Thread Florian Floimair
You need to use the serial parameter followed by how many hosts (either absolute number or percentage) should be run in parallel (And yes it is an awkward name for this setting ;-) ) https://docs.ansible.com/ansible/latest/user_guide/playbooks_delegation.html#rolling-update-batch-size -- You r

Re: [ansible-project] Ansible is being run in a world writable directory (/vagrant), ), ignoring it as an ansible.cfg source

2020-06-15 Thread Dick Visser
The warning message contains a URL. Visit that and follow the recommendations there. It might be that the combination of tools that you use (vagrant + cygwin + ansible) is problematic. In that case, try cutting out those tools one by one until it works. On Mon, 15 Jun 2020 at 14:28, Abhishek Kari

[ansible-project] Re: How to Secure Ansible playbook

2020-06-15 Thread Nihanth Joseph
Thanks, hope this would solve my issue. On Monday, June 15, 2020 at 6:55:37 PM UTC+8, Nihanth Joseph wrote: > > I need to encrypt my playbook, so once i deploy it to customer > environment, they cannot edit or read my file. > > I have tired ansible-vault, but for this we need to save password i

[ansible-project] Re: ansible 2.9.4 - task with delegate_to: works, subsequent tasks fail

2020-06-15 Thread Andrew Caldwell
@Racke, These are my ansible.cfg settings. The playbook is called with 'become: true' since most tasks require elevated rights: [defaults] forks = 60 poll_interval = 15 become_user= root remote_port= 22 host_key_checking = False become_exe = sudo timeout= 60 callback

Re: [ansible-project] Re: How to Secure Ansible playbook

2020-06-15 Thread Luca 'remix_tj' Lorenzetto
On Mon, Jun 15, 2020 at 2:42 PM Nihanth Joseph wrote: > > Actually we don't want to expose, our code except developers. > we have separate team (external to our company) to execute our code in > customer environment. and we don't want to show our code to them. Hello, as far as i know, no tool i

Re: [ansible-project] offending line appears to be state: directory

2020-06-15 Thread David Shrewsbury
'register' indented too much on your 'stat' task On Sun, Jun 14, 2020 at 1:34 PM Tony Wong wrote: > any idea what is wrong with my playbook here? > > > - name: Retrieve info about the mount directory > stat: > path: "{{ mount_dir_path }}" > register: mount_dir_stat_first > tags: >

[ansible-project] Re: How to Secure Ansible playbook

2020-06-15 Thread Nihanth Joseph
Actually we don't want to expose, our code except developers. we have separate team (external to our company) to execute our code in customer environment. and we don't want to show our code to them. On Monday, June 15, 2020 at 6:55:37 PM UTC+8, Nihanth Joseph wrote: > > I need to encrypt my pl

[ansible-project] Ansible is being run in a world writable directory (/vagrant), ), ignoring it as an ansible.cfg source

2020-06-15 Thread Abhishek Karigar
SUMMARY trying to provision the vagrant guest using ansible_local. with ansible provision i was able to do it successfully. ISSUE TYPE - Bug Report COMPONENT NAMEANSIBLE VERSION ansible 2.9.9 CONFIGURATION OS / ENVIRONMENT windows 10 / cygwin /ansible 2.9.x version STEPS TO REPRODUCE

Re: [ansible-project] How to Secure Ansible playbook

2020-06-15 Thread Dick Visser
So your customer has access to the playbooks and vault passwords? On Mon, 15 Jun 2020 at 12:55, Nihanth Joseph wrote: > > I need to encrypt my playbook, so once i deploy it to customer environment, > they cannot edit or read my file. > > I have tired ansible-vault, but for this we need to save p

Re: [ansible-project] Abort playbook if host is not ready

2020-06-15 Thread Laci
Thank you! -- 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...@googlegroups.com. To view this discussion on the web visit https://gro

Re: [ansible-project] Abort playbook if host is not ready

2020-06-15 Thread Laszlo Danielisz
Hi, this is my workspace URL https://na-am41921.slack.com/ On Mon, Jun 15, 2020 at 2:07 AM Kai Stian Olstad < ansible-project+l...@olstad.com> wrote: > On Thu, May 28, 2020 at 10:52:37AM -0700, Laci wrote: > > Is there a good way to abort the playbook if host is not ready? > > For example I want

[ansible-project] How to Secure Ansible playbook

2020-06-15 Thread Nihanth Joseph
I need to encrypt my playbook, so once i deploy it to customer environment, they cannot edit or read my file. I have tired ansible-vault, but for this we need to save password in text file, so ultimately customer can decrypt my source code using that. I am a java developer, in java we can con

Re: [ansible-project] Conditional actions based on host type?

2020-06-15 Thread Mark Farrington
Many thanks for the alternative. I'm editing an existing project that is already set up this way and I think the config file is sufficiently different enough to justify the use of the template files so I'll go with the magic variables suggestion. On Monday, June 15, 2020 at 11:39:51 AM UT

Re: [ansible-project] Conditional actions based on host type?

2020-06-15 Thread Mark Farrington
Thanks, That did what I needed. On Monday, June 15, 2020 at 11:18:56 AM UTC+1, Ompragash wrote: > > Hi Mark, > > For your use-case, you can consider using Ansible magic variables > https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html#accessing-information-about-other-hos

Re: [ansible-project] Conditional actions based on host type?

2020-06-15 Thread Dick Visser
Hi Another option is to have the content of that json config file stored as a variable in group_vars. You can then just use a single task, and limit the deployment to webservers or appservers. The config itself will be YAML, which is slightly easier to read. How feasible this is depends a bit on h

[ansible-project] Ansible Modules for HP Switches (Comware 7)

2020-06-15 Thread Gini Gangadharan
Hi Guys, Hope all are doing good. I was developing some latest playbooks for HP Switches (HP 5130 - CMW710) and noticed the 3rd party modules (refer link below) are not working any more with latest Ansible version (ansible 2.9.9). Also I found the repository is not maintained anymore (or last u

[ansible-project] Re: how to restrict scope for set_fact variable

2020-06-15 Thread Diyawary
Hi, can any one please suggest on it or any other way through I can accomplish it. On Sunday, 14 June 2020 15:52:41 UTC+5:30, Diyawary wrote: > > Could any one please help me on it . Appriciate your help in advance . -- You received this message because you are subscribed to the Google Groups

Re: [ansible-project] Conditional actions based on host type?

2020-06-15 Thread Ompragash
Hi Mark, For your use-case, you can consider using Ansible magic variables https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html#accessing-information-about-other-hosts-with-magic-variables example: when: inventory_hostname in groups ['webserver'] Regards, Ompragash On Mo

[ansible-project] Conditional actions based on host type?

2020-06-15 Thread Mark Farrington
Hi, New to ansible and looking for advice. I have an action inside a task (I think that is correct terminology). Something like this: - name: Cloudwatch deploy agent configuration for webserver template: src: templates/web-inst.json dest: "/opt/aws/amazon-cloudwatch-a

Re: [ansible-project] Needs to Write a Playbook

2020-06-15 Thread Abhijeet Kasurde
Hi Rama, What have you tried and what is error that you are getting? On Mon, Jun 15, 2020 at 11:57 AM rama543 wrote: > Hi Friends, > > I am new to this Ansible world > > Needs to write a playbook for one scenario > > Scenario-1: > > I have 1000 Servers . Host-names are like Server1, Server2,