Skip to content

Instantly share code, notes, and snippets.

View dmccuk's full-sized avatar
🏠
Working from home

Dennis McCarthy dmccuk

🏠
Working from home
View GitHub Profile
@dmccuk
dmccuk / index.html
Created March 19, 2020 07:51
Basic site maintenance index.html
<!doctype html>
<title>LondonIAC meetup - Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@dmccuk
dmccuk / oscap_centos8
Last active January 2, 2024 02:16
install and configure OpenScap to work on Centos 8
### Install the required packages:
sudo yum install openscap-scanner scap-security-guide
### Can we run a report?
sudo oscap xccdf eval --profile xccdf_org.ssgproject.content_profile_ospp --report /tmp/report.html /usr/share/xml/scap/ssg/content/ssg-rhel8-ds.xml
first scan gives “notapplicable”
### Now do this…
sudo cp /usr/share/openscap/cpe/openscap-cpe-dict.xml /usr/share/openscap/cpe/openscap-cpe-dict.xml.dist
Subscribe to our YouTube channel here: https://www.youtube.com/c/LondonIAC/videos
### What you need:
1) A Jenkins server with SSH/pem key access to a webserver
(Follow this to build install Jenkins: https://youtu.be/-GyAraXQVWM)
2) A Github account
(The code I'm using today https://github.com/dmccuk/webapp1)
3) A webserver to display the results.
(that Jenkins can SSH to)
Ansible – Ad-hoc commands
The ability to use ad-hoc commands in Ansible without the need for playbooks is a very powerful tool. In the old days of
Linux and Unix administration (and even today!), the Admins would use a golden host or jump server with SSH keys and be
able to hop around their environments running remote command and colleting data. Ad-hoc commands in Ansible gives us this
same ability, but with a much more powerful tool at our fingertips.
---
Website: https://www.londoniac.co.uk/
Meetup: https://www.meetup.com/londoniac

What are Linux Containers:

Linux containers, in short, contain applications in a way that keep them isolated from the host system that they run on. Containers allow a developer to package up an application with all of the parts it needs, such as libraries and other dependencies, and ship it all out as one package. And they are designed to make it easier to provide a consistent experience as developers and system administrators move code from development environments into production in a fast and replicable way.

Use this link to install Docker on Ubuntu 20:

I'll walk through the install in the video. Here's the link: https://docs.docker.com/engine/install/ubuntu/

Check docker is running:

Install AWX-operator on Ubuntu 20 using Minikube

I’ve had a few requests for this demo as It seems like a lot of people are having issues setting up the new version of AWX. Before v18, (v17) you could simply install AWX on a server with enough resources. Now, the preferred way to install AWX is via the AWX-operator. So you need a Kubernetes or OpenShift cluster. For this demo, I’m using Minikube.

Subscribe To Me On YouTube: https://bit.ly/lon_sub

(if you get any errors, check the bottom of this page for the fix)

I’m using minikube because it’s a single node cluster and it keeps the price down. I did try this on a t2.medium, but there just weren’t enough resources to get it working.

This demo will cover the following:

@dmccuk
dmccuk / Ansible_Assert.txt
Last active July 5, 2023 07:49
Prove ansible did what is said it did!
-- Ansible testing using Assert
When we run Ansible to manage server configurations, we assume (if there is no red errors) that it worked. But if you are developing ansible modules for your systems, and want to take the DevOps approach and work on CICD pipelines, you need to have some tests in there to prove that what you asked ansible to do has actually worked.
One of the best ways to do this within ansible, is to use the Assert module. It asserts that a given expression is true. When you combine this with the output of a command that’s registered to a variable, there is almost no limit to what you can test.
I’m going to use the TDD (Test driven development) method where we create the tests before we start writing any ansible code to manage our systems. I expect the tests to fail. Then we’ll write ansible to pass the tests. That’s it.
This demo will cover the following:
• Create some tests using the command and assert modules.