Target multiple IP addresses in SaltStack - salt-stack

I know it's possible to target a specific IP address or a CIDR using salt's -S <ip_addr> option but let's say I only want to target specific IP addresses and not the entire CIDR, how do you do this in salt?

With compound targeting:
salt -C 'S#192.168.0.5 or S#192.168.1.2' test.ping
If you're frequently targeting the same set of minions, you could also define a nodegroup for them.

Related

Best practice to get and set network properties of minions by salt

I want to get and set network properties those one are in this picture by salt(If I want to be more specific salt-api).
Ubuntu network information
I know I can get some ip and netmask by salt.modules.network.interfaces and gateway from salt.modules.network.default_route and set network properties of windows machines by WIN_IP but I think there must be a better way.
Also I didn't find a way to gather dns of minions yet.
thanks in advance

Jclouds - Neutron specify a nic when associating a floating ip

I create instances with multiple network interfaces. However when I associate an floating ip to the instance as below, floating ip is always get allocated to the first interface of the instance.
api.addToServer(ip, server-id);
How do I get the floating ip assigned to the second or an interface other than the first interface. I could not find a way of specifying a nic when associating an floating ip.
I tried a different approach using Openstack commandline and seems it is working.
neutron floatingip-create ext
neutron floatingip-associate floating_ip-id port-id
However I could not find a way to associate a floating ip to a port also.
Then starting the instance with the port-id.
The floating IP extension for Neutron is not supported as of right now 8/20/14 in jclouds.
Is this feature available in JClouds latest release 1.8.1.
Thanks !

zsh tab completion for ssh using IP Address

I ssh into several machines that are just IP Addresses, however I noticed a while back that tab completion stopped working when trying to SSH to them. I use zsh and I can tab complete a regular domain name with ssh, but all the IP machines that I use dont tab complete any more, did something break here? or whats the deal?
OS X - 10.9.3
zsh - 5.0.2
have you set the use-ip style?
zstyle ':completion:*' use-ip true
the documentation says that ip addresses are stripped from the host databases by default. use-ip allows completion of them.
http://zsh.sourceforge.net/Doc/Release/Completion-System.html#index-use_002dip_002c-completion-style
Your ssh might be hashing the entries at known_hosts?
Best usability solution in general for ssh IMO is to create ssh host aliases, and then just use the alias in the command line. Eg. add something like this to you ~/.ssh/config
Host foo
# HostName also accepts numeric IP addresses
HostName XXX.ZZZ.YYY.BBB
then you just use scp backup.tar foo:
Check man ssh_config for more info. From the manual:
HashKnownHosts
Indicates that ssh(1) should hash host names and addresses when they are added to ~/.ssh/known_hosts. These hashed names
may be used normally by ssh(1) and sshd(8), but they do not reveal identifying information should the file's contents be
disclosed. The default is “no”. Note that existing names and addresses in known hosts files will not be converted auto‐
matically, but may be manually hashed using ssh-keygen(1). Use of this option may break facilities such as tab-comple‐
tion that rely on being able to read unhashed host names from ~/.ssh/known_hosts.
Ok ignore the above, I see in a comment that that is not the case, will leave it there for reference though.
PS: you can always manually set the hosts to be completed by zsh using something along the lines of:
hosts=(foo.bar.com faa.bar.com fee.bar.com)
zstyle ':completion:*:hosts' hosts $hosts
Or do a much more complicated version of it, such as described here https://www.maze.io/2008/08/03/remote-tabcompletion-using-openssh-and-zsh/index.html

Identifying machine uniquely: Is it necessary to have one hostname per machine

I need to uniquely identify a machine despite it having multiple IP addresses(which a common scenarios for linux machines) what I am thinking of is to use hostname as an identifier for the machine/system(host name in /etc/hostname). Is it mandatory that a system will have only one hostname or a system can have multiple host names.
Any help appreciated.
I would identify it as some combination of hostname, MAC address, processor serial number, and hardware serial number. This may not be possible with virtualization, though a virtualized machine should have a unique MAC, unless someone has duplicated it.
Also, I'd get the hostname with uname -n rather than parsing /etc/hostname. Not all Unixes (HP-UX) use /etc/hostname, so this increases portability.
f.e your host is connected to networks 192.168.1.12 and 10.0.1.14
Edit your /etc/hosts with
192.168.1.12 ethhost
10.0.1.14 wlanhost
Now you will be able to ping your host with both names ethhost and wlanhost

Is there any Query Retrieve SCP client which supports IPV6?

I am using DVTK for my various needs for testing DICOM related functionalists with my application. Unfortunately the Query Retrieve SCP client doesn't support IPV6 format. Any other utilities are there to allow to query data using IPV6?
Yo could try dcmqr (*1) from the package dcm4che2 (*2).
I have only used that tool on IPv4 environments. According to the documentation, some packages of the toolkit do support IPv6:
To specify a port with an IPv6 address, enclose the IPv6 address in
square brackets before appending the colon and decimal port number
I have not found specific indications about support for IPv6 in the Q/R tool, so, you will have to test it on your environment.
(*1) http://www.dcm4che.org/confluence/display/d2/dcmqr
(*2) http://www.dcm4che.org/confluence/display/d2/dcm4che2+DICOM+Toolkit

Resources