[ansible-project] Inject vault password with plugin

2020-05-24 Thread FERREIRA CHRISTOPHE
Hello it's possible to inject vault password with custom plugin vars or action ? I would like put password in vault hashicorp and i would't put script in host because is executable by user I have try loader.set_vault_secrets(vault_secrets) but not work -- You received this message because

[ansible-project] Re: Removing a deep nested element from dict (json structure)

2020-05-24 Thread sebastien Morissette
> > The result I am looking for is the following : > { "id": "209", "ownerUserId": "2", "resource": " https://cloudcenter.cp.intactfc.com/v1/acls?id=209=ACI_EXTENSION ", "resourceName": "ACI_EXTENSION", "role":

Re: [ansible-project] Merge Dictionary

2020-05-24 Thread Shaun Rampersad
On Saturday, 23 May 2020 00:06:10 UTC+2, Vladimir Botka wrote: > > > > > There is hiera lookup plugin in Ansible. > > > https://docs.ansible.com/ansible/latest/plugins/lookup/hiera.html#hiera-get-info-from-hiera-data > > > Would it be possible to post the [mcve] Puppet code of your example?

[ansible-project] Re: Removing a deep nested element from dict (json structure)

2020-05-24 Thread sebastien Morissette
> > tested the json in jq, had errors in it.. here is the updated json > { "id": "209", "ownerUserId": "2", "resource": "https://abc.inet/v1/acls?id=209=ACI_EXTENSION;, "resourceName": "ACI_EXTENSION", "role": null, "tenantAndSubtenantUsers": [ {

[ansible-project] Removing a deep nested element from dict (json structure)

2020-05-24 Thread sebastien Morissette
Hi, i've been at this for several hours and i'm going in circles so I would like to see if someone can help me get it right. Given a dict structure which is a json array, I am looking to modify only the deeply nested users[*].perms object to remove the "delete" list item.. --- - hosts:

[ansible-project] unable to generate backup file with registered variable in ansible

2020-05-24 Thread Sadanand Alegaonkar
SUMMARY I trynig to take backup of existing file. reported below error ERROR! failed at splitting arguments, either an unbalanced jinja2 block or quotes: cp "{{file.stdout}" "{{file.stdout}}"_bkp ansible-playbook pb_DBrename_deletefile.yml -i alertdbhost ISSUE TYPE [root@XX database]#

Re: [ansible-project] [WARNING]: provided hosts list is empty, only localhost is available

2020-05-24 Thread James Cassell
> On Sun, May 24, 2020 at 4:08 PM James Cassell > wrote: > > > > On Sun, May 24, 2020, at 6:56 PM, Tony Wong wrote: > > > --- > > > - name: get info vm > > > hosts: localhost > > > connection: local > > > gather_facts: false > > > vars: > > > vm_list: > > > - dr-reb > > > - dr-wac >

Re: [ansible-project] Inject vault password with plugin

2020-05-24 Thread FERREIRA CHRISTOPHE
Hello no it's ansible vault password , i thinks can't use lookup for this Only option i know is ask-vault-pass environment vars and vault password file -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop

Re: [ansible-project] unable to generate backup file with registered variable in ansible

2020-05-24 Thread Sadanand Alegaonkar
Hello Dick, Thanks for giving reply, Yes corrected this error but the purpose is not getting fulfilled. I was trying to rename old file in the file system. it is giving below error. getting "file.results["stdout"]": "VARIABLE IS NOT DEFINED!" error On Sun, 24 May 2020 at 22:22, Dick Visser

Re: [ansible-project] ansible shell variable

2020-05-24 Thread Andrew Morgan
This is the output: fatal: [deVPN]: FAILED! => changed=true cmd: |- ansible dev -m setup delta: '0:00:00.033604' end: '2020-05-24 23:29:51.883830' msg: non-zero return code rc: 127 start: '2020-05-24 23:29:51.850226' stderr: '/bin/bash: ansible: command not found'

Re: [ansible-project] [WARNING]: provided hosts list is empty, only localhost is available

2020-05-24 Thread James Cassell
On Sun, May 24, 2020, at 6:56 PM, Tony Wong wrote: > --- > - name: get info vm > hosts: localhost > connection: local > gather_facts: false > vars: > vm_list: > - dr-reb > - dr-wac > tasks: > - name: get info about the virtual machine > vmware_guest_info: > hostname: vcenter >

Re: [ansible-project] AWX (ansible tower) yum module extra variables

2020-05-24 Thread Stefan Hornburg (Racke)
On 5/24/20 9:20 PM, Jerry Hwang wrote: > Hi, > > I am trying yum module on AWX (ansible tower). > AWX -> Inventories -> Run command -> select module: yum etc. > > In the "EXTRA VARIABLES" section on AWX WebUI, what I should put in yaml if I > want to install wget for example. > I have tried to

[ansible-project] ansible shell variable

2020-05-24 Thread Andrew Morgan
Hello All, I have an ansible script that I am writing to use meta data from an aws ec2 instance. I want to create and image of a list og servers from my inventory file them launch each one, then perform a function then terminate the instances.I am currently stuck on trying to get the subnet

Re: [ansible-project] filter on attribute value

2020-05-24 Thread Anuj Agrawal
True, but I was hoping I could validate that the variable is not set to true for more than one host. On Mon, May 25, 2020 at 12:18 AM Dick Visser wrote: > > You could default that variable to true in a single location, so it's easy to > spot in the inventory? > > On Sun, 24 May 2020 at 19:58,

Re: [ansible-project] [WARNING]: provided hosts list is empty, only localhost is available

2020-05-24 Thread Vladimir Botka
On Sun, 24 May 2020 16:13:56 -0700 Tony Wong wrote: > [WARNING]: provided hosts list is empty, only localhost is available. Note > that the implicit localhost does not match 'all' Run the command below a see what's going on shell> ansible-inventory -vvv --graph -- You received this message

Re: [ansible-project] [WARNING]: provided hosts list is empty, only localhost is available

2020-05-24 Thread Tony Wong
tony@ubuntu:~/ansiblework$ ansible-playbook vmware_tools.yml -vvv ansible-playbook 2.9.0 config file = /home/tony/ansiblework/ansible.cfg configured module search path = [u'/home/tony/ansiblework/library'] ansible python module location = /home/tony/.local/lib/python2.7/site-packages/ansible

Re: [ansible-project] unable to generate backup file with registered variable in ansible

2020-05-24 Thread Stefan Hornburg (Racke)
On 5/25/20 4:52 AM, Sadanand Alegaonkar wrote: > Hello Dick, > > Thanks for giving reply,  > Yes corrected this error but the purpose is not getting fulfilled. > > I was trying to rename old file in the file system. it is giving below error. > > getting "file.results["stdout"]": "VARIABLE IS

Re: [ansible-project] ansible shell variable

2020-05-24 Thread Vladimir Botka
On Sun, 24 May 2020 20:31:12 -0700 (PDT) Andrew Morgan wrote: > > > 1) get the mac address > > > 2) get the subnet > > > > > > --- > > > - hosts: dev > > > become: true > > > #connection: local > > > gather_facts: true > > Run the command below a see what "facts" are available

