Skip to content

Instantly share code, notes, and snippets.

View dmsimard's full-sized avatar

David Moreau Simard dmsimard

View GitHub Profile
%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 September 9, 2019 14:06
http client test
#!/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")))
@dmsimard
dmsimard / reauth.py
Created August 20, 2019 16:37
reauth
import json
import re
from urllib import parse as urlparse
import requests
def _image_tag_from_url(image_url):
if '@' in image_url.path:
0001-run-tests-with-ara.patch
[root@bastion ansible]# cat 0001-run-tests-with-ara.patch
From af24cfe08bc33a2a63fd2ccc6736f35fd22cdc59 Mon Sep 17 00:00:00 2001
From: root <root@bastion.novalocal>
Date: Fri, 31 May 2019 12:39:49 +0000
Subject: [PATCH] run tests with ara
---
test/integration/integration.cfg | 5 +++++
test/integration/targets/ping/tasks/main.yml | 12 ++++++++++++
@dmsimard
dmsimard / playbook.yml
Last active May 30, 2019 12:54
Fix disk layout
---
- hosts: all
gather_facts: yes
vars_files:
- devstack_gate_vars.yaml
pre_tasks:
# Note (dmsimard)
# If some swap is already set up, the amount is not 100% accurate
# (ex: 8191MB swap for a 8192MB file)
- name: Configure swap
@dmsimard
dmsimard / requirements.txt
Created April 23, 2019 20:01
Pin ARA to <1.0.0
ara<1.0.0
@dmsimard
dmsimard / github-org-transfer.py
Created March 19, 2019 21:27
github-org-transfer
#!/usr/bin/env python
# Copyright Red Hat, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@dmsimard
dmsimard / ara_playbook_label.yaml
Created January 25, 2019 04:01
ara_playbook_label
# Would create the label if it doesn't exist
# Description is optional but can be provided
# Appends the label to playbook.labels for state.present
# Removes the label from playbook.labels for state.absent
- name: Label this playbook
ara_playbook_label:
name: "{{ item }}"
state: present
loop:
- pre-run
- name: Get playbooks
ara_api:
# This doesn't actually need to be specified, the module can pick it up from the callback config
# https://github.com/openstack/ara-plugins/blob/49ce188ab88a6948db651163b9cd7973117fa2b1/ara/plugins/action/ara_record.py#L143-L153
# api_server: https://api.demo.recordsansible.org
action: get
endpoint: /api/v1/playbooks
filter:
status: failed
register: failed_playbooks
@dmsimard
dmsimard / tower-on-openshift.sh
Created October 24, 2018 21:21
tower-on-openshift
#!/bin/bash
yum -y install centos-release-openshift-origin epel-release
yum -y install wget git net-tools bind-utils iptables-services bridge-utils bash-completion origin-clients docker ansible htop
sed -i '/OPTIONS=.*/c\OPTIONS="--selinux-enabled --insecure-registry 172.30.0.0/16"' /etc/sysconfig/docker
# Fix shenanigans between subscription-manager-rhsm-certificates and python-rhsm-certificates:
# - https://github.com/openshift/openshift-ansible/issues/6222
# - https://github.com/minishift/minishift/issues/2194
# - https://github.com/minishift/minishift-centos-iso/issues/251
# - https://github.com/openshift/os/issues/179