Notes from Ansible
List All Hosts in the Inventory File
A quick way to get a list of all the servers Ansible is aware of:
ansible -i hosts all --list-hosts
Execute Arbitrary Commands On Servers
| { | |
| "addonName": "coredns", | |
| "addonVersion": "v1.10.1-eksbuild.7", | |
| "configurationSchema": "{\"$ref\":\"#/definitions/Coredns\",\"$schema\":\"http://json-schema.org/draft-06/schema#\",\"definitions\":{\"Coredns\":{\"additionalProperties\":false,\"properties\":{\"affinity\":{\"default\":{\"affinity\":{\"nodeAffinity\":{\"requiredDuringSchedulingIgnoredDuringExecution\":{\"nodeSelectorTerms\":[{\"matchExpressions\":[{\"key\":\"kubernetes.io/os\",\"operator\":\"In\",\"values\":[\"linux\"]},{\"key\":\"kubernetes.io/arch\",\"operator\":\"In\",\"values\":[\"amd64\",\"arm64\"]}]}]}},\"podAntiAffinity\":{\"preferredDuringSchedulingIgnoredDuringExecution\":[{\"podAffinityTerm\":{\"labelSelector\":{\"matchExpressions\":[{\"key\":\"k8s-app\",\"operator\":\"In\",\"values\":[\"kube-dns\"]}]},\"topologyKey\":\"kubernetes.io/hostname\"},\"weight\":100}]}}},\"description\":\"Affinity of the coredns pods\",\"type\":[\"object\",\"null\"]},\"computeType\":{\"type\":\"string\"},\"corefile\":{\"description\":\"Entire core |
Notes from Ansible
List All Hosts in the Inventory File
A quick way to get a list of all the servers Ansible is aware of:
ansible -i hosts all --list-hosts
Execute Arbitrary Commands On Servers
| #!/usr/bin/env node | |
| var split = require('split'); | |
| var crypto = require('crypto'); | |
| var md5 = require('MD5'); | |
| var Transform = require('stream').Transform; | |
| var util = require('util'); | |
| var fs = require('fs'); | |
| var wstream = fs.createWriteStream('filtered3.tsv'); |
| var Twit = require('Twit'); | |
| var config = { | |
| //my config | |
| }; | |
| var T = new Twit(config); | |
| var filterStream; | |
| function filter() { | |
| filterStream = T.stream('statuses/filter', openStreamOptions); |
| var | |
| Connection = require('../lib/Connection'); | |
| var c = new Connection(); | |
| c.on('connect', function() { | |
| console.log('Connection :: connect'); | |
| }); | |
| c.on('ready', function() { | |
| var promptDataCallCount = 0; | |
| console.log('Connection :: ready'); |
| //TODO |
| 'use strict'; | |
| var EventEmitter = require('events').EventEmitter; | |
| var util = require('util'); | |
| var Bus; | |
| var bus; | |
| Bus = function () { | |
| EventEmitter.call(this); | |
| var self = this; |
| #!/bin/bash | |
| # | |
| # initd-example Node init.d | |
| # | |
| # chkconfig: 345 80 20 | |
| # description: Node init.d example | |
| # processname: node | |
| # pidfile: /var/run/initd-example.pid | |
| # logfile: /var/log/initd-example.log | |
| # |
| #!/bin/sh | |
| # ------------------------------------------------------------------------------ | |
| # SOME INFOS : fairly standard (debian) init script. | |
| # Note that node doesn't create a PID file (hence --make-pidfile) | |
| # has to be run in the background (hence --background) | |
| # and NOT as root (hence --chuid) | |
| # | |
| # MORE INFOS : INIT SCRIPT http://www.debian.org/doc/debian-policy/ch-opersys.html#s-sysvinit | |
| # INIT-INFO RULES http://wiki.debian.org/LSBInitScripts | |
| # INSTALL/REMOVE http://www.debian-administration.org/articles/28 |