Initial Commit
This commit is contained in:
51
install-teamcity-server.yml
Normal file
51
install-teamcity-server.yml
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
---
|
||||||
|
- name: Install Teamcity
|
||||||
|
hosts: 127.0.0.1
|
||||||
|
become: true
|
||||||
|
become_method: sudo
|
||||||
|
|
||||||
|
vars:
|
||||||
|
java_version: "17"
|
||||||
|
teamcity:
|
||||||
|
installation_path: /opt/TeamCity
|
||||||
|
version: "2023.11.4"
|
||||||
|
installation_file:
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: Install Java
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name: openjdk-{{ java_version }}-jdk # This is important because TeamCity will fail to start if we try to use 18 or 19
|
||||||
|
update_cache: yes
|
||||||
|
state: latest
|
||||||
|
install_recommends: no
|
||||||
|
|
||||||
|
- name: Add TeamCity User
|
||||||
|
ansible.builtin.user:
|
||||||
|
name: teamcity
|
||||||
|
|
||||||
|
- name: Download TeamCity Server
|
||||||
|
ansible.builtin.get_url:
|
||||||
|
url: https://download.jetbrains.com/teamcity/TeamCity-{{teamcity.version}}.tar.gz
|
||||||
|
dest: /opt/TeamCity-{{teamcity.version}}.tar.gz
|
||||||
|
mode: '0770'
|
||||||
|
|
||||||
|
- name: Install TeamCity Server
|
||||||
|
ansible.builtin.shell: |
|
||||||
|
tar xfz /opt/TeamCity-{{teamcity.version}}.tar.gz
|
||||||
|
rm -rf /opt/TeamCity-{{teamcity.version}}.tar.gz
|
||||||
|
args:
|
||||||
|
chdir: /opt
|
||||||
|
|
||||||
|
- name: Update permissions
|
||||||
|
ansible.builtin.shell: chown -R teamcity:teamcity /opt/TeamCity
|
||||||
|
|
||||||
|
- name: TeamCity | Create environment file
|
||||||
|
template: src=teamcity.service.j2 dest=/etc/systemd/system/teamcityserver.service
|
||||||
|
notify:
|
||||||
|
- reload systemctl
|
||||||
|
- name: TeamCity | Start teamcity
|
||||||
|
service: name=teamcityserver.service state=started enabled=yes
|
||||||
|
|
||||||
|
handlers:
|
||||||
|
- name: reload systemctl
|
||||||
|
command: systemctl daemon-reload
|
13
templates/teamcity.service.j2
Normal file
13
templates/teamcity.service.j2
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=JetBrains TeamCity
|
||||||
|
Requires=network.target
|
||||||
|
After=syslog.target network.target
|
||||||
|
[Service]
|
||||||
|
Type=forking
|
||||||
|
ExecStart={{teamcity.installation_path}}/bin/runAll.sh start
|
||||||
|
ExecStop={{teamcity.installation_path}}/bin/runAll.sh stop
|
||||||
|
User=teamcity
|
||||||
|
PIDFile={{teamcity.installation_path}}/teamcity.pid
|
||||||
|
Environment="TEAMCITY_PID_FILE_PATH={{teamcity.installation_path}}/teamcity.pid"
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
Reference in New Issue
Block a user