Skip to content

Instantly share code, notes, and snippets.

View hostmaster's full-sized avatar
🏠
Working from home

Igor Khomyakov hostmaster

🏠
Working from home
  • Russia, Saint Petersburg
View GitHub Profile
@hostmaster
hostmaster / gist:15aea6173dc2df18fc04
Created June 16, 2014 06:14
group_vars/all can also be a directory
# Serge van Ginderachter
# Jun 12
# to ansible-devel
group_vars/all can also be a directory (and so can be any group or host name)
so you could do
group_vars/all/normalstuff.yml
[defaults]
remote_user = vagrant
hostfile = .vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory
private_key_file = ~/.vagrant.d/insecure_private_key
#!/usr/bin/perl
use strict;
use warnings;
# smsonline
use LWP;
use HTTP::Request;
use URI::Escape;
Variables
==========
predefined variables :
- inventory_hostname (fqdn) (normally the same as ansible.fqdn)
- inventory_hostname_short
To know the return codes returned by ansible modules, just use plain ansible -vvv to see them :
ansible -i ~/ansible/arrfab.net/hosts/hosts.cfg -vvv -m copy -a 'src=files/sysinfo dest=/etc/sysinfo' tungstene.arrfab.net
tungstene.arrfab.net | success >> {
"changed": true,
---
- name: pip - install packages
pip: name={{ item.name|default(item) }}
{% if item.version|default('') > '' %}
version={{ item.version }}
{% else %}
state=latest
{% endif %}
with_items:
- MySQL-python
@hostmaster
hostmaster / README.md
Last active August 29, 2015 14:04
Schedule from ansible playbook a maintenance window in http://copperegg.com monitoring service.

Schedule and maintenance outage window in CopperEgg monitoring service.

Variables

copperegg_api_key is required. Your api key is at the bottom of your Settings page.

Usage example

pre_tasks:
 - include: mute.yml
$ ansible-playbook site.yml
PLAY [localhost] **************************************************************
TASK: [debug var=abc] *********************************************************
ok: [localhost] => {
"abc": "{{ abc }}"
}
TASK: [command echo "A B C"] **************************************************
@hostmaster
hostmaster / btsync.service
Last active August 29, 2015 14:07
/storage/.config/system.d/btsync.service
#
# systemctl enable btsync.service
# systemctl start btsync.service
#
# cat /etc/systemd/system/btsync.service
[Unit]
Description=BTSync
Requires=network-online.service
After=network-online.service
@hostmaster
hostmaster / pkg_install.yml
Created October 3, 2014 06:38
Use OS specific package manager. Names of the packages may vary per distro/OS
---
- hosts: all
sudo: True
tasks:
# Load a variable file based on the OS type, or a default if not found.
- include_vars: "{{ item }}"
with_first_found:
- "{{ ansible_distribution }}.yml"
- "{{ ansible_os_family }}.yml"
- "default.yml"
@hostmaster
hostmaster / advancedsettings.xml
Created October 8, 2014 16:05
/storage/.xbmc/userdata/
<advancedsettings>
<tvshowmatching action="append">
<regexp> ([0-9]+)-([0-9]+) ([^\\/]*)$</regexp>
</tvshowmatching>
</advancedsettings>