diff --git a/README.md b/README.md index 01a055a..9008a4f 100644 --- a/README.md +++ b/README.md @@ -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 | diff --git a/defaults/main.yml b/defaults/main.yml index 606d12c..f7015a9 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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" diff --git a/tasks/license.yml b/tasks/license.yml new file mode 100644 index 0000000..9fa2fa8 --- /dev/null +++ b/tasks/license.yml @@ -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 }}" diff --git a/tasks/main.yml b/tasks/main.yml index 05da7b4..bd84655 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -4,3 +4,4 @@ when: "teamcity_server_db_type == 'mysql'" - include: teamcity-server.yml - include: install-plugins.yml +- include: license.yml diff --git a/tasks/teamcity-server.yml b/tasks/teamcity-server.yml index d05c9fe..109f770 100644 --- a/tasks/teamcity-server.yml +++ b/tasks/teamcity-server.yml @@ -6,6 +6,7 @@ validate_certs: no timeout: 60 checksum: "sha256:{{ teamcity_server_sha256 }}" + register: _teamcity_package - name: "Add TeamCity service default config" template: @@ -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: @@ -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