summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--roles/deployer/files/deployer.service13
-rw-r--r--roles/deployer/files/ssh_config5
-rw-r--r--roles/deployer/files/token.pub1
-rw-r--r--roles/deployer/tasks/main.yml85
4 files changed, 104 insertions, 0 deletions
diff --git a/roles/deployer/files/deployer.service b/roles/deployer/files/deployer.service
new file mode 100644
index 0000000..56ea4ef
--- /dev/null
+++ b/roles/deployer/files/deployer.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Deployer
+After=network.target
+
+[Service]
+Type=simple
+User=_wmf
+Group=_wmf
+ExecStart=/srv/wmf-ci-arch/api.py deployer /etc/wmf_ci_token.pub /etc/wmf_artifact_download_token testuser@wmf2-testenv.vm.liw.fi:/srv/http
+KillSignal=QUIT
+
+[Install]
+WantedBy=multi-user.target
diff --git a/roles/deployer/files/ssh_config b/roles/deployer/files/ssh_config
new file mode 100644
index 0000000..2814fdc
--- /dev/null
+++ b/roles/deployer/files/ssh_config
@@ -0,0 +1,5 @@
+Host *
+ UserKnownHostsFile /dev/null
+ StrictHostKeyChecking no
+ PasswordAuthentication no
+ IdentityFile ~/.ssh/deployer
diff --git a/roles/deployer/files/token.pub b/roles/deployer/files/token.pub
new file mode 100644
index 0000000..7d2603b
--- /dev/null
+++ b/roles/deployer/files/token.pub
@@ -0,0 +1 @@
+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCesmXDo5ZG0/IbwTknMad4mOurX05PSW5cy9fk/KOO/2JbIicV1L5SS5NCXrwyrItXxaeXsYVugKO5z11Ont3Y3AG76NeyJHxqDLs1JjVWlLd9/KSaCI7jdCzC/bV3OOGjhMp4ZRmf6zrQrIZ9nCs2HTZ+3lIq2I03BLL+6KqY929wb7YlmNTsaW/RaKE4l0X5YzyxJfR8CN2exlXKMPCvOjQQtWvLGi68QZVbnkwpEfQbw2DeQJAeOo0QcrxLiA34hsf95SaeRTKY69Cv0wLmnjHQixIMaBvmW7CcKEvQ3D5oOG9XFcY3wbKJ8LyM7aq+FWXfswSAQpaTE8w3uMzdg0hypo+pqsiieftvBSY5IgoETtPaJGey8BIAYhCjP+Rwd6kX2vOiJHSdrf/5uK0OUlqZrSDoQnnUIZZpx63/VBVaQ4pAoqGvVhQr9svN9NojfJJ1zCUWicHOCXUEUxzQ2DFpraidxNnrjapEjTijM/GVbc28rVfZwuX9tdwrWM2UHOjeISiSJCs07P5hyfbWTh9vCbO3ffhQWhYA711budh7ZqxC3C4MaraTOMsp11LHu4eLxUvuw0OcLawX6bWy8SnXv/BdGKE6lO1hI3RZ+inVaRKIy8WagvmSvip3eK88dEHEgIoOsbmnDEytUpoDhoNpAH08lx1MIaYxtTm07w== \ No newline at end of file
diff --git a/roles/deployer/tasks/main.yml b/roles/deployer/tasks/main.yml
new file mode 100644
index 0000000..79492f3
--- /dev/null
+++ b/roles/deployer/tasks/main.yml
@@ -0,0 +1,85 @@
+- name: "install deployer dependencies and useful tools"
+ apt:
+ name:
+ - screen
+ - git
+ - haproxy
+ - psmisc
+ - python3
+ - python3-bottle
+ - python3-jwt
+ - python3-crypto
+ state: present
+
+- name: "install deployer source"
+ git:
+ repo: git://git.liw.fi/wmf-ci-arch
+ dest: /srv/wmf-ci-arch
+
+- name: "create user for deployer"
+ user:
+ name: _wmf
+ comment: "WMF CI"
+
+- name: "install key for checking incoming access tokens"
+ copy:
+ src: token.pub
+ dest: /etc/wmf_ci_token.pub
+ owner: root
+ group: root
+ mode: '0644'
+
+- name: "create ~_wmf/.ssh"
+ file:
+ state: directory
+ dest: /home/_wmf/.ssh
+ owner: _wmf
+ group: _wmf
+ mode: '0700'
+
+- name: "install SSH public key for _wmf"
+ copy:
+ content: |
+ {{ deployer_ssh_pub }}
+ dest: /home/_wmf/.ssh/deployer.pub
+ owner: _wmf
+ group: _wmf
+ mode: '0644'
+
+- name: "install SSH private key for _wmf"
+ copy:
+ content: |
+ {{ deployer_ssh }}
+ dest: /home/_wmf/.ssh/deployer
+ owner: _wmf
+ group: _wmf
+ mode: '0600'
+
+# FIXME: This is clearly not OK for production.
+- name: "configure ssh to not check for new host keys"
+ copy:
+ src: ssh_config
+ dest: /home/_wmf/.ssh/config
+ owner: _wmf
+ group: _wmf
+ mode: '0644'
+
+- name: "install API access token for artifact store"
+ copy:
+ content: "{{ artifact_download_token }}"
+ dest: /etc/wmf_artifact_download_token
+ owner: _wmf
+ group: _wmf
+ mode: '0600'
+
+- name: "install deployer.service"
+ copy:
+ src: deployer.service
+ dest: /lib/systemd/system/deployer.service
+
+- name: "enable and (re)start deployer"
+ systemd:
+ name: deployer.service
+ daemon_reload: yes
+ enabled: yes
+ state: restarted