Re: [ansible-project] [WARNING]: provided hosts list is empty, only localhost is available

2020-05-24 Thread Tony Wong
Thanks! but I dont see any output running it [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' PLAY [get info vm]

[ansible-project] [WARNING]: provided hosts list is empty, only localhost is available

2020-05-24 Thread Tony Wong
--- - name: get info vm hosts: localhost connection: local gather_facts: false vars: vm_list: - dr-reb - dr-wac tasks: - name: get info about the virtual machine vmware_guest_info: hostname: vcenter username: administrator@vsphere.local

Re: [ansible-project] ansible shell variable

2020-05-24 Thread Vladimir Botka
On Sun, 24 May 2020 16:55:52 -0700 (PDT) Andrew Morgan wrote: > 1) get the mac address > 2) get the subnet > > --- > - hosts: dev > become: true > #connection: local > gather_facts: true Run the command below a see what "facts" are available when "gather_facts: true" is enabled.

Re: [ansible-project] Join two variables

2020-05-24 Thread Geo P.C.
Thanks.. Working fine now. Thanks Geo On Sun, May 24, 2020 at 10:30 PM Dick Visser wrote: > The error is correct. You can't add one dict to another using the + > operand. > Use combine instead: > > >

[ansible-project] Ansible and Service Now

2020-05-24 Thread varsha Choudhary
Hi Guys I am working on Service Asset and Configuration Management and the tool which I use is Service Now We have also integrated BMC discovery with Service Now to discover CIs and relationship between them. But we do have some challenges with BMC discovery. Please help me know how Ansible

[ansible-project] Join two variables

