Public Ip address of puppet agent - puppet

I am using Puppet for automation purpose. How can I get public IP address of agent machine connected to puppetserver. I want to use that IP address in my puppet manifest file.

The Puppet agent provides a set of facts about itself and its host as part of each catalog request. These are available to the catalog builder as top-scope variables, and also via the top-scope $facts hash. They include information about network interfaces and, in particular, IP addresses.
Do note, however, that machines typically have multiple IP addresses (including local addresses), some even have multiple routable addresses, and some must be referred to by different addresses in one network location than they are in others. Thus, the "public IP address" of a machine is not necessarily well- or uniquely defined. Facter does take a guess as to a single IP address for machines with IP networking, but you should not rely on that without an awareness of these issues.

Related

How to configure 2 files in 2 dependent instances in cloudformation script?

I am doing a lift and shift with software from an on-premises architecture. There are two servers (main and auxiliary) that have to talk to one another over the network. I currently have tested and confirmed that I can manually add their hostnames and private IP address to the hosts file ("C:\Windows\System32\drivers\etc\hosts") and the software works fine.
For those that don't know, this file is used by Windows to map a network hostname like EC2AM-1A2B3C to a IP address. So if I added the hostname and IP address of the main server into the hosts file of the auxiliary server, then the auxiliary server could route to the main server. (i.e. PS> ping EC2AM-1A2B3C would then work).
How could I pass the required information to both servers? They both have to know the other server's private IP address and hostname. If this is not possible at server spin-up time, how might the servers connect and pass this information? I would really like to automate this if possible.
According to your description, I have some suggestions that you can refer to.
If you want two EC2 instances to be able to communicate with each
other, you can use the method of adding rules to the security group.
(1) Create security groups for your instance 1 and instance 2 respectively.
(2) Add an inbound rule to the security group of instance 1, chose "ICMP-ipv4". Enter the security group ID of instance 2.
(3) Create the inbound rule for instance 2 in the same steps.
For more information on security group rules you can refer to the official document.
You have tried adding the hostname and IP address of the primary
server to the host file of the secondary server. To tell each other
the IP Address of the other machine. Amazon CloudFormation cannot
handle the circular dependency between the two instances.
You can refer to the answer of this question. To realize that both instances know each other's IP address.
Hope these suggestions are useful to you.

DHCP server providing two IP addresses to the same Host

I have two subnets (A and B) in the same local area network where all IP addresses are static. I just created a DHCP server to solve the problem of IP address conflict.
The problem that there are Hosts that must belong to both Subnets and therefore have two IP addresses.
The router solution is not accepted because if a subnet A station wants to access a station in network B, it must go through the router, but the traffic is very important (SQL queries for statistics) which can cause the flood of the router.
Short: Can I configure my DHCP server to provide two IP addresses to the same Host?
Server operating system: Linux Suse (DHCPD)
This is not a DHCP problem, it's a routing problem.
AFAICT DHCP only lets you specify one IP address per client, but it also lets you push static routes.
You do not need your client to have an IP on both networks, you just need it to know which route to use to reach peers on network A and B (ie direct route in both cases).
See https://gauvain.pocentek.net/docs/dhcpd-push-routes/ to specify static routes for DHCP.

Setting inbound ip address filter for ssh

I'm trying to set an one IP adresss (dynamic) as the source of inbound ssh rules for azure VM. But when its set to "any" works perfectly but given my local dynamic IP doesn't work(connection timed out).
Also tried giving CIDR block for source, but still confused as to why a single IP doesn't work.
Most 'Whats my IP' sites will give you your Public IP address that you can use for you NSG.
http://www.hazelnest.com/IPproject/MyIP/ip.php
But i believe the issue you are having is one i have seen in very large company networks, the IP you get from site is not really the IP for RDP/SSH.
Easiest and guaranteed way is to contact you networking guys to provide you with the information.
Another way is to check the IP you get on the RDP/SSH logs when you connect without restricting NSG. Then use that IP on the NSG, not that depending on the network this might change.
Linux:
Check the auth.log under the \var\log
IMAGE 1
Windows:
In the VM's Event Viewer, navigate to path below and check the event 22, that should have information.
Applications and Services Logs\Microsoft\Windows\TerminalServices-LocalSessionManager
IMAGE 2

The IP address of my Azure Windows VM changed without waning

A few days ago, the IP address of our VB Windows Server changed from 40.x.x.x to 13.x.x.x on the Azure platform. We have many loggers in the field that connect to this IP address and now, none of them can connect.
Can the IP change without any warning from Azure?
Also, there is no support to be found. No number, no online support... I mean, This is not a problem I should be paying support for... besides.. support is more expensive than the VM.
Your IP address will change if, for instance, you restart your virtual machine. However, you can set this to be static by doing so:
go to Public IP addresses
Click Configuration
Set assignment to Static
Click Save
This will retain the IP address that you have right now but at an additional cost.
Can the IP change without any warning from Azure?
For now, there is no warning when public IP address change. I think you should know IP address types and allocation methods in Azure.
There are two methods in which an IP address is allocated to a public IP resource - dynamic or static. The default allocation method is dynamic, where an IP address is not allocated at the time of its creation. Instead, the public IP address is allocated when you start (or create) the associated resource (like a VM or load balancer). The IP address is released when you stop (or delete) the resource. This causes the IP address to change when you stop and start a resource.
If you want to public IP address not change, you could change dynamic to static.

Azure VM IP Address

I'm trying to run some VOIP software on my Azure VM, but it's picking up the internal IP address 10.x.x.x and broadcasting it to external servers. The external servers obviously can't see that internal address. So, I want to configure the machine such that its IP address is the static external address (13.x.x.x). When I run ipconfig, I need the IPv4 address to be my (13.x.x.x). This way the VOIP software will broadcast the correct externally accessible IP address.
What's the best way to do this in Azure? Do I just go to the server itself and turn off "obtain IP address automatically" and put in my static external IP or is there some other "Azure" way of doing what I'm trying to do? PS. I'm pretty new to Azure VMs and associated IT management.
OK, so what I ended up doing is:
In the portal I added an address range and sub-net to the virtual network that included my external, static IP address
In the portal I changed the sub-net that the VM network interface was using to the new one that included my external IP. I also set the address to "static" and put in external address
Rebooted the VM
The VM now reports the internal address and external address as being the same external address which is what I wanted. Not sure if this is the best or only way to do this but it worked for me. Open to better recommendations if anyone has one.

Resources