Browse Source

Initial commit

pull/1/head
Chris Smith 10 years ago
commit
35de28606d

+ 152
- 0
ansible.cfg View File

@@ -0,0 +1,152 @@
1
+# config file for ansible -- http://ansible.com/
2
+# ==============================================
3
+
4
+# nearly all parameters can be overridden in ansible-playbook 
5
+# or with command line flags. ansible will read ANSIBLE_CONFIG,
6
+# ansible.cfg in the current working directory, .ansible.cfg in
7
+# the home directory or /etc/ansible/ansible.cfg, whichever it
8
+# finds first
9
+
10
+[defaults]
11
+
12
+# some basic default values...
13
+
14
+hostfile       = /etc/ansible/hosts
15
+library        = /usr/share/ansible
16
+remote_tmp     = $HOME/.ansible/tmp
17
+pattern        = *
18
+forks          = 5
19
+poll_interval  = 15
20
+sudo_user      = root
21
+#ask_sudo_pass = True
22
+#ask_pass      = True
23
+transport      = smart
24
+remote_port    = 22
25
+
26
+# additional paths to search for roles in, colon seperated
27
+#roles_path    = /etc/ansible/roles
28
+
29
+# uncomment this to disable SSH key host checking
30
+#host_key_checking = False
31
+
32
+# change this for alternative sudo implementations
33
+sudo_exe = sudo
34
+
35
+# what flags to pass to sudo
36
+#sudo_flags = -H
37
+
38
+# SSH timeout
39
+timeout = 10
40
+
41
+# default user to use for playbooks if user is not specified
42
+# (/usr/bin/ansible will use current user as default)
43
+#remote_user = root
44
+
45
+# logging is off by default unless this path is defined
46
+# if so defined, consider logrotate
47
+#log_path = /var/log/ansible.log
48
+
49
+# default module name for /usr/bin/ansible
50
+#module_name = command
51
+
52
+# use this shell for commands executed under sudo
53
+# you may need to change this to bin/bash in rare instances
54
+# if sudo is constrained
55
+#executable = /bin/sh
56
+
57
+# if inventory variables overlap, does the higher precedence one win
58
+# or are hash values merged together?  The default is 'replace' but
59
+# this can also be set to 'merge'.
60
+#hash_behaviour = replace
61
+
62
+# How to handle variable replacement - as of 1.2, Jinja2 variable syntax is
63
+# preferred, but we still support the old $variable replacement too.
64
+# Turn off ${old_style} variables here if you like.
65
+#legacy_playbook_variables = yes
66
+
67
+# list any Jinja2 extensions to enable here:
68
+#jinja2_extensions = jinja2.ext.do,jinja2.ext.i18n
69
+
70
+# if set, always use this private key file for authentication, same as 
71
+# if passing --private-key to ansible or ansible-playbook
72
+#private_key_file = /path/to/file
73
+
74
+# format of string {{ ansible_managed }} available within Jinja2 
75
+# templates indicates to users editing templates files will be replaced.
76
+# replacing {file}, {host} and {uid} and strftime codes with proper values.
77
+ansible_managed = Ansible managed: {file} modified on %Y-%m-%d %H:%M:%S by {uid} on {host}
78
+
79
+# by default, ansible-playbook will display "Skipping [host]" if it determines a task
80
+# should not be run on a host.  Set this to "False" if you don't want to see these "Skipping" 
81
+# messages. NOTE: the task header will still be shown regardless of whether or not the 
82
+# task is skipped.
83
+#display_skipped_hosts = True
84
+
85
+# by default (as of 1.3), Ansible will raise errors when attempting to dereference 
86
+# Jinja2 variables that are not set in templates or action lines. Uncomment this line
87
+# to revert the behavior to pre-1.3.
88
+#error_on_undefined_vars = False
89
+
90
+# set plugin path directories here, seperate with colons
91
+action_plugins     = /usr/share/ansible_plugins/action_plugins
92
+callback_plugins   = /usr/share/ansible_plugins/callback_plugins
93
+connection_plugins = /usr/share/ansible_plugins/connection_plugins
94
+lookup_plugins     = /usr/share/ansible_plugins/lookup_plugins
95
+vars_plugins       = /usr/share/ansible_plugins/vars_plugins
96
+filter_plugins     = /usr/share/ansible_plugins/filter_plugins
97
+
98
+# don't like cows?  that's unfortunate.
99
+# set to 1 if you don't want cowsay support or export ANSIBLE_NOCOWS=1 
100
+#nocows = 1
101
+
102
+# don't like colors either?
103
+# set to 1 if you don't want colors, or export ANSIBLE_NOCOLOR=1
104
+#nocolor = 1
105
+
106
+[paramiko_connection]
107
+
108
+# uncomment this line to cause the paramiko connection plugin to not record new host
109
+# keys encountered.  Increases performance on new host additions.  Setting works independently of the
110
+# host key checking setting above.
111
+#record_host_keys=False
112
+
113
+# by default, Ansible requests a pseudo-terminal for commands executed under sudo. Uncomment this
114
+# line to disable this behaviour.
115
+#pty=False
116
+
117
+[ssh_connection]
118
+
119
+# ssh arguments to use
120
+# Leaving off ControlPersist will result in poor performance, so use 
121
+# paramiko on older platforms rather than removing it
122
+#ssh_args = -o ControlMaster=auto -o ControlPersist=60s
123
+
124
+# The path to use for the ControlPath sockets. This defaults to
125
+# "%(directory)s/ansible-ssh-%%h-%%p-%%r", however on some systems with
126
+# very long hostnames or very long path names (caused by long user names or 
127
+# deeply nested home directories) this can exceed the character limit on
128
+# file socket names (108 characters for most platforms). In that case, you 
129
+# may wish to shorten the string below.
130
+# 
131
+# Example: 
132
+# control_path = %(directory)s/%%h-%%r
133
+#control_path = %(directory)s/ansible-ssh-%%h-%%p-%%r
134
+
135
+# Enabling pipelining reduces the number of SSH operations required to 
136
+# execute a module on the remote server. This can result in a significant 
137
+# performance improvement when enabled, however when using "sudo:" you must 
138
+# first disable 'requiretty' in /etc/sudoers
139
+#
140
+# By default, this option is disabled to preserve compatibility with
141
+# sudoers configurations that have requiretty (the default on many distros).
142
+# 
143
+#pipelining = False
144
+
145
+# if True, make ansible use scp if the connection type is ssh 
146
+# (default is sftp)
147
+#scp_if_ssh = True
148
+
149
+[accelerate]
150
+accelerate_port = 5099
151
+accelerate_timeout = 30
152
+accelerate_connect_timeout = 5.0

