Questions tagged [variables]

25 questions
0
votes
1 answer

Use variable to construct dictionary key in Ansible

I am trying to update a dict in a hostvar, and the name of the key is constructed using a variable (node). For example, if 'node' is 1 then I want to update hostvars['fakehost']['mydict']['localaddress1']. Here's my code: - name: Read IPv4 of…
TSG
  • 1,674
  • 7
  • 32
  • 51
0
votes
0 answers

Apache2 mod_userdir+mod_authnz_external, how to limit access to own home

I have an Apache2 setup with mod_userdir and mod_authnz_external+pwauth so that each user can access his home and can be authenticated by his local UNIX credentials. Now I need some kind of authorization so that each user can, after being…
mstud
  • 101
0
votes
1 answer

How to permanently set vault token and url remote server in macos

On Linux I'm setting vault variables to /etc/environment next: export VAULT_URL='https://some-remote-server.org:8200/' export VAULT_TOKEN='SoMeToKeN' But when I'm typeing this in macos, after $> vault status I'm getting Error checking seal status:…
0
votes
1 answer

BASH script variables have no values

I am writing a simple script to clean up log folders. This is the most basic thing I can think of, and yet it does not work because the variables don't seem to be set. Here is the shell script beginning, where it…
Jay Imerman
  • 121
  • 1
  • 6
0
votes
1 answer

Variables covered in b' ' in Python 3

I am sure this is a fairly noob question, I have googled, and cannot find a straight answer, but I may be asking the wrong thing... I am trying to make an Out Of Box Configuration script, and all the questions that need answered are stored in a…
0
votes
1 answer

ansible: difference between a variable and a fact

While I'm using Ansible for quite some time, I'm not sure I really understand the differences between a variable and a fact. Could someone explain me, possibly with an example where it really make a difference ?
0
votes
1 answer

Shell script to remove quotes when using SED

I'm trying to change a line of syntax in a config file where the line looks like the following: host="192.0.2.100" I'm writing a script that would require input the user to change the ip and keep the same format as above. What I…
0
votes
1 answer

Get the previous day date as variable in batch file from powershell command output

The scenario is like this. I need a previous day date (i.e. Today -1) as variable in a batch file. But if previous day is Sunday (i.e. script running on Monday) it should return the Saturday's date (i.e. Today -2). I have tried the below script but…
0
votes
2 answers

ssh : user and host / host_ip as variables

I would like to create an array with the variables $user and $host in order to pass them to the ssh command. I have tried: my_array=('something1' 'something2' 'user' 'host_ip') sudo ssh ${my_array[2]}@${my_array[3]} my_array=('something1'…
Phineas
  • 103
  • 3
-1
votes
2 answers

SCP exit 0 when using un-initialized variable and fail to copy

I am trying to test if a file fails to transfer using SCP. I noticed if I use a un-initialized variable, I get exit 0 even though the SCP fails. For example, I have an empty variable called uninitialized_var [root@centos_8_0 scripts]# echo…
1
2