Browse Source

Add playbook and support vars for build agent setup.

The playbook creates the relevant user, deploys the teamcity
agent, and configures it appropriately for DMDirc.
master
Chris Smith 10 years ago
parent
commit
abe4db1a0c
3 changed files with 56 additions and 0 deletions
  1. 2
    0
      host_vars/grok.dmdirc.com
  2. 2
    0
      host_vars/renji.org.uk
  3. 52
    0
      playbooks/dmdirc-buildagent.yml

+ 2
- 0
host_vars/grok.dmdirc.com View File

@@ -0,0 +1,2 @@
1
+---
2
+teamcity_user: teamcity

+ 2
- 0
host_vars/renji.org.uk View File

@@ -0,0 +1,2 @@
1
+---
2
+  ssh_public_key: ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAtSbH/1t2YYJ6F3vVmpZ/N7FfHd3QtCZfUm8P3BFAgC5w5eL0SOtbY0sJyzhT6k790+XeySea/DcJ/9QP+2NLw28BKAcUKnalVdIG7EgZb2G1Pz8/OELcH/wUodl6TQoDetPyt3178G8+mSTDFbhFbD5j5izMYXzQj1YnQiGnUzDT5794NR2PhMAH0f2dR9NZqHFLu8kVf/kMpmN25bkiayQXlFwBiJanHYm9FT4eHTjTpY2UYX8XpfmhMDDah26gQtVoUHK51G5Jn/rRA2WKo1vjKGCcEkNK6aPYfmjN4+mt28PZf/DJue//NqjRiG9FeDT3VNN7L8zaUesEw4QvxQ==

+ 52
- 0
playbooks/dmdirc-buildagent.yml View File

@@ -0,0 +1,52 @@
1
+---
2
+# Sets up accounts for DMDirc build agents
3
+
4
+- hosts: dmdirc-buildagents
5
+  user: root
6
+
7
+  vars:
8
+    home_dir: /home/{{ teamcity_user }}/
9
+    agent_sh: "{{ home_dir }}/bin/agent.sh"
10
+    conf: "{{ home_dir }}/conf/buildAgent.properties"
11
+
12
+  tasks:
13
+
14
+  - name: create teamcity user
15
+    user: name={{ teamcity_user }} generate_ssh_key=yes
16
+
17
+  - name: install pre-requisites
18
+    apt: pkg={{ item }}
19
+    with_items:
20
+      - ant
21
+      - git
22
+      - unzip
23
+      - openjdk-7-jdk
24
+
25
+  - name: fetch agent zip
26
+    sudo_user: "{{ teamcity_user }}"
27
+    get_url: url=http://teamcity.dmdirc.com/update/buildAgent.zip dest={{ home_dir }}
28
+
29
+  - name: unpack agent zip
30
+    sudo_user: "{{ teamcity_user }}"
31
+    command: creates={{ agent_sh }} chdir={{ home_dir }} unzip -o buildAgent.zip
32
+
33
+  - name: make agent.sh executable
34
+    sudo_user: "{{ teamcity_user }}"
35
+    file: path={{ agent_sh }} mode=0755
36
+
37
+  - name: copy default configuration
38
+    sudo_user: "{{ teamcity_user }}"
39
+    command: creates={{ conf }} chdir={{ home_dir }}/conf cp buildAgent.dist.properties buildAgent.properties
40
+
41
+  - name: set teamcity server URL
42
+    sudo_user: "{{ teamcity_user }}"
43
+    lineinfile: dest={{ conf }} regexp=^serverUrl= line=serverUrl=http://teamcity.dmdirc.com/
44
+
45
+  - name: set build agent name
46
+    sudo_user: "{{ teamcity_user }}"
47
+    lineinfile: dest={{ conf }} regexp=^name= line=name={{ inventory_hostname }}
48
+
49
+  - name: add dmdirc.com to known hosts
50
+    sudo_user: "{{ teamcity_user }}"
51
+    lineinfile: dest={{ home_dir }}/.ssh/known_hosts regexp=^dmdirc.com
52
+                  line="dmdirc.com,85.234.138.10 {{ hostvars['renji.org.uk']['ssh_public_key'] }}"

Loading…
Cancel
Save