Sponsored Content
Special Forums UNIX and Linux Applications Passing variables from UNIX to Ansible to UNIX shell Post 302995440 by bakunin on Wednesday 5th of April 2017 04:43:01 PM
Old 04-05-2017
Quote:
Originally Posted by mohtashims
I m passing a variable stringg from Unix shell which has value 'Good Day' to ansible and from ansible to a second shell script where it print only Good instead of 'Good Day'

Code:
echo $stringg
  ansible-playbook install.yml -i /web/hostfiles/myhost.txt --extra-vars "mystring=$stringg"

I suppose the problem is this:

Code:
"mystring=$stringg"

because it is quoted on the outside, so the shell which interprets the command ansible-playbook ... will not interfere, but what is inside the quotes is interpreted by this ansible-playbook-command. Inside is an unquoted string, though, and if this command works similar to a shell it will interpret the string:

Code:
mystring=Good day

as declaration of the variable "mystring" with a value of "Good" and (maybe silently) drop "day" as a redundant word. Try it this way:

Code:
"mystring=\"$stringg\""

which might work (i don't know this ansible-playbook command, so you will have to try).

I hope this helps.

bakunin
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Passing the value of Out parm in SP to UNIX Shell Script

I have a simple procedure which accepts two input parms and returns and output count: CREATE OR REPLACE Procedure GET1 ( IN_FOLDER IN VARCHAR2, IN_SUBJECT_AREA IN VARCHAR2, OUT_CNT IN OUT VARCHAR2 ) AS BEGIN ... (2 Replies)
Discussion started by: Hangman2
2 Replies

2. UNIX for Dummies Questions & Answers

Unix passing environmental Variables

In my script when I change an env variable in the parent shell it is only changed for that session - it there away to change it permanently using a script so that when I use rlogin (create a child session) that the env variable is set correctly? Basically what I am trying to do is to pass a... (7 Replies)
Discussion started by: belfastbelle
7 Replies

3. Shell Programming and Scripting

SSH - Passing Unix login passwords through shell scripts

Hi All , I need to call a script runscript_B.sh on server A, the runscript_B.sh script locating in server B. The runscript_B.sh in calls another script runscript_A on server A itself. it seend, i need to be connect from Server A to Server B using ssh. I have tryed like this in... (3 Replies)
Discussion started by: koti_rama
3 Replies

4. UNIX for Dummies Questions & Answers

Help Passing An Oracle parameter to a unix shell.

I have an Oracle concurrent program that I'm passing a parameter to a unix shell script. An example value of the Oracle parameter is PO_TOP. The Oracle parameter represents the unix env var PO_TOP, meaning, on the unix side there is env var called PO_TOP (ex value: /oradev/apps/po/11.0.3/). My... (7 Replies)
Discussion started by: Mark_Wright
7 Replies

5. Shell Programming and Scripting

Passing a value to stored procedure from unix shell script

Hi Dudes :) I want a unix shell script to pass value to SQL stored procedure. Below is the procedure declare res varchar2(10); begin odm_load_check('PRE_SANITY',res); dbms_output.put_line(res); end; select * from error_log; truncate table error_log; select * from test; (1 Reply)
Discussion started by: shirdi
1 Replies

6. Homework & Coursework Questions

Passing shell variables to a webpage

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: This is my assignment as a whole - Use SVG to present certain dynamic (the raw data should change at least once... (5 Replies)
Discussion started by: ChedWick
5 Replies

7. Shell Programming and Scripting

Passing awk variables to shell

Hi. I need to parse file and assign some values to variables, right now i do like below MYHOMEDIR=`awk '/Home/ {print $NF}' output.txt` MYSHELL=`awk '/Shell/ {print $NF}' output.txt` PRGRP=`awk '/Primary/ {print $NF}' output.txt` SECGRP=`awk '/Second/ {print $NF}' output.txt` In this... (10 Replies)
Discussion started by: urello
10 Replies

8. Shell Programming and Scripting

Help Needed: UNIX shell variables to store Oracle table records

Hello Folks, I'm working on a requirement to automate the process of generating report(csv file) using metadata info stored in an Oracle table and E-mail it to respective people. Meta data table: Report_ID,Report_SUB_ID,Report_DB,Report_SQL,Report_to_email_Id 1,1,DEV,'select * From... (2 Replies)
Discussion started by: venkat_reddy
2 Replies

9. Shell Programming and Scripting

UNIX: passing stuff to a shell function

I have users that print files to selected printers. Instead of creating one function for each printer I would like to have just one and passing the files to print as well as the wanted printer. The following code does not work, of course. I'm expecting that $1 is the list of files to be printed... (6 Replies)
Discussion started by: emare
6 Replies

10. UNIX for Beginners Questions & Answers

SHELL: UNIX : Ls regular expression not working when used with variables

If i do below command in unix prompt which static values (ie 27..97), it is working fine and gives desired output >ls -d $WORKDIR/batch/somefilename_{27..97}.* 2>/dev/null somefilename_27.sometxt somefilename_28.sometxt somefilename_29.sometxt .. somefilename_97.sometxt But if i want... (2 Replies)
Discussion started by: haiderali
2 Replies
IDLE(1) 						      General Commands Manual							   IDLE(1)

NAME
IDLE - An Integrated DeveLopment Environment for Python SYNTAX
idle [ -dins ] [ -t title ] [ file ...] idle [ -dins ] [ -t title ] ( -c cmd | -r file ) [ arg ...] idle [ -dins ] [ -t title ] - [ arg ...] DESCRIPTION
This manual page documents briefly the idle command. This manual page was written for Debian because the original program does not have a manual page. For more information, refer to IDLE's help menu. IDLE is an Integrated DeveLopment Environment for Python. IDLE is based on Tkinter, Python's bindings to the Tk widget set. Features are 100% pure Python, multi-windows with multiple undo and Python colorizing, a Python shell window subclass, a debugger. IDLE is cross-plat- form, i.e. it works on all platforms where Tk is installed. OPTIONS
-h Print this help message and exit. -n Run IDLE without a subprocess (see Help/IDLE Help for details). The following options will override the IDLE 'settings' configuration: -e Open an edit window. -i Open a shell window. The following options imply -i and will open a shell: -c cmd Run the command in a shell, or -r file Run script from file. -d Enable the debugger. -s Run $IDLESTARTUP or $PYTHONSTARTUP before anything else. -t title Set title of shell window. A default edit window will be bypassed when -c, -r, or - are used. [arg]* and [file]* are passed to the command (-c) or script (-r) in sys.argv[1:]. EXAMPLES
idle Open an edit window or shell depending on IDLE's configuration. idle foo.py foobar.py Edit the files, also open a shell if configured to start with shell. idle -est "Baz" foo.py Run $IDLESTARTUP or $PYTHONSTARTUP, edit foo.py, and open a shell window with the title "Baz". idle -c "import sys; print sys.argv" "foo" Open a shell window and run the command, passing "-c" in sys.argv[0] and "foo" in sys.argv[1]. idle -d -s -r foo.py "Hello World" Open a shell window, run a startup script, enable the debugger, and run foo.py, passing "foo.py" in sys.argv[0] and "Hello World" in sys.argv[1]. echo "import sys; print sys.argv" | idle - "foobar" Open a shell window, run the script piped in, passing '' in sys.argv[0] and "foobar" in sys.argv[1]. SEE ALSO
python(1). AUTHORS
Various. 21 September 2004 IDLE(1)
All times are GMT -4. The time now is 02:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy