Skip to content

Instantly share code, notes, and snippets.

View dmsimard's full-sized avatar

David Moreau Simard dmsimard

View GitHub Profile
@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
@dmsimard
dmsimard / ara-mysql.sh
Created October 15, 2018 23:44
ara-mysql
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
@dmsimard
dmsimard / aplaybook.yml
Last active October 13, 2018 01:47
Zuul actions
# 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) }}"
- name: first play
hosts: localhost
tasks:
- debug:
msg: foo
- name: second play
hosts: localhost
tasks:
- debug:
@dmsimard
dmsimard / .yaml
Last active October 10, 2018 02:25 — forked from joeysk2012/.yaml
- name: Start a new AWS with ansible enabled
hosts: workers
become: true
become_method: sudo
vars:
root_password: vptbemsq$
tasks:
- name: create sudo user
password: "{{ root_password }}"
- name: create ansadmin
[defaults]
...
# I'd like [foo] to be available to both the callback and an action plugin so I don't need to do:
# - name: Run action plugin
# action:
# server: http://api
# do: something
#
# and instead do: