[ansible-project] how do we read a set_fact variable of a dynamic host into different play localhost ?

2019-11-24 Thread Shifa Shaikh
Here is my requirement: - I have a playbook where I add the dynamic host to group "desthosts" in [Play 1] - In [Play 2] desthosts group I append a set_fact variable "storerecords". - In [Play 3] I try to read set_fact "storerecords" of Play 2 however, I get

[ansible-project] Unable to load variable from include_vars into my playbook

2020-02-24 Thread Shifa Shaikh
I have a playbook where I load a variable file cat vars/BASE.yaml EXCLUDE_front: value1 EXCLUDE_back: value2 I run my test.yml playbook using this command: ansible-playbook test.yml -e Layer="back" -e base_folder="/tmp" - name: Load a variable file" include_vars: file:

[ansible-project] How to escape single quotes within single quotes in Ansible

2020-02-25 Thread Shifa Shaikh
Below is my playbook: - set_fact: excludefolders: "{{ excludefolders + ' -o -name ' + item | default('') }}" with_items: "{{ lookup('vars', 'EXCLUDE_' + Layer).split(',') }}" - debug: msg: "excludedfolder is {{ excludefolders }}" I get the below output ok:

[ansible-project] set_fact undefined variable issue when concat string to itself.

2020-02-25 Thread Shifa Shaikh
I need to set_fact variable and contact to itself a list of items as below: - set_fact: excludefolders: "{{ excludefolders + ' -o -name ' + item | default('') }}" with_items: "{{ lookup('vars', 'MY_' + Layer).split(',') }}" Getting error: FAILED! => {"msg": "The task

Re: [ansible-project] How to escape single quotes within single quotes in Ansible

2020-02-25 Thread Shifa Shaikh
cke) wrote: > > On 2/26/20 8:05 AM, Shifa Shaikh wrote: > > Below is my playbook: > > > > | > >-set_fact: > >excludefolders:"{{ excludefolders + ' -o -name ' + item | > default('') }}" > > with_items:"{{ look

Re: [ansible-project] Unable to load variable from include_vars into my playbook

2020-02-25 Thread Shifa Shaikh
ble.com/ansible/latest/plugins/lookup/vars.html > > > > Also try to use the args: chdir option instead of doing &&, see > > https://docs.ansible.com/ansible/latest/modules/shell_module.html > > > > "{{ vars['EXCLUDE_' + Layer] }}" should work though.

Re: [ansible-project] set_fact undefined variable issue when concat string to itself.

2020-02-26 Thread Shifa Shaikh
with_items: "{{ lookup('vars', 'EXCLUDE_' + Layer).split(',') }}" > > On Wed, Feb 26, 2020 at 12:00 PM Shifa Shaikh > wrote: > >> I need to set_fact variable and contact to itself a list of items as >> below: >> >> - set_fact: >

[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] 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] Convert list to string in rendered Jinja template

2020-03-06 Thread Shifa Shaikh
I have a variable files like below: layers: - name: APP things: - cactus - lotus - jasmine - rose bgcolor: - sky blue - name: WAS things: - mango - apple bgcolor: - yellow Below is my jinja

Re: [ansible-project] Convert list to string in rendered Jinja template

2020-03-06 Thread Shifa Shaikh
Thank you @Stefan, That solves the issue !! On Friday, March 6, 2020 at 2:32:07 PM UTC+5:30, Stefan Hornburg (Racke) wrote: > > On 3/6/20 9:04 AM, Shifa Shaikh wrote: > > I have a variable files like below: > > > > | > > layers: > > -name:APP &g

[ansible-project] How to incorporate if else statement in Jinja template.

