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