[ansible-project] lxd connection: become/become_user ignored

2020-05-04 Thread Gaétan QUENTIN
# Problem using lxd connection to provision lxd containers: become directive is ignored ``` ``` # ISSUE TYPE - Bug Report # COMPONENT NAME command with become directive # ANSIBLE VERSION ``` ansible 2.9.7 config file = /home/myhome/.ansible/ansible.cfg configured module sea

[ansible-project] Re: MODULE FAILURE - TypeError: Value of unknown type: ,

2020-05-04 Thread Parasuram A Havoji
I upgraded ansible-modules-hashivault to 4.4.7 and it worked. Reference -https://github.com/TerryHowe/ansible-modules-hashivault/issues/238 On Thursday, April 30, 2020 at 3:33:34 PM UTC+5:30, Parasuram A Havoji wrote: > > Hello, > > > I am seeing module failure while using hashivault_write mo

Re: [ansible-project] Need help on formating stdout_lines output

2020-05-04 Thread Suresh Karpurapu
Hi Sai Stian, This syntax would be helpful but i may be using in wrong way as i am getting below errors. Please help on fixing the issue. - name: debug with with sequence debug: msg:"{{ volchk[item.stdout | int] }},{{ volchk[item.stdout | int + 1] }},{{ volchk[item.stdout | int + 2] }

[ansible-project] Re: _ec2_instance_facts.py botocore.exceptions.NoCredentialsError: Unable to locate credentials

2020-05-04 Thread Meir Yanovich
I'm answering my self and to help whom facing this problem i couldn't find it on the entire internet! the thing is that boto3 is searching for the AWS credentials in /etc/boto.cfg and not in .aws directory ... so to find out i had to debug ansible using this link which was very helpful https://doc

[ansible-project] Need help in formatting register variable

2020-05-04 Thread Sivaraman P
I have used the below play to display the files and folders with some pattern - name: Display backup files shell: "du -h {{partition}} --time | sort -rh | grep -o -P '(.*bk|.*bkup|.*bak|.*backup|.*logs' | sort -rh | awk -F'\t' '{print $3}'|uniq|head -n 100" register: status and while usin

Re: [ansible-project] ansible fact list

2020-05-04 Thread Brian Coca
As @Neha points out /etc/ansible/facts.d is a way to generate facts, does not list them. Here is a way to generate a copy of the facts for a server (on the machine that executes Ansible) : `ansible -m gather_facts --tree /var/tmp/ ` it will create a json file per host in '/var/tmp' with the ou

[ansible-project] ERROR! 'win_package' is not a valid attribute for a Play (Ansible controller version is 2.9)

2020-05-04 Thread Amit Kumar
Hi , As i have created two simple playbook to remove file from window system and create the file on window system. But getting error while i execute the both playbook. (Ansible controller version is 2.9) 1. remove_file.yml --- - name: remove a file (check mode) hosts: win win_package:

Re: [ansible-project] ERROR! 'win_package' is not a valid attribute for a Play (Ansible controller version is 2.9)