2020-03-06 Thread Shifa Shaikh
Here is my variable file layers: - name: APP things: - cactus - lotus - jasmine - rose - name: WAS things: - mango - apple Below is my jinja template file: {% for layer in layers %} {% for item in layer.things %} {{

Re: [ansible-project] How to incorporate if else statement in Jinja template.

2020-03-06 Thread Shifa Shaikh
is about a for loop, but your template included in your email > doesn't have this loop. > > Looks like you didn't give us the good one > > Regards, > > JYL > > > Le 06/03/2020 à 11:52, Shifa Shaikh a écrit : > > Vladimir Hi, > > I tried > &

Re: [ansible-project] How to incorporate if else statement in Jinja template.

2020-03-06 Thread Shifa Shaikh
@Stefan I wish to check if the file bad*.txt exists on the path. Based on the if condition I wish to template different output. On Fri, 6 Mar, 2020, 5:34 pm Stefan Hornburg (Racke), wrote: > On 3/6/20 12:52 PM, Shifa Shaikh wrote: > > @Stefan I tried you suggestion of not using

Re: [ansible-project] How to incorporate if else statement in Jinja template.

2020-03-06 Thread Shifa Shaikh
r Botka wrote: > > On Fri, 6 Mar 2020 01:59:00 -0800 (PST) > Shifa Shaikh > wrote: > > > How do i put the if /else condition in the jinja template ? > > See "if" > https://jinja.palletsprojects.com/en/2.11.x/templates/#if > > -- You received this

Re: [ansible-project] How to incorporate if else statement in Jinja template.

2020-03-06 Thread Shifa Shaikh
}} > in the template on its own. > > Regards > Racke > > > > > Looks like you didn't give us the good one > > > > Regards, > > > > JYL > > > > > > Le 06/03/2020 à 11:52, Shifa Shaikh a écrit : > &

Re: [ansible-project] How to incorporate if else statement in Jinja template.

2020-03-06 Thread Shifa Shaikh
ve this loop. > > Looks like you didn't give us the good one > > Regards, > > JYL > > > Le 06/03/2020 à 11:52, Shifa Shaikh a écrit : > > Vladimir Hi, > > I tried > > {% if {{ playbook_dir }}/{{ item }}/bad*.txt | exists %} > > > {{ item }} >

Re: [ansible-project] How to incorporate if else statement in Jinja template.

2020-03-06 Thread Shifa Shaikh
6, 2020 at 5:13:26 PM UTC+5:30, Stefan Hornburg (Racke) wrote: > > On 3/6/20 11:52 AM, Shifa Shaikh wrote: > > Vladimir Hi, > > > > I tried > > > > | > > {%if{{playbook_dir }}/{{item }}/bad*.txt |exists %} > > > > Don't use the curly br

Re: [ansible-project] How to incorporate if else statement in Jinja template.

2020-03-06 Thread Shifa Shaikh
I know how to lookup a file using fileglob in Ansible but not sure how to inside a Jinja template. On Fri, 6 Mar, 2020, 5:55 pm Stefan Hornburg (Racke), wrote: > On 3/6/20 1:12 PM, Shifa Shaikh wrote: > > @Stefan I wish to check if the file bad*.txt exists on the pa

[ansible-project] Unable to read variable in a loop using include_vars.

2020-03-02 Thread Shifa Shaikh
Below is my playbook which loads variables and passes it to ls command on remote hosts. - name: Load repository include_vars: file="{{ playbook_dir }}/vars/listing.yml" name=user1 - set_fact: allinonecmd: "{{ allinonecmd | default('') + 'ls -ltr ' + item.path

Re: [ansible-project] Unable to read variable in a loop using include_vars.

2020-03-03 Thread Shifa Shaikh
vel. > You are using ansible to achieve something - what is that? > > On Tue, 3 Mar 2020 at 09:20, Shifa Shaikh wrote: > > > > Under an ip I want a variable ccode which will be global variable for > that ip. > > > > I also want variable name & path which wi

Re: [ansible-project] Unable to read variable in a loop using include_vars.

2020-03-03 Thread Shifa Shaikh
The reason for grabbing the ls output across servers is for audit purpose. The audit team randomly checks for this output with the server. On Tue, 3 Mar, 2020, 3:29 pm Stefan Hornburg (Racke), wrote: > On 3/3/20 10:53 AM, Shifa Shaikh wrote: > > I need to get the output of ls com

Re: [ansible-project] Unable to read variable in a loop using include_vars.

2020-03-03 Thread Shifa Shaikh
:53 AM, Shifa Shaikh wrote: > > I need to get the output of ls command from list of remote ips and under > each ip there is are different directories. The > > output of ls command needs to be saved in a file and the name of the > file should be the value of ccode variable

Re: [ansible-project] Unable to read variable in a loop using include_vars.

2020-03-03 Thread Shifa Shaikh
gt; Can you tell what is the big picture? What task is this intended for? > > On Tue, 3 Mar 2020 at 05:43, Shifa Shaikh wrote: > >> Below is my playbook which loads variables and passes it to ls command on >> remote hosts. >> >>- name: Load repository >>

