Browse Source

Update teamcity server config for buildagents.

This adds the agent's SSH key to dmdirc-artifacts (used for deploying
reports) and updates the .htaccess file for access to private resources.
master
Chris Smith 10 years ago
parent
commit
ac08cd300a
2 changed files with 23 additions and 0 deletions
  1. 1
    0
      .gitignore
  2. 22
    0
      playbooks/dmdirc-buildagent.yml

+ 1
- 0
.gitignore View File

@@ -0,0 +1 @@
1
+/data/auto

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

@@ -8,6 +8,9 @@
8 8
     home_dir: /home/{{ teamcity_user }}/
9 9
     agent_sh: "{{ home_dir }}/bin/agent.sh"
10 10
     conf: "{{ home_dir }}/conf/buildAgent.properties"
11
+    temp_key: /etc/ansible/data/auto/keys/teamcity-{{ ansible_hostname }}
12
+    htaccess: /home/dmdirc/www/private/.htaccess
13
+    header: "# {{ inventory_hostname }}"
11 14
 
12 15
   tasks:
13 16
 
@@ -50,3 +53,22 @@
50 53
     sudo_user: "{{ teamcity_user }}"
51 54
     lineinfile: dest={{ home_dir }}/.ssh/known_hosts regexp=^dmdirc.com
52 55
                   line="dmdirc.com,85.234.138.10 {{ hostvars['renji.org.uk']['ssh_public_key'] }}"
56
+
57
+  - name: retrieve public key
58
+    sudo_user: "{{ teamcity_user }}"
59
+    fetch: src={{ home_dir }}/.ssh/id_rsa.pub dest={{ temp_key }} flat=yes
60
+
61
+  - name: add SSH key to dmdirc-artifacts
62
+    delegate_to: renji.org.uk
63
+    authorized_key: key="{{ lookup('file', temp_key) }}" user=dmdirc-artifacts
64
+
65
+  - name: add header to private .htaccess file
66
+    delegate_to: renji.org.uk
67
+    sudo_user: dmdirc
68
+    lineinfile: dest={{ htaccess }} line="{{ header }}" insertafter="^# Build agents:"
69
+
70
+  - name: add all IP addresses to .htaccess file
71
+    delegate_to: renji.org.uk
72
+    sudo_user: dmdirc
73
+    lineinfile: dest={{ htaccess }} line="Allow from {{ item }}" insertafter="{{ header }}"
74
+    with_items: ansible_all_ipv4_addresses

Loading…
Cancel
Save