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 aplaybook.yml
# Pseudocode
- name: Return job status to Github
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) }}"
View playbook.yml
- name: first play
hosts: localhost
- debug:
msg: foo
- name: second play
hosts: localhost
- debug:
View .yaml
- name: Start a new AWS with ansible enabled
hosts: workers
become: true
become_method: sudo
root_password: vptbemsq$
- name: create sudo user
password: "{{ root_password }}"
- name: create ansadmin
View ansible.cfg
# 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:
yum -y install mariadb-server
systemctl enable --now mariadb
mysql -e "CREATE DATABASE ara;"
mysql -e "CREATE USER ara@localhost IDENTIFIED BY 'password';"
mysql -e "GRANT ALL PRIVILEGES ON ara.* TO ara@localhost;"
virtualenv ara
. ara/bin/activate
pip install ara
dmsimard / lookup.yml
Last active Aug 20, 2018
Example of ARA lookup
View lookup.yml
- name: Do something if there are 25 changed tasks across the entire playbook
async: 45
poll: 5
msg: do something
# My brain can't memorize how to write jinja conditions properly, please accept pseudocode
# The "ara" var would probably be automatically populated and kept up to date by the callback.
# "ara.playbook" would be a variable referencing the current playbook id running in ARA
# Not sure what's the simplest way of querying ARA yet.
when: {{ lookup('ara', playbook=ara.playbook, status='changed') }} > 25
#!/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
# Unless required by applicable law or agreed to in writing, software
# Copyright (c) 2018 Red Hat, Inc.
# This file is part of ARA Records Ansible.
# ARA 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.
# ARA is distributed in the hope that it will be useful,
View 00-pre.txt
# pip install logging_tree
from logging_tree import printout
dmsimard / output.txt
Created Jun 22, 2018
View output.txt
# bash 2.5.5
New python executable in /tmp/venv/bin/python
Installing setuptools, pip, wheel...done.
Installing ansible==2.5.5...
Running playbook without ARA...
[WARNING]: Unable to parse /etc/ansible/hosts as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
You can’t perform that action at this time.