Skip to content

Commit

Permalink
Merge pull request #7 from matisku/agent-update
Browse files Browse the repository at this point in the history
Updating configuration
  • Loading branch information
matisku authored Feb 24, 2017
2 parents 4cb44d1 + 9c50cd7 commit 2ce4538
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ Feel free to use it along with my TeamCity Server role - [matisku.teamcity-agent
| teamcity_server_dir | `{{ teamcity_server_install_dir }}/TeamCity` | TeamCity install dir |
| teamcity_server_data_dir | `{{ teamcity_server_dir }}/BuildServer` | TeamCity data/conf/plugins dir |
| teamcity_server_plugins_dir | `{{ teamcity_server_data_dir }}/plugins` | TeamCity plugins dir |
| teamcity_server_license_keys | `` | TeamCity Licenses |
| teamcity_server_mysql_server_connector_version | `5.1.40` | MySQL connector version |
| teamcity_server_mysql_connector_dir | `/opt/mysql-connector` | MySQL connector install dir |
| teamcity_server_mysql_server_db_user | `teamcity` | TeamCity MySQL user name |
| teamcity_server_mysql_server_db_password | `teamcity` | TeamCity MySQL user password |
| teamcity_server_mysql_server_db_name | `teamcity` | TeamCity MySQL database |
| teamcity_server_db_type | `local` | Database version: local or mysql |
| teamcity_server_db_type | `local` | Database version: local or mysql |
| teamcity_server_mysql_server_database_url | `localhost` | MySQL database URL |
| teamcity_server_mysql_server_database_port | `3306` | MySQL database port |
| teamcity_server_mysql_server_jdbc_dir | `{{ teamcity_server_data_dir }}/lib/jdbc` | MySQL JDBC driver location |
Expand Down
4 changes: 4 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@ teamcity_server_install_dir: /opt
teamcity_server_dir: "{{ teamcity_server_install_dir }}/TeamCity"
teamcity_server_data_dir: "{{ teamcity_server_dir }}/BuildServer"
teamcity_server_plugins_dir: "{{ teamcity_server_data_dir }}/plugins"
teamcity_server_config_dir: "{{ teamcity_server_data_dir }}/config"

# TeamCity Plugins
teamcity_server_plugins: []

# Teamcity Licenses
teamcity_server_license_keys: []

# MySQL Connector
teamcity_server_mysql_connector_version: 5.1.40
teamcity_server_mysql_connector_dir: "/opt/mysql-connector"
Expand Down
18 changes: 18 additions & 0 deletions tasks/license.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
- name: "Check if config folder exists"
file:
path: "{{ teamcity_server_config_dir }}"
state: directory
owner: "{{ teamcity_server_user }}"
group: "{{ teamcity_server_group }}"
mode: 0755

- name: "Put license keys"
no_log: yes
lineinfile:
dest: "{{ teamcity_server_config_dir }}/license.keys"
line: "{{ item }}"
owner: "{{ teamcity_server_user }}"
group: "{{ teamcity_server_group }}"
create: yes
with_items: "{{ teamcity_server_license_keys }}"
1 change: 1 addition & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
when: "teamcity_server_db_type == 'mysql'"
- include: teamcity-server.yml
- include: install-plugins.yml
- include: license.yml
7 changes: 5 additions & 2 deletions tasks/teamcity-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
validate_certs: no
timeout: 60
checksum: "sha256:{{ teamcity_server_sha256 }}"
register: _teamcity_package

- name: "Add TeamCity service default config"
template:
Expand All @@ -23,11 +24,13 @@
service:
name: teamcity-server
state: stopped
when: _teamcity_package|changed

- name: "Ensure that upgrade will not fail"
file:
path: "{{ teamcity_server_dir }}/webapps"
state: absent
when: _teamcity_package|changed

- name: "Unpack distribution"
unarchive:
Expand All @@ -46,12 +49,12 @@
mode: 0755
with_items:
- "{{ teamcity_server_dir }}/logs"
- "{{ teamcity_server_data_dir }}/config"
- "{{ teamcity_server_config_dir }}"

- name: "Add database config"
template:
src: "database.{{ teamcity_server_db_type }}.properties.j2"
dest: "{{ teamcity_server_data_dir }}/config/database.properties"
dest: "{{ teamcity_server_config_dir }}/database.properties"
owner: "{{ teamcity_server_user }}"
group: "{{ teamcity_server_group }}"
mode: 0644
Expand Down

0 comments on commit 2ce4538

Please sign in to comment.