CodingBee

A beginners guide to programming and automating stuff

All posts in Uncategorized

Editing the httpd.conf file using Augeas

Sometimes you might want to edit the httpd.conf file using a shell script. For example let’s say we have the following file on our CentOS 7 machine: $ cat /etc/httpd/conf/httpd.conf ServerRoot “/etc/httpd” Listen 80 Include conf.modules.d/*.conf User apache Group apache ServerAdmin root@localhost AllowOverride none Require all denied DocumentRoot “/var/www/html” AllowOverride . . . Read more

puppet performance tuning

The latest version of PE 2016.4 has the capability to monitor the heap memory as a feature of puppet server 2.6. https://docs.puppet.com/puppetserver/2.6/status-api/v1/services.html#example-request-and-response-for-a-debug-level-get-request this guide: https://puppet.com/blog/puppet-server-advanced-memory-debugging https://docs.puppet.com/pe/latest/install_multimaster.html https://support.puppet.com/hc/en-us/articles/225049688 https://docs.puppet.com/puppetserver/latest/tuning_guide.html#number-of-jrubies Thundering herd test: After you’ve added hundreds of nodes to your deployment you may notice that your agents are running slow or . . . Read more

Puppet – Using AWS web console as Puppet’s external node classifier (ENC)

This is a script I wrote that queries the ec2 tags of an aws console, in order to figure out what environment a node belongs to, and what class to assign to it. #!/bin/bash # https://docs.puppetlabs.com/guides/external_nodes.html # http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html export AWS_ACCESS_KEY_ID=xxxxxxxxxxxxxxxxxxxxxx export AWS_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxxxx export AWS_DEFAULT_REGION=xxxxxxx instanceid=`echo $1 | awk -F”_” ‘{print . . . Read more

AWS – SSL termination on the ELB

http://docs.aws.amazon.com/elasticloadbalancing/latest/classic/using-elb-listenerconfig-quickref.html   Terminating SSL using Amazon ELB In my case I replaced: !/elbcheck.html with: ^(.*)$

Linux – The dig command

You can use the nslookup command to find what ip address a url resolves to. But another way to do this is by using the dig command: $ dig google.com +short {list of ip address} This gives a list of ip addresses, since google.com website is load-balanced across several servers. . . . Read more

AWS – Increasing the size of an EC2 instance’s primary EBS volume

This is really good guide: http://cloud.tekgoblin.com/2013/04/29/aws-guides-how-to-increase-your-ec2-linux-root-volume-size/ basically stop your instance, detach the primary volume (/dev/sda1), create a snapshot from this ebs volume, create a volume (with increased diskspace) from the snapshot, attach the new bigger volume to the ec2 instance, as /dev/sda1. start the instance again.