+ 17
- 0
data/config/chris-vimrc View File

@@ -0,0 +1,17 @@
1
+syntax on
2
+
3
+set background=dark
4
+
5
+if has("autocmd")
6
+  au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
7
+    \| exe "normal g'\"" | endif
8
+endif
9
+
10
+set showmatch
11
+set ignorecase
12
+set incsearch
13
+
14
+highlight ExtraWhitespace ctermbg=red guibg=red
15
+match ExtraWhitespace /\s\+$/
16
+
17
+au BufNewFile,BufRead *.less set filetype=less

+ 1
- 0
data/keys/chris/active/chromebook View File

@@ -0,0 +1 @@
1
+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDJbPRZ5oqGCxJTn/2WtU5IBXBf6KcH7e82fHOzNnmVVuWGORvhNe+dUER3FyJzwDNzlnG1ik4xcs+yZfeVLMDY2ikBqNb7vDBPASaa7faSHa8u/32WcvWQAQkGLkOh9TqTFigsl69ODA2sDdpzMY+frlJRRsnrq44CUWQNpZb2RtA1l5f7peGEItgt2sIeBk7FtvaoKAij9V6lUoqglRW17LF+PiGVANCPJl2kaS27Cm+hSFknUMKAYnWvKBOcBuVWjcKH5ikrs7w5KVhYxq8w6A1+VfZZEuUfOY2Poj02vLo/xQyPNQetKH1XNEeLavq+nENpyCNrgEkB06Z14LkB chris@chromebook

+ 1
- 0
data/keys/chris/active/home-linux-desktop View File