[ansible-project] How do i loop over include_vars objects under a dictionary ?

2020-03-01 Thread Shifa Shaikh
I have a include_vars file with the below entries in listings.yml --- 10.9.9.42: - name: myapp path: /app/myapp_war.ear/myapp.war - name: myapp JS path: /app/myapp_war.ear/myapp.war/javascripts 10.9.9.43: - name: CVS path: /app/CVS.ear/CVS.war/ui/js - name: CHK path:

Re: [ansible-project] How do i loop over include_vars objects under a dictionary ?

2020-03-01 Thread Shifa Shaikh
@Vladimir this prints only the first name and path under the hostname. I wish to loop all name and path under the given host. On Monday, March 2, 2020 at 11:40:36 AM UTC+5:30, Vladimir Botka wrote: > > On Sun, 1 Mar 2020 21:37:42 -0800 (PST) > Shifa Shaikh > wrote: > &

Re: [ansible-project] What is the best approach to creating a inlude_vars file for my requirement

2020-01-26 Thread Shifa Shaikh
REALLY > looking to achieve. > The file names in your example suggest: "configuring a web server". > In which case, a few template tasks and a handler might be all you need. > > Dick > > > On Sat, 25 Jan 2020 at 00:10, Shifa Shaikh > wrote: > > >

[ansible-project] What is the best approach to creating a inlude_vars file for my requirement

2020-01-24 Thread Shifa Shaikh
I use the stat module to read multiple files statistics from each remote server. Thus, I'm able to get the file mode and checksum value of say 3 files on host1 and 2 files on host2. I wish to know what is a good way to create/construct an include_vars file so that I can easily read back each

[ansible-project] How to fix warning message conditional statements should not include jinja2 templating delimiters

