After creating VPC using standard private IP address and their subnets in Alibaba Cloud VPC.
The standard IP address ranges include 10.0.0.0/8, 172.16.0.0/12,
192.168.0.0/16 and the default is 172.16.0.0/12.
I am not able to modify CIDR Block
I appreciate any assistance with this.
It is not possible to change the vpc cidr block after creation.
See the documentation link https://www.alibabacloud.com/help/doc-detail/65430.htm
You need to create the new VPC with new CIDR range.
After creating the VPC you cannot modify the CIDR Block. If you want to modify the CIDR range then the optimal way is to create the new VPC with desired CIDR Range.
You can confirm the same on the Alibaba official documentation as well
Related
I'm new to Ansible so be patient. I was trying to create a dynamic inventory using Ansible's dynamic inventory pluging. In particular I'm using hcloud plugin to interface with Hetzner's API.
What I'd like to do is create 3 groups : databases, nfs, k8s.
All servers have already been tag as follows :
app=mysql for mySQL database servers
app=nfs for NFS servers
app=k8s for k8s cluster servers (workers and masters)
To say the docs are lacking is using an euphemism. I've tried using label_selector as follows with no success:
plugin: hcloud
token: hehe
groups:
databases:
label_selector: app=mysql
nfs:
label_selector: app=nfs
k8s:
label_selector: app=k8s
This indeed results in the creation of 3+ groups :
all
databases
nfs
k8s
ungrouped
hcloud
yet all groups contain all hosts, regardless of the label.
So my questions are :
Assuming I'm using something like keyed_groups, which "Add hosts to group based on the values of a variable.", where can I find accepted variables?In the example they use 'location', 'image_os_flavor' and 'status' but I haven't found a list of accepted variable names that I could use.
How could I implement a dynamic Inventory that reaches the previously explained goal?
Is it possible to add group variables in dynamically generated inventories?
Thanks a lot to everyone, let me know how to improve my question as well.
You can do:
groups:
databases: labels.app == 'mysql'
nfs: labels.app == 'nfs'
k8s: labels.app == 'k8s'
The documentation is here:
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/constructed_inventory.html
Is it possible to list nodes in a non-default AWS VPC? This can be done easily using EC2::DescribeInstances by passing a filter with vpc-id= but I can't figure out how to do it using jclouds.
I know how to create an instance in a specified VPC using template options, but I cannot find an equivalent approach for listing nodes. I'm currently using listNodesDetailsMatching(...).
You cannot eagerly filter that on the provider. Using the portable interface you can just provide a predicate to filter nodes once you have them all. You can directly use the underlying AWS EC2 API to do what you want. It could be something like the following:
AWSEC2Api aws = computeServiceContext.unwrapApi(AWSEC2Api.class);
AWSInstanceApi instanceApi = aws.getInstanceApi().get();
instanceApi.describeInstancesInRegionWithFilter("region", ImmutableMultimap.of("vpc-id", "myvpc"));
According to https://www.consul.io/docs/agent/options.html#_node_meta
I can associate with a consul node any metadata key/value pair.
Can prometheus read this metadata ?
I understand that only the following meta labels are available for prometheus:
__meta_consul_address: the address of the target
__meta_consul_node: the node name defined for the target
__meta_consul_tags: the list of tags of the target joined by the tag separator
__meta_consul_service: the name of the service the target belongs to
__meta_consul_service_address: the service address of the target
__meta_consul_service_port: the service port of the target
__meta_consul_service_id: the service ID of the target
__meta_consul_dc: the datacenter name for the target
But I would like to be absolutely sure that I miss nothing or there is no a trick to do it.
Thank you
That's not supported as the feature was only released a month ago, but feel free to send a pull request.
Yes. This was introduced into Prometheus 1.8
You can now simply reference __meta_consul_metadata_$KEYNAME
The following shows a prometheus label rewrite which filters the nodes 'location' metadata to a ldn fact which we've added to Consul agents running in London.
- source_labels: [__meta_consul_metadata_location]
separator: ;
regex: ldn
replacement: $1
action: keep
My code : http://pastebin.com/jzrYTR2u
What I want to achieve: My script should dynamically take the hosts with specific tag and perform the above tasks on each host one by one. Currently, I am taking the instance-id from elb_facts module.
What I have achieved till now: My script will take the first instance out from elb, will perform the deploy tasks, add back to elb. hosts file is currently hardcoded with IPs
Use the boto api to make a connection with AWS and use filters to find the instances you want. You can then recursively search through the list to get the instances and then the instance id's. An example below to make the request for filtered instances:
filters = dict()
filters["tag:Profile"] = node["profile"]
filters["tag:Environment"] = environment
filters["availability_zone"] = region + node["distribution"][index]["zone"]
filters["tag:ServiceName"] = node['service_name']
instances_aws = aws_connection.get_all_instances(filters=filters)
Hope this helps
I just tried to use Ruby's IPAddr class and I've been wondering if it is possible to create a new IPAddr with a netmask. To clarify my issue this is what I've done:
IPAddr.new "192.186.2.253/24"
=> #<IPAddr: IPv4:192.186.2.0/255.255.255.0>
What I would expect is to get this:
#<IPAddr: IPv4:192.186.2.253/255.255.255.0>
If I use the to_range method, the ip addresses are matching the second example.
Did i get anything wrong with this class? How can I achieve to initialize such an ip address without cutting off the host id.
Thanks a lot
When a netmask is supplied, the address is treated as a network address, not a host address, at least that's how I interpret your findings in combination with the docs:
If a prefixlen or a mask is specified, it returns a masked IP address.
I assume, by "masked IP address", the author means a network address, at least that's what makes the most sense given the behavior you observed and the description of the IPAddr#to_range method.