summaryrefslogtreecommitdiff
path: root/ansible
diff options
context:
space:
mode:
Diffstat (limited to 'ansible')
-rw-r--r--ansible/hosts2
-rw-r--r--ansible/minipc-router.yml9
-rw-r--r--ansible/roles/lan1-dhcp-client/files/lan1-dhcp2
-rw-r--r--ansible/roles/lan1-dhcp-client/tasks/main.yml7
-rw-r--r--ansible/roles/sane-debian-system/tasks/main.yml63
-rw-r--r--ansible/roles/sane-debian-system/templates/sources.list.j21
-rwxr-xr-xansible/run-playbook16
7 files changed, 100 insertions, 0 deletions
diff --git a/ansible/hosts b/ansible/hosts
new file mode 100644
index 0000000..6ce6bac
--- /dev/null
+++ b/ansible/hosts
@@ -0,0 +1,2 @@
+[router]
+10.0.0.4
diff --git a/ansible/minipc-router.yml b/ansible/minipc-router.yml
new file mode 100644
index 0000000..9f1308e
--- /dev/null
+++ b/ansible/minipc-router.yml
@@ -0,0 +1,9 @@
+- hosts: router
+ remote_user: ansible
+ become: yes
+ vars:
+ debian_mirror: http://ftp.fi.debian.org/debian
+ hostname: router
+ distro: jessie
+ roles:
+ - lan1-dhcp-client
diff --git a/ansible/roles/lan1-dhcp-client/files/lan1-dhcp b/ansible/roles/lan1-dhcp-client/files/lan1-dhcp
new file mode 100644
index 0000000..81922ce
--- /dev/null
+++ b/ansible/roles/lan1-dhcp-client/files/lan1-dhcp
@@ -0,0 +1,2 @@
+auto eth0
+iface eth0 inet dhcp
diff --git a/ansible/roles/lan1-dhcp-client/tasks/main.yml b/ansible/roles/lan1-dhcp-client/tasks/main.yml
new file mode 100644
index 0000000..fb5d06e
--- /dev/null
+++ b/ansible/roles/lan1-dhcp-client/tasks/main.yml
@@ -0,0 +1,7 @@
+- name: "configure LAN1 (eth0) to be a DHCP client"
+ copy:
+ src: lan1-dhcp
+ dest: /etc/network/interfaces.d/lan1-dhcp
+
+- name: bring up LAN1 (eth0)
+ shell: ifup eth0
diff --git a/ansible/roles/sane-debian-system/tasks/main.yml b/ansible/roles/sane-debian-system/tasks/main.yml
new file mode 100644
index 0000000..187539c
--- /dev/null
+++ b/ansible/roles/sane-debian-system/tasks/main.yml
@@ -0,0 +1,63 @@
+# Set hostname.
+
+- name: set hostname
+ hostname: name={{ hostname }}
+
+- name: add hostname to /etc/hosts
+ lineinfile:
+ dest: /etc/hosts
+ regexp: '^127\.0\.0\.1'
+ line: "127.0.0.1 localhost {{ hostname }}"
+ owner: root
+ group: root
+ mode: 0644
+
+# Configure the main sources.list using a Jinja2 template, because
+# there's a whole bunch of repos and there's some conditional repos
+# involved.
+
+- name: configure main sources.list
+ template:
+ src: sources.list.j2
+ dest: /etc/apt/sources.list
+
+# Update lists, upgrade packages.
+
+- name: update apt package lists
+ apt:
+ update_cache: yes
+ cache_valid_time: 0
+
+- name: upgrade packages
+ apt:
+ upgrade: dist
+
+- name: free up disk space by removing apt package cache
+ shell: |
+ apt"-get" clean
+
+# Install/configure packages that are always needed.
+
+- name: install acpi-support-base
+ apt: name=acpi-support-base
+
+- name: install ntp
+ apt: name=ntp
+
+- name: install locales
+ apt: name=locales
+
+- name: create en_GB.UTF-8 locale
+ locale_gen: state=present name=en_GB.UTF-8
+
+- name: create fi_FI.UTF-8 locale
+ locale_gen: state=present name=fi_FI.UTF-8
+
+# Get rid of bash-completion. It tends to irritate me more than it is
+# ever helpful.
+
+- name: REMOVE bash-completion
+ apt:
+ name: bash-completion
+ state: absent
+ purge: yes
diff --git a/ansible/roles/sane-debian-system/templates/sources.list.j2 b/ansible/roles/sane-debian-system/templates/sources.list.j2
new file mode 100644
index 0000000..841bfd3
--- /dev/null
+++ b/ansible/roles/sane-debian-system/templates/sources.list.j2
@@ -0,0 +1 @@
+deb {{ debian_mirror }} {{ distro }} main non-free contrib
diff --git a/ansible/run-playbook b/ansible/run-playbook
new file mode 100755
index 0000000..c796862
--- /dev/null
+++ b/ansible/run-playbook
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+set -eu
+
+abspath()
+{
+ (cd "$1" && pwd)
+}
+
+srcdir()
+{
+ abspath "$(dirname "$0")"
+}
+
+export PASSWORD_STORE_DIR="$(srcdir)"/secrets
+ansible-playbook -i hosts "$@"