Skip to content

Instantly share code, notes, and snippets.

David Moreau Simard dmsimard

Block or report user

Report or block dmsimard

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
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
View ansible-tests-with-ara.patch
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 ++++++++++++
View github-org-transfer.py
#!/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
View ara_playbook_label.yaml
# 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
View ara_api.yaml
- 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
View tower-on-openshift.sh
#!/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
View ara-mysql.sh
mysql -e "CREATE DATABASE ara;"
mysql -e "CREATE USER ara@localhost IDENTIFIED BY 'password';"
mysql -e "GRANT ALL PRIVILEGES ON ara.* TO ara@localhost;"
mysql -e "FLUSH PRIVILEGES;"
yum -y install mariadb-server
systemctl enable --now mariadb-server
systemctl enable --now mariadb
View aplaybook.yml
# Pseudocode
- name: Return job status to Github
github_comment:
org: "{{ org }}" # openstack-infra
repo: "{{ repo }}" # zuul
pr: "{{ pr }}" # 1234
# Maybe jobs could supply their own comments or comment templates
comment: "{{ comment_defined_by_the_job | default('default_job_comment.j2') }}"
# +1, -2, etc
vote: "{{ vote | default(0) }}"
You can’t perform that action at this time.