2020-05-04 Thread abhay srivastava
Please installed pywin module in Ansible server. On Mon, 4 May 2020 at 20:44, Amit Kumar wrote: > Hi , > > As i have created two simple playbook to remove file from window system > and create the file on window system. > But getting error while i execute the both playbook. (Ansible controller >

Re: [ansible-project] ERROR! 'win_package' is not a valid attribute for a Play (Ansible controller version is 2.9)

2020-05-04 Thread Matt Martz
Your yml files that you have referenced are not properly formatted plays. Read over this documentation: https://docs.ansible.com/ansible/latest/user_guide/playbooks_intro.html#playbook-language-example Ultimately, your first file is just a file with a task in it, and your 2nd is missing the `task

Re: [ansible-project] Need help in formatting register variable

2020-05-04 Thread Dick Visser
Hi Not sure what "eliminate the entire child path lines" means - is that some local jargon? Giving actual preferred output would avoid us doing any guestimations and/or (mis)interpretations of said jargon. Either way, yes you're using ansible, but just it's 'shell' module as a conveyor mechanism

Re: [ansible-project] Need help in formatting register variable

2020-05-04 Thread Stefan Hornburg (Racke)
On 5/4/20 6:12 PM, Dick Visser wrote: > Hi > > Not sure what "eliminate the entire child path lines" means - is that > some local jargon? > Giving actual preferred output would avoid us doing any guestimations > and/or (mis)interpretations of said jargon. > > Either way, yes you're using ansible,

[ansible-project] what is set_when_task_skipped=false replacment in ansible 2.9?

2020-05-04 Thread Meir Yanovich
i have old code which use set_when_task_skipped=false in register now it is not supported any more I'm getting on : - name: Find location register: login_app set_when_task_skipped=false when: result.stat.exists == True fatal: [10.0.4.211]: FAILED! => msg: 'Invalid variable name in ''regi

Re: [ansible-project] what is set_when_task_skipped=false replacment in ansible 2.9?

2020-05-04 Thread Matt Martz
To my knowledge, that has in the past created a literal variable named `login_app set_when_task_skipped=false` `set_when_task_skipped` isn't a feature of Ansible. We've recently made some changes to ensure that variables are legal. Likely you just want: `register: login_app` On Mon, May 4, 2020

[ansible-project] Share some sources now please

2020-05-04 Thread Jenny Den
Hey, there everyone this is Jenny a finance blogger from California, the United States and I want your help here so can you please share some sources related to 15 year refinance rates today in 2020. -- You received this message because you are subscribed to the Go

Re: [ansible-project] what is set_when_task_skipped=false replacment in ansible 2.9?

2020-05-04 Thread Meir Yanovich
Then it failed when I remove it and when The register var is not set , So basically what is the right way to do it ? The same function set_when_task_skipped=false Did On Mon, May 4, 2020, 9:20 PM Matt Martz wrote: > To my knowledge, that has in the past created a literal variable named > `login_

[ansible-project] Ansible lininfile behavior

2020-05-04 Thread Justin Nelson
I have a simple playbook that I'm testing with in an attempt to update a file that has some test strings mapped to mac addresses. When I run my playbook I can only seem to get one of my two hosts to write the test string into the playbook and not both. If I run it a second time, I can get the s

Re: [ansible-project] what is set_when_task_skipped=false replacment in ansible 2.9?

2020-05-04 Thread Matt Martz
set_when_task_skipped=false is not a feature of Ansible and has never done anything. I see a stackoverflow post seeming to indicate it was a feature. However, that is incorrect. Whatever you expected it to do, never worked to begin with. On Mon, May 4, 2020 at 1:50 PM Meir Yanovich wrote: > T

Re: [ansible-project] what is set_when_task_skipped=false replacment in ansible 2.9?

2020-05-04 Thread Meir Yanovich
Maybe it was experimental plug in ... On Mon, May 4, 2020, 9:58 PM Matt Martz wrote: > set_when_task_skipped=false is not a feature of Ansible and has never done > anything. > > I see a stackoverflow post seeming to indicate it was a feature. However, > that is incorrect. > > Whatever you expe

Re: [ansible-project] Ansible lininfile behavior

2020-05-04 Thread Vladimir Botka
On Mon, 4 May 2020 11:55:19 -0700 (PDT) Justin Nelson wrote: > ... When I run my playbook I can only seem to get one of my two hosts ... > > - name: Update File > hosts: > - test_group > connection: local > > [...] > > [test_group] > host1 > host2 > > [...] > > What am I missing to make

Re: [ansible-project] Ansible lininfile behavior

2020-05-04 Thread Vladimir Botka
On Mon, 4 May 2020 11:55:19 -0700 (PDT) Justin Nelson wrote: > - name: Update File > hosts: test_group > ... > tasks: > ... > - name: Update test file > lineinfile: > path: /var/tmp/test.yaml > regexp: "^\ \ test[.-]{{ test_string|lower }}:.*" > lin

Re: [ansible-project] Ansible lininfile behavior

2020-05-04 Thread Justin Nelson
My apologies for not being a little more clear, Vlado. I do want this to execute on the local host and not on the remote hosts. Ultimately this will be setting up a file that will be used later for building a remote host's config file using the template module. It's all a part of an attempt at

Re: [ansible-project] Ansible lininfile behavior

2020-05-04 Thread Vladimir Botka
On Mon, 4 May 2020 11:55:19 -0700 (PDT) Justin Nelson wrote: > - name: Update File > hosts: test_group > ... > tasks: > ... > - name: Update test file > lineinfile: > path: /var/tmp/test.yaml > regexp: "^\ \ test[.-]{{ test_string|lower }}:.*" > lin

Re: [ansible-project] Ansible lininfile behavior

2020-05-04 Thread Justin Nelson
So I added the delegate_to: localhost but I still only get one added on the first pass: PLAY [Test Playbook] TASK [Load device vars from config]

Re: [ansible-project] Ansible lininfile behavior

2020-05-04 Thread Kai Stian Olstad
On Mon, May 04, 2020 at 11:55:19AM -0700, Justin Nelson wrote: > I have a simple playbook that I'm testing with in an attempt to update a > file that has some test strings mapped to mac addresses. When I run my > playbook I can only seem to get one of my two hosts to write the test > string into

Re: [ansible-project] what is set_when_task_skipped=false replacment in ansible 2.9?

2020-05-04 Thread Meir Yanovich
as i see it used to be or it merged and then removed https://github.com/ansible/ansible/pull/8062 On Monday, May 4, 2020 at 9:58:02 PM UTC+3, Matt Martz wrote: > > set_when_task_skipped=false is not a feature of Ansible and has never done > anything. > > I see a stackoverflow post seeming to i

Re: [ansible-project] Ansible lininfile behavior

2020-05-04 Thread Vladimir Botka
On Mon, 4 May 2020 22:31:49 +0200 Kai Stian Olstad wrote: > > [test_group] > > host1 > > host2 > > Since you have two host you will have two tasks that tries to write to the > same > file at the same time, and only one of them will win. > > Add "throttle: 1" to you lineinfile task and it wil

Re: [ansible-project] Ansible lininfile behavior

2020-05-04 Thread Justin Nelson
The two hosts I have to test with are running 2.7.4 and 2.8.2. I don't have a 2.9.x host available to test the throttle command but it makes sense. However, when I updated the playbook to the following: --- - name: Test Playbook hosts: - test_group gather_facts: no connection: local

Re: [ansible-project] Ansible lininfile behavior

2020-05-04 Thread Vladimir Botka
On Mon, 4 May 2020 13:26:41 -0700 (PDT) Justin Nelson wrote: > The file contents after that pass are: > > 1 macs: > 2 test-host222: ab:09:87:65:43:21 > > And when I run it a second time: > > 1 macs: > 2 test-host222: ab:09:87:65:43:21 > 3 test-host111: 12:34:56:78:90:ab It's w

Re: [ansible-project] Ansible lininfile behavior

2020-05-04 Thread Kai Stian Olstad
On Mon, May 04, 2020 at 10:49:38PM +0200, Vladimir Botka wrote: > On Mon, 4 May 2020 22:31:49 +0200 > Kai Stian Olstad wrote: > > > > [test_group] > > > host1 > > > host2 > > > > Since you have two host you will have two tasks that tries to write to the > > same > > file at the same time, and

Re: [ansible-project] Need help on formating stdout_lines output

2020-05-04 Thread Suresh Karpurapu
Here is my playbook, i would like to display all lines in stdout_lines in below format without miss. I am able to display only first 3 lines but host03 has more than 3 lines even it may be more lines for other hosts. Would anyone please help me? Required output fle: == host1,nfsflr

Re: [ansible-project] what is set_when_task_skipped=false replacment in ansible 2.9?

2020-05-04 Thread Meir Yanovich
basically, after looking into the entire internet again when regarding to ansible i see that there is no info or no simple answer on : "how to not set the register variable when the task is skipped " so what is the standard way ? On Monday, May 4, 2020 at 9:58:02 PM UTC+3, Matt Martz wrote: > > s

[ansible-project] How to check if a word is present in list

2020-05-04 Thread Jenisha T
My output from script execution is agent: { "stdout_lines": [ The network is reachable. Connected using winrm, executin COMPLETED at 4/5, The file is saved at D:\ ] } I want to extract 'COMPLETED' from this list. In python logic: listToStr = ' '.join([str(elem) for elem in agent[

Re: [ansible-project] Ansible lininfile behavior

2020-05-04 Thread Kai Stian Olstad
On Mon, May 04, 2020 at 02:02:13PM -0700, Justin Nelson wrote: > The two hosts I have to test with are running 2.7.4 and 2.8.2. I don't have > a 2.9.x host available to test the throttle command but it makes sense. > > However, when I updated the playbook to the following: > > --- > - name: Test

Re: [ansible-project] Ansible lininfile behavior

2020-05-04 Thread Vladimir Botka
On Mon, 4 May 2020 13:26:41 -0700 (PDT) Justin Nelson wrote: > The file contents after that pass are: > > 1 macs: > 2 test-host222: ab:09:87:65:43:21 > > With the file contents now the following: > > 1 macs: > 2 test-host222: ab:09:87:65:43:21 > 3 test-host111: 12:34:56:78:90:a

Re: [ansible-project] what is set_when_task_skipped=false replacment in ansible 2.9?

2020-05-04 Thread Matt Martz
There is no way to prevent registering if the task is skipped. You should register to different variable names to avoid overwriting. On Mon, May 4, 2020 at 4:16 PM Meir Yanovich wrote: > basically, after looking into the entire internet again when regarding to > ansible i see that there is no i

Re: [ansible-project] How to check if a word is present in list

2020-05-04 Thread Matt Martz
agent.stdout_lines|select('search', 'COMPLETED')|list != [] On Mon, May 4, 2020 at 4:18 PM Jenisha T wrote: > My output from script execution is > > agent: { > "stdout_lines": [ The network is reachable. Connected using > winrm, executin COMPLETED at 4/5, The file is saved at D:\ ] >

Re: [ansible-project] Ansible lininfile behavior

2020-05-04 Thread Justin Nelson
The main one I'm testing with is running python 3.6 shell>$ ansible --version ansible 2.7.4 config file = /etc/ansible/ansible.cfg configured module search path = ['/home/ofoo/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/local/lib/p

Re: [ansible-project] Ansible lininfile behavior

2020-05-04 Thread Vladimir Botka
On Mon, 4 May 2020 23:06:50 +0200 Kai Stian Olstad wrote: > > > Add "throttle: 1" to you lineinfile task and it will work. > > > > I don't need "throttle" with 2.9.6. The playbook > > That is just pure luck, try running it 100 times and count how many times it > fails. Well, I tried and it'

Re: [ansible-project] Ansible lininfile behavior

2020-05-04 Thread Kai Stian Olstad
On Mon, May 04, 2020 at 11:19:53PM +0200, Vladimir Botka wrote: > On Mon, 4 May 2020 13:26:41 -0700 (PDT) > Justin Nelson wrote: > > > The file contents after that pass are: > > > > 1 macs: > > 2 test-host222: ab:09:87:65:43:21 > > > > With the file contents now the following: > > > >

Re: [ansible-project] Ansible lininfile behavior

2020-05-04 Thread Vladimir Botka
On Tue, 5 May 2020 00:02:40 +0200 Kai Stian Olstad wrote: > On Mon, May 04, 2020 at 11:19:53PM +0200, Vladimir Botka wrote: > > There is no such problem with Ansible running on controller with Python 3 > > That's just not true, your test method is flawed, you need to test it more > than one t

[ansible-project] Failed to send key...to virtual machine due to None

2020-05-04 Thread Landon Tom
Hi, I just started using Ansible and I'm having trouble sending key strokes to a VM to select options for an OS install. However, I get a "Failed to send key ... to virtual machine due to None" when trying to send keys. I have also tried using string_send (just to see if it worked), and I also

Re: [ansible-project] How to check if a word is present in list

2020-05-04 Thread T. JENISHA
Hi Matt Martz Excellent solution. For my windows role I have to change to agent["stdout_lines"]|select('search','COMPLETED')|list != [] Best Regards Jenisha T Whatsapp: +91 07598087866 On Tue, 5 May 2020 at 02:53, Matt Martz wrote: > agent.stdout_lines|select('search', 'COMPLETED')|list !=

[ansible-project] Getting a message on folders created in a loop

2020-05-04 Thread דודו דודו
I’m running a playbook that should create 2 folders in a loop. If the folder is not existing, I wish to get a message that folders was created In my scenario, folder 1 already exists and only folder 2 was created. But the message was skipped – I’m guessing that the register is being updated