From 943825bf7560637312cbd60be6a3adf60183cc43 Mon Sep 17 00:00:00 2001 From: Alpha Chen Date: Sun, 22 Jan 2017 16:22:24 -0800 Subject: [PATCH] [meta] server setup, mostly vnc --- ansible/roles/server/files/znc/znc.service | 9 ++++++++ ansible/roles/server/tasks/main.yml | 23 +++++++++++++++++++++ ansible/roles/server/tasks/znc.yml | 24 ++++++++++++++++++++++ ansible/server.yml | 24 +++------------------- 4 files changed, 59 insertions(+), 21 deletions(-) create mode 100644 ansible/roles/server/files/znc/znc.service create mode 100644 ansible/roles/server/tasks/main.yml create mode 100644 ansible/roles/server/tasks/znc.yml diff --git a/ansible/roles/server/files/znc/znc.service b/ansible/roles/server/files/znc/znc.service new file mode 100644 index 0000000..7efbddf --- /dev/null +++ b/ansible/roles/server/files/znc/znc.service @@ -0,0 +1,9 @@ +[Unit] +Description=ZNC, an advanced IRC bouncer +After=network-online.target + +[Service] +ExecStart=/usr/bin/znc -f + +[Install] +WantedBy=multi-user.target diff --git a/ansible/roles/server/tasks/main.yml b/ansible/roles/server/tasks/main.yml new file mode 100644 index 0000000..86e9014 --- /dev/null +++ b/ansible/roles/server/tasks/main.yml @@ -0,0 +1,23 @@ +- authorized_key: + user: alpha + state: present + key: "{{ lookup('file', '~/.ssh/pressure_drop_rsa.pub') }}" + +- name: apt update cache + apt: update_cache=yes + become: true +- name: apt upgrade dist + apt: upgrade=dist + become: true +- name: install/upgrade packages + apt: name={{ item }} state=present + become: true + with_items: + - libpam-systemd + - vim + +- file: + path: ~/.config/systemd/user + state: directory + +- include: znc.yml diff --git a/ansible/roles/server/tasks/znc.yml b/ansible/roles/server/tasks/znc.yml new file mode 100644 index 0000000..11506a9 --- /dev/null +++ b/ansible/roles/server/tasks/znc.yml @@ -0,0 +1,24 @@ +- name: install/upgrade znc + apt: name=znc state=latest + become: true + +- name: znc config + copy: + src: znc/{{ item }} + dest: ~/.znc/{{ item | splitext | first }} + with_items: + - configs/znc.conf.private + - znc.pem.private + +- name: znc systemd + copy: + src: znc/znc.service + dest: ~/.config/systemd/user/znc.service + +- name: restart znc + systemd: + name: znc + daemon_reload: yes + enabled: yes + state: restarted + user: yes diff --git a/ansible/server.yml b/ansible/server.yml index de3d892..fe5b8d2 100644 --- a/ansible/server.yml +++ b/ansible/server.yml @@ -1,22 +1,4 @@ --- -- name: Setup SSH key - hosts: servers - tasks: - - authorized_key: - user: alpha - state: present - key: "{{ lookup('file', '~/.ssh/pressure_drop_rsa.pub') }}" - -- name: Update apt - hosts: servers - tasks: - - apt: update_cache=yes - become: true - - apt: upgrade=dist - become: true - -- name: Setup ZNC - hosts: servers - tasks: - - apt: name=znc state=present - become: true +- hosts: servers + roles: + - role: server