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. this guide: 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 # # 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   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 +short {list of ip address} This gives a list of ip addresses, since 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: 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.