2020-05-24 Thread Geo P.C.
I have two variable definition files as follows *vars.yml* aws_common_tags: Project: "{{ project_name }}" Application: "{{ application_name }}" Region: "{{ aws_region }}" Ansible: "Yes" *instance.yml* ec2_instance_tags: environment_name: dev Now in task.yml I am tryin to create aws ec2

Re: [ansible-project] Re: Removing a deep nested element from dict (json structure)

2020-05-24 Thread sebastien Morissette
Also the combine examples seem to allways refer to key / value pairs.. in the perms list i only have values.. the keys are not present ... Le dimanche 24 mai 2020 13:04:46 UTC-4, sebastien Morissette a écrit : > > Hi Dick, > > i've been trying, but the issue is that I am receiving this

Re: [ansible-project] Inject vault password with plugin

2020-05-24 Thread Dick Visser
Hi, im not entirely sure what you mean but you may want to look at https://docs.ansible.com/ansible/latest/plugins/lookup/hashi_vault.html On Sun, 24 May 2020 at 13:54, FERREIRA CHRISTOPHE < christopheantunesferre...@gmail.com> wrote: > Hello it's possible to inject vault password with custom

Re: [ansible-project] Re: Removing a deep nested element from dict (json structure)

2020-05-24 Thread sebastien Morissette
Hi Dick, i've been trying, but the issue is that I am receiving this structre back from a call to an api / rest using uri module, then I need to post back the updated structure but after many hours i'm not getting the combine to work as it should.. i'm probably turning arround the solution

[ansible-project] filter on attribute value

2020-05-24 Thread Anuj Agrawal
I want to validate my inventory to have only a certain number of hosts to have a certain value. I tried to do that using assert but I am unable to find a way to do so. Example inventory (ini) file: [nginx] 10.52.130.31 [backends] 10.52.194.41 read_only="true" 10.52.130.2 read_only="false"

Re: [ansible-project] Re: Removing a deep nested element from dict (json structure)

2020-05-24 Thread Dick Visser
This should work: tasks: - set_fact: filtered_users: "{{ filtered_users|default([]) | union( [ item | combine( {'perms': item.perms|difference(['delete']) } )] ) }}" loop: "{{ my_body|json_query('users[]') }}" - set_fact: new_body: "{{ my_body |

Re: [ansible-project] unable to generate backup file with registered variable in ansible

2020-05-24 Thread Dick Visser
On Sun, 24 May 2020 at 08:46, Sadanand Alegaonkar < sadanandalegaon...@gmail.com> wrote: > SUMMARY > > I trynig to take backup of existing file. reported below error > > ERROR! failed at splitting arguments, either an unbalanced jinja2 block or > quotes: cp "{{file.stdout}" "{{file.stdout}}"_bkp

Re: [ansible-project] Re: Removing a deep nested element from dict (json structure)

2020-05-24 Thread Dick Visser
I would combine this dict with another Dict that what you want. See https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html#combining-hashes-dictionaries On Sun, 24 May 2020 at 16:44, sebastien Morissette wrote: > tested the json in jq, had errors in it.. here is the

Re: [ansible-project] Join two variables

2020-05-24 Thread Dick Visser
The error is correct. You can't add one dict to another using the + operand. Use combine instead: https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html#combining-hashes-dictionaries On Sun, 24 May 2020 at 18:23, Geo P.C. wrote: > > > I have two variable definition files

Re: [ansible-project] filter on attribute value

2020-05-24 Thread Dick Visser
You could default that variable to true in a single location, so it's easy to spot in the inventory? On Sun, 24 May 2020 at 19:58, Anuj Agrawal wrote: > I want to validate my inventory to have only a certain number of hosts > to have a certain value. I tried to do that using assert but I am >

Re: [ansible-project] Re: Removing a deep nested element from dict (json structure)

2020-05-24 Thread sebastien Morissette
wow! it works perfectly!!! I was going about it the wrong way.. I was decomposing the whole structure to pieces, to update those and then reconstruct... i was ending up getting into nested loop issues because I needed to iterate over both the number of perms and the number of items in the

[ansible-project] AWX (ansible tower) yum module extra variables

2020-05-24 Thread Jerry Hwang
Hi, I am trying yum module on AWX (ansible tower). AWX -> Inventories -> Run command -> select module: yum etc. In the "EXTRA VARIABLES" section on AWX WebUI, what I should put in yaml if I want to install wget for example. I have tried to put name: wget state: present also name: - wget