@@ -0,0 +1 @@
1
+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC0EjgJUjHePLdeGW5/r09qe3b3i6NdPZ+PtQXuwMoLIARa3Dg4CAmfQOZ0Dz9oh32ZTFX/oXBjSy6rmWT8xEDRA0bYtvJYaBi2B8jYRzakL8QTIPRLd+s+R0EIm0KvQMs+fHxyTrJK0Y4+mLhI/wPynGKMJx4HOsXWsnVutfy9IALnmaOyw2AKlcbFSMKWJB86EQSNMhUaWsEnYZzEhAFz727FQj4yO1BFKfwWfl6H0wVO50Yt+bz+xANIhbJSlYzZI5T4V46gxdtSlvmZcgM9JBfdFyLVgoVORqyZnUpyAvf1eP0HelN9bwzTbpA1kzuR41xmC4/r7e4fVxZEBQ5R chris@Quark

+ 1
- 0
data/keys/chris/active/home-windows-desktop View File

@@ -0,0 +1 @@
1
+ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEA3ahIcxEaFUdkUqa3hddgw+hAtcNFyeRbumgRwbOmRygSOFhnrvUf8i6OLVBpdayGzqO+12Apl1g/+KHHKywreuCJuJW5AFlfjX5aTekwGGxaqEyREREIVNiujfQ+Zpze9GDkYicn7CceFRP5PwotI0k8n8OIEdvwsgd93bpqcTntqQqWNGW4bYD7EH4okK3KC0nCPtnA/pUnpR3BzqhKGb9GVunbnoiIsd6twf8+Zif2Ufmx55nK+cLePnrxhARbcbnuhJq6q0aLwm6OOz8+CjLaqVny6rL6edBM0IhihoFznOtuYOxxx35tSBOZW9XNyBRT5dTRQYrD+pt0mUJi7Q== rsa-key-20130918

+ 1
- 0
data/keys/chris/active/windows-laptop View File

@@ -0,0 +1 @@
1
+ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAn51mDhJedm9F/fpwGjJu5gl3WP1fRRUgIBg6Qb2EfBZUzUsfY/ak0cjKUR1H9dgnYdYHdrk7Fms/ZvUvBKsLhs+GVOpEDRSLKbeV7bQ+lyQXVTLmqlsOO6806u5dp5yId9GDZtLYPH8SThfxyocol3TVk00aWe1HuHAD6pNlkxc= Laptop

+ 1
- 0
data/keys/chris/active/work-desktop View File

@@ -0,0 +1 @@
1
+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCyQZjA5sS4X/MaNNvh+03YEbYVGm9lR3pZVSQ/Z2WHGxJq7smQ/0qKiuVdLQFoC+I0Nf6UdVz7fpEkF7gWxRjoy+D7vHPMo0BRAq254i/7rw2FqX7Di5swY6n/NA6vmZiOoMhJPqy4DZgGlS6ry7Jxm0BjthixPr54xcwoJMn4Nbn+8V/6RAc03o5sUsrRsyVYpwjjvtZ0m55ZsiMzYwhuuKig5dNLb7Vdkh9Io9RQYiVUTe3uupI7MaOAZgC5w7+cokeAfAV99C376l/a733u1dWldCzODb59GYG+Lrx+UHBVrHk+nBgyAVZU1F2x45zXGsPa+Fr1F6Fa8k5+TBQV cjs@panem.lon.corp.google.com

+ 1
- 0
data/keys/chris/revoked/home-linux-desktop-old View File

@@ -0,0 +1 @@
1
+ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA7SAkh+r7kOBwkQi39ouHwy+LJuT9DN3wgtd2ZbfLKhi593LPYOizAXh3wu2lxuWouUMCbwPra9In29AEHuvJjp5KsoQu4RFtqVKDEO939VJAYqEakWYsRx6M+Zg7hIrZDymwPsKpDD1exNMQUSEbQu/2A4RFUEM0L2Mo3VrqRcVw/bcY/+J6YoBVibTrnDQtUWQNSB4mi0qoRiZwFb7LH8NGMWiI2KxTDRm3J+HaOQIepSyD1NcL1s7CzdM2rt84E8jUu4NiRE70Yg00+tddAcsiw9k0ZD59D6n7frRiRyLnwVhYmtXMQP2WZEjRZaLRSNG2uhtS4N+S8bVthIC5qw== chris@odo

+ 1
- 0
data/keys/chris/revoked/linux-laptop-old View File

