Skip to content

Instantly share code, notes, and snippets.

Avatar

David Moreau Simard dmsimard

View GitHub Profile
View ara-with-awx-poc.sh
#!/bin/bash
# Proof of concept of running playbooks in AWX and recording them in ARA
# From a vanilla CentOS8 image: https://cloud.centos.org/centos/8/x86_64/images/CentOS-8-GenericCloud-8.1.1911-20200113.3.x86_64.qcow2
# Add local bin directory to PATH so we can use things installed with "pip install --user"
export PATH=$PATH:~/.local/bin
dnf -y update
# Install Ansible and Python3
@dmsimard
dmsimard / poc.py
Created Sep 10, 2020
proof of concept: expanding a pull request link into a helpful message
View poc.py
#!/usr/bin/env python3
# TL;DR:
# translates https://github.com/<namespace>/<repo>/pull/<id> to:
# https://api.github.com/repos/<namespace>/<repo>/pulls/<id>
# query the endpoint and return a helpful message back
from urllib.parse import urlparse
import argparse
import requests
import os
View ara_loop.yml
- name: Create many hosts
hosts: localhost
gather_facts: no
tasks:
- name: Add one host
add_host:
ansible_connection: local
hostname: "{{ item }}"
groups: many
with_sequence: start=0 end=1024 format=host%02x
View link-to-playbook-report.yaml
View human_log.py
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
View gist:2737832d077cfc5eff34

The tests

fio full write:

fio --name=writefile --size=100G --filesize=100G --filename=/dev/sdX --bs=1M --nrfiles=1 --direct=1 --sync=0 --randrepeat=0 --rw=write --refill_buffers --end_fsync=1 --iodepth=200 --ioengine=libaio

fio random read:

fio --time_based --name=benchmark --size=100G --runtime=30 --filename=/dev/sdX --ioengine=libaio --randrepeat=0 --iodepth=128 --direct=1 --invalidate=1 --verify=0 --verify_fatal=0 --numjobs=4 --rw=randread --blocksize=4k --group_reporting
View ara-simplified.spec
%global srcname ara
Name: %{srcname}
Version: 1.3.2
Release: 1%{?dist}
Summary: ARA Records Ansible playbooks and makes them easier to understand and troubleshoot
License: GPLv3
URL: https://github.com/ansible-community/ara
Source0: https://pypi.io/packages/source/a/%{srcname}/%{srcname}-%{version}.tar.gz
@dmsimard
dmsimard / test.py
Created Sep 9, 2019
http client test
View test.py
#!/usr/bin/env python3
import json
# Import the client
from ara.clients.http import AraHttpClient
# Instanciate the HTTP client with an endpoint where an API server is listening
client = AraHttpClient(endpoint="https://api.demo.recordsansible.org")
print(json.dumps(client.get("/api/v1/playbooks")))
View reauth.py
import json
import re
from urllib import parse as urlparse
import requests
def _image_tag_from_url(image_url):
if '@' in image_url.path:
@dmsimard
dmsimard / test.py
Created Jun 5, 2019
ara with ansible-runner
View test.py
#!/usr/bin/env python3
# Proof of concept ara with ansible-runner
# Requires https://github.com/ansible/ansible-runner/issues/219#issuecomment-496191227
import ansible_runner
import os
from ara.setup import callback_plugins
PLAYBOOK = """
- name: Test for ansible-runner
You can’t perform that action at this time.