Skip to content

Instantly share code, notes, and snippets.

@rothgar
rothgar / main.yml
Last active September 10, 2024 09:53
Generate /etc/hosts with Ansible
# 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']
@dcode
dcode / gist:95ddfa916ded1c57baa856dc526a290e
Last active July 1, 2016 02:18
Customize gnome-terminal and bash for Solarized Dark
# Set dircolors for bash `ls` friendly for a dark solarized terminal
curl -o ~/.dircolors -L https://raw.github.com/seebi/dircolors-solarized/master/dircolors.ansi-dark
eval `dircolors ~/.dircolors`
# Checkout gnome-terminal solarized config
cd /tmp
git clone https://github.com/Anthony25/gnome-terminal-colors-solarized.git
cd gnome-terminal-colors-solarized
./set_dark.sh
cd /tmp; rm -rf gnome-terminal-colors-solarized