@@ -0,0 +1 @@
1
+ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAxoRSC+VKV9QEla9x+jgSwDfbVtfD/weO2g431KCnwz03vxVzTrDNZrwch5VpSAOJHRRbP6QQGxhFgwi7dqcOQEwMoGD6qbWKqBwKalxZqtCI5UUS/4tkyAgIFR1A9f+OpB5hYqgerua9LAqi/MiluWKi9xttNa/iU8WkUnr4626QnEC7YveWH49ugUfRKt/B9nkyihseoifTKX1X/BawI809J76QEv22S7YXFEByfDfAbfIXaHOP/ffZCFJdKE+fcJ4XgHppxsYcOS+c/svmtWo2KRWzZbgM4sZAEsBTz+9kFjwhB3DAmc3QcYSHYvD6kKBIl8doXLuA60Lb8Y6BEQ== chris@chris-laptop

+ 1
- 0
data/keys/chris/root/home-linux-desktop View File

@@ -0,0 +1 @@
1
+../active/home-linux-desktop

+ 1
- 0
data/keys/chris/root/home-windows-desktop View File

@@ -0,0 +1 @@
1
+../active/home-windows-desktop

+ 1
- 0
data/keys/chris/root/work-desktop View File

@@ -0,0 +1 @@
1
+../active/work-desktop

+ 32
- 0
hosts View File

@@ -0,0 +1,32 @@
1
+# This is the default ansible 'hosts' file.
2
+#
3
+# It should live in /etc/ansible/hosts
4
+#
5
+#   - Comments begin with the '#' character
6
+#   - Blank lines are ignored
7
+#   - Groups of hosts are delimited by [header] elements
8
+#   - You can enter hostnames or ip addresses
9
+#   - A hostname/ip can be a member of multiple groups
10
+
11
+[dmdirc]
12
+grok.dmdirc.com
13
+renji.org.uk
14
+
15
+[dmdirc-buildagents]
16
+grok.dmdirc.com
17
+
18
+[chris-owned]
19
+grok.dmdirc.com
20
+do1.chameth.com
21
+
22
+[digitalocean]
23
+grok.dmdirc.com
24
+do1.chameth.com
25
+
26
+[chris-access:children]
27
+dmdirc
28
+chris-owned
29
+
30
+[chris-root:children]
31
+dmdirc
32
+chris-owned

+ 8
- 0
playbooks/chris-root.yml View File

@@ -0,0 +1,8 @@
1
+---
2
+# Adds SSH keys for root access
3
+
4
+- hosts: chris-root
5
+  user: root
6
+  tasks:
7
+
8
+  - include: includes/ssh-keys user=root type=root key_dir=chris

+ 21
- 0
playbooks/chris-user.yml View File

@@ -0,0 +1,21 @@
1
+---
2
+# Ensures that an appropriate 'Chris' user is created
3
+
4
+- hosts: chris-access
5
+  user: root
6
+  tasks:
7
+
8
+  - name: create chris user
9
+    user: name=chris
10
+
11
+  - include: includes/ssh-keys user=chris key_dir=chris
12
+
13
+  - name: deploy vimrc
14
+    remote_user: chris
15
+    copy: dest=~/.vimrc
16
+          src=/etc/ansible/data/config/chris-vimrc
17
+
18
+  - include: includes/install-fish
19
+
20
+  - name: set default shell to fish
21
+    user: name=chris shell=/usr/bin/fish

+ 11
- 0
playbooks/includes/install-fish View File

@@ -0,0 +1,11 @@
1
+---
2
+# Adds the fish-shell release PPA and installs fish.
3
+
4
+- name: install python-pycurl (needed to add fish PPA)
5
+  apt: pkg=python-pycurl
6
+
7
+- name: add fish PPA
8
+  apt_repository: repo='ppa:fish-shell/release-2' update_cache=yes
9
+
10
+- name: install fish
11
+  apt: pkg=fish

+ 15
- 0
playbooks/includes/ssh-keys View File

@@ -0,0 +1,15 @@
1
+---
2
+# Maintains a set of SSH keys
3
+
4
+- name: add authorized keys
5
+  authorized_key: user={{ user }}
6
+                  key="{{ lookup('file', item) }}"
7
+  with_fileglob:
8
+    - /etc/ansible/data/keys/{{ key_dir }}/{{ type | default(active) }}/*
9
+
10
+- name: revoke old authorized keys
11
+  authorized_key: user={{ user }}
12
+                  key="{{ lookup('file', item) }}"
13
+                  state=absent
14
+  with_fileglob:
15
+    - /etc/ansible/data/keys/{{ key_dir }}/revoked/*

Loading…
Cancel
Save