2020-02-11 Thread Shifa Shaikh
How do I make changes to the below complex when condition without breaking the code in order to address the warning. - debug: msg: "Hi" when: entrycurrdb.stdout.find("{{ hostvars['localhost']['BASEPATH_FINAL'] }}/{{ vars[(item | splitext)[1].split('.')[1] | default('exe')] }}/{{

[ansible-project] How to fix warning message conditional statements should not include jinja2 templating delimiters

2020-02-11 Thread Shifa Shaikh
How do I make changes to the below complex when condition without breaking the code in order to address the warning. - debug: msg: "Hi" when: entrycurrdb.stdout.find("{{ hostvars['localhost']['BASEPATH_FINAL'] }}/{{ vars[(item | splitext)[1].split('.')[1] | default('exe')] }}/{{

Re: [ansible-project] Unable to print regex registered variable in Ansible

2020-01-15 Thread Shifa Shaikh
pected failure during module execution.", > "stdout": "" > } On Wednesday, January 15, 2020 at 12:04:52 PM UTC+5:30, Jean-Yves LENHOF wrote: > > Hi, > > Perhaps you should better use slurp module to register the content of the > file and do s

[ansible-project] How to print all matched strings using Ansible regex

2020-01-14 Thread Shifa Shaikh
I wish to match all lines that begin with SSLFile or SSLFile in a file httpd.conf on a remote server and store the matched found strings in a variable for use later in the playbook. Below is what i did. - name: Find entries shell: "cat /tmp/httpd.conf" register: filecontent

[ansible-project] Unable to print regex registered variable in Ansible

2020-01-14 Thread Shifa Shaikh
I wish to search for all entries of string starting with "SSLFile" or starting with "SSLFile" in a file(httpd.conf) and register it to a variable and print all the matches found. The string is found as evident from the output and the file is not modified which is good; but I'm unable to print

[ansible-project] How to specify foldername with wildcard inside a jinja template

2020-03-06 Thread Shifa Shaikh
I wish to check using if condition inside a jinja template where any of the folders starting with the name "dump_" has any file starting with the name bad For for single folder the below jinja template works as suggested by an expert on this forum. {% if lookup('fileglob', playbook_dir +

[ansible-project] How to get include_vars variable inside Jinja template ?

2020-03-09 Thread Shifa Shaikh
Experts Hi, I have couple of variable files like below: $ cat vars_ip.yml --- 12.1.1.25: TAP1 12.1.1.26: TAP2 11.0.0.26: TAP3 11.0.0.27: TAP4 9.2.2.211: SAT1 9.2.2.212: SAT2 10.7.7.28: SAT3 10.7.7.29: SAT4 9.2.2.213: SAT5 10.7.7.30: SAT6 $ cat vars.yml --- layers: - name: MY_LAYER

[ansible-project] How to use same loop index for two list from variable file in Jinja template

2020-03-09 Thread Shifa Shaikh
I have a variable file like below: 12.1.1.25: TAP1 12.1.1.26: TAP2 11.0.0.26: TAP3 11.0.0.27: TAP4 9.2.2.211: SAT1 9.2.2.212: SAT2 10.7.7.28: SAT3 10.7.7.29: SAT4 layers: - name: MY_LAYER things_prod: - 12.1.1.25 - 12.1.1.26 things_dr: - 11.0.0.26

[ansible-project] rescue block does not print message despite being invoked

2020-03-12 Thread Shifa Shaikh
Hi, I have a playbook with a task that greps for a string in a file. If the string is found the block should fail which is the case. However, in the fail module it fails to print the message. Here is my playbook: Here is my playbook: --- - name: "Play 1" hosts: localhost tasks: -

Re: [ansible-project] rescue block does not print message despite being invoked

2020-03-12 Thread Shifa Shaikh
quot;Database is not reachable." ) }} On Fri, 13 Mar, 2020, 8:06 am James Cassell, wrote: > > On Thu, Mar 12, 2020, at 10:12 PM, Shifa Shaikh wrote: > > Hi, > > > > I have a playbook with a task that greps for a string in a file. If the >

Re: [ansible-project] unable to create directory using ansible file module

2020-03-16 Thread Shifa Shaikh
board/{{ my_result.name }} > state=directory recurse=yes" > > Do this: > >- file: path="{{ playbook_dir }}/dashboard/{{ my_result.name }}" > state=directory recurse=yes > > > On Mon, 16 Mar 2020 at 08:41, Shifa Shaikh > wrote: > >

[ansible-project] unable to create directory using ansible file module

2020-03-16 Thread Shifa Shaikh
Here is my variable file: cat vars.yml --- layers: - name: APP layers: - name: WLS Here is my playbook cat varloop.yml --- hosts: localhost vars_files: - vars.yml tasks: - name: Create sublinks based of bad.txt files include_tasks: "{{

Re: [ansible-project] unable to create directory using ansible file module

2020-03-16 Thread Shifa Shaikh
ce examples of how loops work: > > > https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html#iterating-over-a-simple-list > > > > > On Mon, 16 Mar 2020 at 08:21, Shifa Shaikh > wrote: > > > > Here is my variable file: > > > > cat v

Re: [ansible-project] Unable to get correct disk space utilized percentage using Ansible API

2020-03-25 Thread Shifa Shaikh
ase let me know what's wrong and why the difference? On Wednesday, March 25, 2020 at 10:10:24 PM UTC+5:30, Kai Stian Olstad wrote: > > On Wed, Mar 25, 2020 at 07:15:51AM -0700, Shifa Shaikh wrote: > > > > "{{ ansible_host }}_{{ item.mount }}: {{ (100 * ((item.si

[ansible-project] Integer comparision issue in jinja2 template Ansible

2020-03-26 Thread Shifa Shaikh
My jinja2 template yields correct value for the variable {{ vars[allip.name | join("")] | default('ERR') }} The variable has value 82.3 which gets printed by Ansible's template module. I wish to write an if condition where I want to check if the value of the variable is more than 80 {% if (

[ansible-project] Integer comparison if condition jinja2 template Ansible does not work

2020-03-26 Thread Shifa Shaikh
My jinja2 template yields correct value for the variable {{ vars[allip.name | join("")] | default('ERR') }} The variable has value 82.3 which gets printed by Ansible's template module. I wish to write an if condition where I want to check if the value of the variable is more than 80 {% if (

[ansible-project] Unable to get remote target hostname when using delegate_to

2020-03-25 Thread Shifa Shaikh
Below playbook gets the disk usage percentage of '/tmp' from a list of remote_hosts [20 remote servers] and stores it locally (delegate_to) in a file {{ playbook_dir }}/tmpfiles/stats.yml --- hosts: remote_hosts tasks: - name: Generate JSON data lineinfile: path: "{{

Re: [ansible-project] Unable to get correct disk space utilized percentage using Ansible API

2020-03-26 Thread Shifa Shaikh
Thank you @Kai for the excellent explanation :) On Thursday, March 26, 2020 at 12:41:00 AM UTC+5:30, Kai Stian Olstad wrote: > > On Wed, Mar 25, 2020 at 09:54:07AM -0700, Shifa Shaikh wrote: > > @Kia Hi, > > > > As suggested I tried > > > > item.size_

[ansible-project] Unable to get correct disk usage percentage using Ansible API

2020-03-25 Thread Shifa Shaikh
Here is the output of df -k from the target server: ok: [myhostone] => (item={u'block_used': 2857014, u'uuid': > u'3fa1ec29-aca5-476b-8041-6a7bc6b1efc2', u'size_total': 52701921280, > u'block_total': 12866680, u'mount': u'/ihs', u'block_available': 10009666, > u'size_available':

[ansible-project] Unable to get correct disk space utilized percentage using Ansible API

2020-03-25 Thread Shifa Shaikh
Here is the output of df -k from the target server: # df -k > Filesystem 1K-blocks Used Available Use% Mounted on > devtmpfs 1905280 0 1905280 0% /dev > tmpfs 1922024 0 1922024 0% /dev/shm > /dev/sda1 1942528 295616 1646912 16% /boot > /dev/mapper/OMT-home 15718400 832120 14886280 6% /home >

[ansible-project] How to execute Play 2 only if Play 1 succeeds

2020-03-29 Thread Shifa Shaikh
I have two Plays having one task each. The first Play 1 checks if the/var/test.datexists on each target host. Only if the Play 1 is successful do I want the second play Play 2 to run which executes scripts in parallel. If Play 1 fails i.e if the test.dat does not exist I wish to

[ansible-project] Unable to run java code with classpath on a remote server

2020-05-15 Thread Shifa Shaikh
In order to run java code I need to first set the classpath of dependent libraries by running a script setWLSEnv.sh as below: $ . /app/wlserv*/server/bin/setWLSEnv.sh $ java weblogic.version The output gives me the version of the product which I need. I wrote the below playbook but it does

[ansible-project] Re: Unable to run java code with classpath on a remote server

2020-05-16 Thread Shifa Shaikh
environment: CLASSPATH: "{{ wlsenv.stdout }}" register: wlsversion - debug: msg: "{{ wlsversion }} On Saturday, May 16, 2020 at 12:47:26 AM UTC+5:30, Shifa Shaikh wrote: > > In order to run java code I need to first set the classpath of d

[ansible-project] Unable to print include_vars dictionary & list variables

2020-03-24 Thread Shifa Shaikh
Below is my playbook that loads and prints the variables --- - name: Demonstrating variables in Jinja2 Loops hosts: localhost - name: Load variable files include_vars: file="{{ playbook_dir }}/vars/vars.yml" - debug: msg: "COUNTRY {{

[ansible-project] Getting command not found when executing using shell module

2020-03-17 Thread Shifa Shaikh
Here is my playbook: cat test.yml - name: Play 2 hosts: targetserver tasks: - copy: src=./centosscript.sh dest=~ mode=775 - shell: ~/centosscript.sh Here is my shell script: cat centosscript.sh #/bin/ksh grabip=`ip r | grep kernel` I also tried grabip=`ifconfig | grep inet`

[ansible-project] getting command not found error when using ansible shell module to execute shell script.

2020-03-17 Thread Shifa Shaikh
Here is my playbook: cat test.yml - name: Play 2 hosts: targetserver tasks: - copy: src=./centosscript.sh dest=~ mode=775 - shell: ~/centosscript.sh Here is my shell script: cat centosscript.sh #/bin/ksh grabip=`ip r | grep kernel` I also tried grabip=`ifconfig | grep inet`

[ansible-project] ERROR! 'retries' is not a valid attribute for a TaskInclude

2020-05-20 Thread Shifa Shaikh
My requirement is to run the script stop-all as many times (5 retries) until the output of ps -fu user1 |wc -l becomes less than 2. I wrote the below ansible playbook for the same: cat stop.yml - hosts: dest_nodes tasks: - name: Start service include_tasks: "{{ playbook-dir

[ansible-project] Re: ERROR! 'retries' is not a valid attribute for a TaskInclude

2020-05-21 Thread Shifa Shaikh
@Stefan Our service involves a set of processes thus, the start script invokes those several processes and hence the need to count the number of processes using `wc -l` to determine if the service (not the process) is running or not. On Thursday, May 21, 2020 at 8:18:56 AM UTC+5:30, Shifa

[ansible-project] How to print only the failed telnet connections from my localhost

2020-06-29 Thread Shifa Shaikh
Below is my playbook that helps check telnet connections from my localhost to all remote hosts. - wait_for: host: "{{ item }}" port: 22 state: started # Port should be open delay: 0 # No wait before first check (sec)

[ansible-project] Add new line “\n” character to Ansible set_fact variable

2020-06-03 Thread Shifa Shaikh
How can I add new line characters to Ansible variable mailbody. This mailbody variable is used for mail module's body attribute. I tried the below from suggestions but none of them works. 1. - set_fact: mailbody: "{{ mailbody | default('') + 'PROFILE_NAME:' + PROFILE_NAME ~

Re: [ansible-project] Add new line “\n” character to Ansible set_fact variable

2020-06-03 Thread Shifa Shaikh
ot;\n\n\n\n\" }}" Can someone please suggest? On Wednesday, June 3, 2020 at 11:49:10 PM UTC+5:30, Dick Visser wrote: > > I won't comment on whatever it is you're trying to do, but in any case you > need to use double quotes around the newlines > > On Wed, 3 Jun 2020 at

Re: [ansible-project] Add new line “\n” character to Ansible set_fact variable

2020-06-03 Thread Shifa Shaikh
}} \n\n\n\n\" On Thursday, June 4, 2020 at 2:27:48 AM UTC+5:30, Shifa Shaikh wrote: > > @Dick VIsser Hi, > > Upon your suggestion, I tried something like this but it too does not work. > >- set_fact: > >mailbody: "{{ mailbody | default('') + 'PROF

Re: [ansible-project] Add new line “\n” character to Ansible set_fact variable

2020-06-03 Thread Shifa Shaikh
Stephan Hi, The article does not discuss newline inside parenthesis `{{` inside a variable definition. That is where I have no clue. On Thursday, June 4, 2020 at 10:31:41 AM UTC+5:30, Stefan Hornburg (Racke) wrote: > > On 6/4/20 6:41 AM, Shifa Shaikh wrote: > > I tried all of th

Re: [ansible-project] Add new line “\n” character to Ansible set_fact variable

2020-06-04 Thread Shifa Shaikh
" "{{ 'SERVER_NAME: ' + SERVER_NAME }}" and mailbody: | "{{ mailbody | default('') + 'PROFILE_NAME: ' + PROFILE_NAME }}" + "\\n" "{{ 'SERVER_NAME: ' + SERVER_NAME }}" On Thu, Jun 4, 2020 at 11:38 AM Stefan Hornburg (Racke) wro

Re: [ansible-project] Add new line “\n” character to Ansible set_fact variable

2020-06-04 Thread Shifa Shaikh
2020 at 1:26:56 PM UTC+5:30, Stefan Hornburg (Racke) wrote: > > On 6/4/20 8:54 AM, Shifa Shaikh wrote: > > I tried multiline too as below, but that too fails > > > >mailbody: | > > "{{ mailbody | default('') + 'PROFILE_NAME: ' + PROFILE_NAME

Re: [ansible-project] Add new line “\n” character to Ansible set_fact variable

2020-06-04 Thread Shifa Shaikh
@Dick Hi, That was a typo the problem remains writing to a file is all good with newlines while writing to email body does not translate "\n" as new line !! Could this be a bug ? On Thu, Jun 4, 2020 at 3:37 PM Dick Visser wrote: > On Thu, 4 Jun 2020 at 10:50, Shifa Shaikh wrote:

Re: [ansible-project] Add new line “\n” character to Ansible set_fact variable

2020-06-04 Thread Shifa Shaikh
ou already put two errors in your task which prevent it from running > correctly. > So in that light, i'm wondering if your actual task does, in fact, > contain more differences than what you've posted here. > > Also, "prints '\n'" indicates that you're echoing? a

[ansible-project] Check if passwordless ssh works after checking telnet from localhost

2020-07-27 Thread Shifa Shaikh
I wish to list down all the hosts where it first checks for working telnet on port 22. If telnet succeeds; it should check for passwordless ssh and list down all hosts where telnet works but passwordless ssh fails. The below playbook helps with the first part of checking all hosts where telnet