Note: the commands were tested on Postgres 9.5.4
Connect with the user USER_NAME
psql -h REMOTE_SERVER_ADDRESS -U USER_NAMEJon Warbrick, July 2014, V3.2 (for Ansible 1.7)
First one found from of
| ## credit: http://fabian-affolter.ch/blog/the-lineinfile-module-of-ansible/ | |
| --- | |
| - hosts: alpine_install | |
| user: root | |
| tasks: | |
| # - name: create a complete empty file | |
| # command: /usr/bin/touch /test/test.conf | |
| - name: create a new file with lineinfile |
Currently, there is an explosion of tools that aim to manage secrets for automated, cloud native infrastructure management. Daniel Somerfield did some work classifying the various approaches, but (as far as I know) no one has made a recent effort to summarize the various tools.
This is an attempt to give a quick overview of what can be found out there. The list is alphabetical. There will be tools that are missing, and some of the facts might be wrong--I welcome your corrections. For the purpose, I can be reached via @maxvt on Twitter, or just leave me a comment here.
There is a companion feature matrix of various tools. Comments are welcome in the same manner.
| # Idempotent way to build a /etc/hosts file with Ansible using your Ansible hosts inventory for a source. | |
| # Will include all hosts the playbook is run on. | |
| # Inspired from http://xmeblog.blogspot.com/2013/06/ansible-dynamicaly-update-etchosts.html | |
| - name: "Build hosts file" | |
| lineinfile: dest=/etc/hosts regexp='.*{{ item }}$' line="{{ hostvars[item].ansible_default_ipv4.address }} {{item}}" state=present | |
| when: hostvars[item].ansible_default_ipv4.address is defined | |
| with_items: groups['all'] |
| #!/usr/bin/python2 | |
| import serial | |
| import re, sys, signal, os, time, datetime | |
| import RPi.GPIO as GPIO | |
| BITRATE = 9600 | |
| GPIO.setmode(GPIO.BOARD) | |
| GPIO.setup(7, GPIO.OUT) | |
| GPIO.setup(3, GPIO.IN, pull_up_down=GPIO.PUD_UP) |
Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.
open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl
You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html
| # -*- coding: utf-8 -*- | |
| import unicodedata | |
| """ Normalise (normalize) unicode data in Python to remove umlauts, accents etc. """ | |
| data = u'naïve café' | |
| normal = unicodedata.normalize('NFKD', data).encode('ASCII', 'ignore') | |
| print normal | |
| from sqlalchemy.ext.declarative import declarative_base | |
| from sqlalchemy import Integer, Column | |
| from postgresql_json import JSON | |
| Base = declarative_base() | |
| class Document(Base): | |
| id = Column(Integer(), primary_key=True) | |
| data = Column(JSON) | |
| #do whatever other work |