This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
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;" | |
mysql -e "FLUSH PRIVILEGES;" | |
virtualenv ara | |
. ara/bin/activate | |
pip install ara |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Do something if there are 25 changed tasks across the entire playbook | |
async: 45 | |
poll: 5 | |
debug: | |
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pip install logging_tree | |
from logging_tree import printout | |
printout() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# bash test.sh 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' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- hosts: localhost | |
gather_facts: no | |
vars: | |
thing: | |
tasks: | |
- name: Print double quotes | |
debug: | |
msg: "{{ thing | default('empty string') }}" | |
- name: Print empty string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Create many hosts | |
hosts: localhost | |
gather_facts: no | |
tasks: | |
- name: Add one host | |
add_host: | |
ansible_connection: local | |
hostname: "{{ item }}" | |
groups: many | |
with_sequence: start=0 end=1024 format=host%02x |