A beginners guide to programming and automating stuff

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

RHCE – Network teaming or bonding

In CentOS 7 it’s possible to configure to separate network interfaces to work together. Combining two network interfaces like this is referred to as ‘Link Aggregation’. Link aggregations has the following benefits: combined bandwith – This means improved performance, better performance load balancing – So that one interface doesn’t do . . . 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

Git – Handy git tools and utilities

Find and get rid of really big files from your git repo: Handy tool for getting rid of stale bug/feature branches that have already been merged in to the main release/master branches:

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

Puppet – querying puppetdb with postgres command line (psql)

Exported Resources querying puppetdb with postgres command line, psql psql -h localhost -U puppetdb puppetdb However to connect to puppet enterprise’s puppetdb, then follow: \q \h \l \d select * FROM catalog_resources \X \x SELECT * FROM catalog_resourcesSELECT * FROM factsselect * from factsssselect * from reports . . . Read more

AWS – SSL termination on the ELB   Terminating SSL using Amazon ELB In my case I replaced: !/elbcheck.html with: ^(.*)$

RHCE – Network Teaming

Link Aggregation In RHEL/CentOS it is possible to combine two (physical or virtual) network interfaces so that they act as one. Having 2 network interfaces acting as one is referred to as link aggregation. There’s 2 advantages to setting up link aggregations: Improved redundancy – i.e. one interface is active, and . . . Read more