Re: [ansible-project] Getting a message if register failed inside a task

2020-03-05 Thread Vladimir Botka
On Thu, 5 Mar 2020 22:09:49 -0800 (PST) דודו דודו wrote: > I have a task that create a folder on HDFS storage. > If the folder exists I wish to show a message > > - hosts: gw > become: true > become_user: hdfs > tasks: >- name: create folder in HDFS > shell: hadoop dfs -mkdir

[ansible-project] Getting a message if register failed inside a task

2020-03-05 Thread דודו דודו
HI, I have a task that create a folder on HDFS storage. If the folder exists I wish to show a message - hosts: gw become: true become_user: hdfs tasks: - name: create folder in HDFS shell: hadoop dfs -mkdir /tmp/dudu ignore_errors: yes register: result when:

Re: [ansible-project] Ansible output customize

2020-03-05 Thread Parveen Datt
Hi JYL, Here is what i mean. TASK [debug] *** ok: [192.168.56.50] => (item= 00:48:30 up 2 min, 1 user, load average: 0.05, 0.06, 0.03) => { "msg": "

[ansible-project] Need help construct a complex HTML using Jinja template.

2020-03-05 Thread Shifa Shaikh
Experts Hi, I have a variable file that has a set of flowers, colors, and countries. # cat vars/DASHBOARD_vars.yaml --- myarch: - COLOR: name: blue,white,black,green - FLOWER: name: rose,jasmine - COUNTRY: name: Japan,Germany,France I wish to create one HTML file each,

[ansible-project] Re: Calling powershell function via Ansible

2020-03-05 Thread Jesse Lyon
Jordan, The methodology I was following was "if it worked through ise, why's this not pass it properly?", I knew I was doing something wrong, I just didn't know what yet. I'll give this a shot in the morning and report back. After 12 punches on the card of "Jordan saves the day" do you earn a

[ansible-project] New Ansible release 2.8.10

2020-03-05 Thread Matt Clay
Hi all- we're happy to announce that the general release of Ansible 2.8.10 is now available! How do you get it? -- $ pip install ansible==2.8.10 --user The tar.gz of the release can be found here: * 2.8.10 https://releases.ansible.com/ansible/ansible-2.8.10.tar.gz SHA256:

[ansible-project] Re: Calling powershell function via Ansible

2020-03-05 Thread Jordan Borean
When you call powershell.exe with -File you cannot run multiple commands after that, it's designed to run a script with potential arguments. You can even see in the error from powershell it thinks the file it needs to run is `C:\Scripts\USERNAME\dfsadd_func.ps1;' (with the semicolon) so that's

Re: [ansible-project] Ansible Split JSON Return

2020-03-05 Thread Kai Stian Olstad
On 05.03.2020 15:52, David Foley wrote: Have the Following Playbook Which Returns the following ok: [localhost] => { "mdb.json": [ The [ is telling us that mdb.json is a list, the fist element in a list i 0. { "mac-address": "xx:xx:xx:xx:xx" } ] }

Re: [ansible-project] File operations failing on shared file system #67410

2020-03-05 Thread Kai Stian Olstad
On 04.03.2020 22:34, Stephen Gevers wrote: I still haven't figured out why this justifies the developer's conclusion. Because it has nothing to do with Ansible and everything to do with your OS and network protocol you are using to your NAS. Ansible just ask the OS and report the answer it

[ansible-project] Re: Build a file based on list only when another part of list matches ansible_hostname

2020-03-05 Thread John
I was able to figure it out. I just had to think about it a bit more: - name: Extract Errors lineinfile: line: "{{ item.ErrorMessage }}" path: "{{ error_log }}" insertafter: EOF create: yes state: present loop: "{{ csv_content.list }}" when: item.Host is

[ansible-project] Build a file based on list only when another part of list matches ansible_hostname

2020-03-05 Thread John
I need to create a file based on the output of the csv_content variable. Specifically I want to extract the ErrorMessage only, but the caveat is that I want only the errors associated with ansible_hostname. That way on each server I am extracting only the ErrorMessages that are relevant to

[ansible-project] Creating a new F5 policy rule

2020-03-05 Thread Sharon Day
I'm trying to create a policy rule using a loop to add multiple rules. I'm getting an error and I have tried several scenarios but can't figure out. here's what I have. Here are the vars: rules: A3-JL1L-test.local: - rl_name: test.local actions: - type: forward

Re: [ansible-project] Know if a variable come from extra_vars

2020-03-05 Thread Kai Stian Olstad
On 03.03.2020 11:53, Quentin Aveno wrote: I think it's not possible Correct. -- Kai Stian Olstad -- 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] Calling powershell function via Ansible

2020-03-05 Thread Jesse Lyon
I have a function, it works perfectly if I run it directly from my target server. powershell.exe -ExecutionPolicy ByPass -file "C:\Scripts\USERNAME\dfsadd_func.ps1"; dfsadd -junction Apps -obj_name toast -prd_vserver PROD -dr_vserver DR -prd_state online -dr_state offline With success seen

[ansible-project] Re: Ansible 2.8 hanging with bash command

2020-03-05 Thread John
I am using the following. Not sure if there is a better solution: - name: Gather error reports in background shell: | while read line; do grep -i "$line" "{{ log_source }}"* | uniq > "{{ dest_dir }}/{{ ansible_hostname }}-$line.txt" done < "{{ error_log }}"

[ansible-project] Re: Ansible deployng VM and transfering and execute shell script on remote host

2020-03-05 Thread Julio Cesar Caraca
Hi Racke , I moved the script to /tmp directory and also changed permission to 777. In the playbook I just put: - name: testing script: /tmp/shell.sh The virtual machine is created with success and I figured out that the shell script is executed with success but in the localhost

[ansible-project] Need to construct complex HTML file from Jinja template

2020-03-05 Thread Shifa Shaikh
Experts Hi, I have a variable file that has a set of flowers, colors, and countries. # cat vars/DASHBOARD_vars.yaml --- myarch: - name: brown,white,black,green - name: rose,jasmine - name: Japan,Germany,France I wish to create one HTML file each, thus 1 HTML for all colors, 1 HTML

[ansible-project] Ansible 2.8 hanging with bash command

2020-03-05 Thread John
I have a task that searches logs for specific errors in various logs (up to 7 days worth of logs). When searching through just one log I never had an issue, but when searching through the 7 logs (used a wildcard to accomplish this), sometimes Ansible goes to lunch and doesn't recover. It just

[ansible-project] Re: Ansible Split JSON Return

2020-03-05 Thread Cade Lambert
Ok, try this then: - debug: msg: "{{ item.mac-address }}" loop: "{{ mdb.json }}" On Thursday, March 5, 2020 at 10:45:03 AM UTC-5, David Foley wrote: > > - > - hosts: localhost > gather_facts: false > tasks: > - name: Getting Mac Address > uri: > url: http://.com >

[ansible-project] Re: Ansible Split JSON Return

2020-03-05 Thread David Foley
- - hosts: localhost gather_facts: false tasks: - name: Getting Mac Address uri: url: http://.com return_content: yes register: mdb - debug: msg: "{{ mdb.json }}" -- You received this message because you are subscribed to the Google Groups "Ansible

[ansible-project] Re: Ansible Split JSON Return

2020-03-05 Thread Cade Lambert
What's your plabook look like? You'll probably have to loop through your JSON results as it looks like it's a list. On Thursday, March 5, 2020 at 10:34:40 AM UTC-5, David Foley wrote: > > When i do Both > > "{{ mdb.json.mac-address }}" > "{{ mdb.json.split(':')[1:6] | join(':') }}" > > It

[ansible-project] Re: Ansible Split JSON Return

2020-03-05 Thread David Foley
When i do Both "{{ mdb.json.mac-address }}" "{{ mdb.json.split(':')[1:6] | join(':') }}" It returns fatal: [localhost]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'list object' has no attribute 'mac'\n\nThe error appears to be in

[ansible-project] Re: Ansible Split JSON Return

2020-03-05 Thread Cade Lambert
Something like this would work I believe: "{{ mdb.json.split(':')[1:6] | join(':') }}" Also, could you not just reference it directly by using "{{ mdb.json.mac-address }}"? On Thursday, March 5, 2020 at 9:52:52 AM UTC-5, David Foley wrote: > > Have the Following Playbook Which Returns the

Re: [ansible-project] Re: Testing Authentication with Ansible

2020-03-05 Thread Cade Lambert
Circling back around to this. What do you mean by crawlers? Any you'd recommend. I did notice the URI module can pass credentials to a site, but when I try that it works with any credentials, even non-existent or incorrect credentials, so I'm not totally sure what that is actually doing

[ansible-project] Ansible Split JSON Return

2020-03-05 Thread David Foley
Have the Following Playbook Which Returns the following ok: [localhost] => { "mdb.json": [ { "mac-address": "xx:xx:xx:xx:xx" } ] } -- - hosts: localhost gather_facts: false tasks: - name: Getting Mac Address uri: url="http://.com?field=mac-address;

Re: [ansible-project] Re: Unable to access variables from host_vars dir however can access the same variables when specified in roles/defaults/mail.yml

2020-03-05 Thread anil gouranna
i think you will have to provide the path using vars_files in the playbook and then run. On Wed, Mar 4, 2020 at 9:09 PM Vishal Bobade wrote: > @sagarmujumale - any idea on this? > > On Wednesday, March 4, 2020 at 7:19:44 PM UTC+5:30, Vishal Bobade wrote: >> >> >> TASK [ansible-manage-lvm :

Re: [ansible-project] Re: Ansible deployng VM and transfering and execute shell script on remote host

2020-03-05 Thread Stefan Hornburg (Racke)
On 3/5/20 2:14 PM, Julio Cesar Caraca wrote: > Hi Racke, > > Thanks for the answer! > > All configuration that I´ve been trying is based on this documentation: > https://docs.ansible.com/ansible/latest/modules/shell_module.html > > Although I´m getting error the virtual machine is been created

[ansible-project] Re: Ansible deployng VM and transfering and execute shell script on remote host

2020-03-05 Thread Julio Cesar Caraca
Hi Racke, Thanks for the answer! All configuration that I´ve been trying is based on this documentation: https://docs.ansible.com/ansible/latest/modules/shell_module.html Although I´m getting error the virtual machine is been created but without the copy and execution of shell script: [image:

[ansible-project] New Ansible releases 2.9.6 and 2.8.9

2020-03-05 Thread Matt Clay
Hi all- we're happy to announce that the general release of Ansible 2.9.6 and 2.8.9 are now available! How do you get it? -- $ pip install ansible==2.9.6 --user or $ pip install ansible==2.8.9 --user The tar.gz of the releases can be found here: * 2.9.6