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 ara_api.yaml
- name: Get playbooks
# This doesn't actually need to be specified, the module can pick it up from the callback config
# api_server:
action: get
endpoint: /api/v1/playbooks
status: failed
register: failed_playbooks
dmsimard / mitigate-meltdown.yml
Created Jan 9, 2018 — forked from mnaser/mitigate-meltdown.yml
Ansible playbook for Meltdown mitigation (KPI for CentOS/RHEL 7)
View mitigate-meltdown.yml
- hosts: all
gather_facts: false
- name: ensure ipmi tools are installed
name: ipmitool
- name: retrieve ipmitool address
shell: >
ipmitool lan print | grep '^IP Addr' | grep -v Source | cut -d':' -f2 | xargs
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"' /etc/sysconfig/docker
# Fix shenanigans between subscription-manager-rhsm-certificates and python-rhsm-certificates:
# -
# -
# -
# -
mysql -e "CREATE DATABASE ara;"
mysql -e "CREATE USER ara@localhost IDENTIFIED BY 'password';"
mysql -e "GRANT ALL PRIVILEGES ON ara.* TO ara@localhost;"
yum -y install mariadb-server
systemctl enable --now mariadb-server
systemctl enable --now mariadb
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
You can’t perform that action at this time.