Cleaned up some more wordpress issues

This commit is contained in:
Mike Conrad
2025-02-19 19:10:33 -05:00
parent 1fa31b4ace
commit 2ba204da15
14 changed files with 90 additions and 110 deletions

View File

@ -18,13 +18,13 @@ title: Automating CI/CD with TeamCity and Ansible
In part one of this series we are going to explore a CI/CD option you may not be familiar with but should definitely be on your radar. I used Jetbrains TeamCity for several months at my last company and really enjoyed my time with it. A couple of the things I like most about it are:
- Ability to declare global variables and have them be passed down to all projects
- Ability to declare variables that are made up of other variables
I like to use private or self hosted Docker registries for a lot of my projects and one of the pain points I have had with some other solutions (well mostly Bitbucket) is that they dont integrate well with these private registries and when I run into a situation where I am pushing an image to or pulling an image from a private registry it gets a little messy. TeamCity is nice in that I can add a connection to my private registry in my root project and them simply add that as a build feature to any projects that may need it. Essentially, now I only have one place where I have to keep those credentials and manage that connection.
Another reason I love it is the fact that you can create really powerful build templates that you can reuse. This became very powerful when we were trying to standardize our build processes. For example, most of the apps we build are `.NET` backends and `React` frontends. We built docker images for every project and pushed them to our private registry. TeamCity gave us the ability to standardize the naming convention and really streamline the build process. Enough about that though, the rest of this series will assume that you are using TeamCity. This post will focus on getting up and running using Ansible.
---
## Installation and Setup
@ -34,14 +34,14 @@ For this I will assume that you already have Ansible on your machine and that yo
To get started go ahead and create a new directory to hold our configuration:
```
```shell
mkdir ~/projects/teamcity-configuration-ansible
touch install-teamcity-server.yml
```
Now open up `install-teamcity-server.yml` and add a task to install Java 17 as it is a prerequisite. You will need sudo for this task. \*\*\*As of this writing TeamCity does not support Java 18 or 19. If you try to install one of these you will get an error when trying to start TeamCity.
```
```yaml
---
- name: Install Teamcity
hosts: localhost
@ -66,7 +66,7 @@ Now open up `install-teamcity-server.yml` and add a task to install Java 17 as i
The next step is to create a dedicated user account. Add the following task to `install-teamcity-server.yml`
```
```yaml
- name: Add Teamcity User
ansible.builtin.user:
name: teamcity
@ -74,7 +74,7 @@ The next step is to create a dedicated user account. Add the following task to `
Next we will need to download the latest version of TeamCity. 2023.11.4 is the latest as of this writing. Add the following task to your `install-teamcity-server.yml`
```
```yaml
- name: Download TeamCity Server
ansible.builtin.get_url:
url: https://download.jetbrains.com/teamcity/TeamCity-{{teamcity.version}}.tar.gz
@ -85,7 +85,7 @@ Next we will need to download the latest version of TeamCity. 2023.11.4 is the l
Now to install TeamCity Server add the following:
```
```yaml
- name: Install TeamCity Server
ansible.builtin.shell: |
tar xfz /opt/TeamCity-{{teamcity.version}}.tar.gz
@ -96,7 +96,7 @@ Now to install TeamCity Server add the following:
Now that we have everything set up and installed we want to make sure that our new `teamcity` user has access to everything they need to get up and running. We will add the following lines:
```
```yaml
- name: Update permissions
ansible.builtin.shell: chown -R teamcity:teamcity /opt/TeamCity
```
@ -109,7 +109,7 @@ This gives us a pretty nice setup. We have TeamCity server installed with a dedi
Go ahead and create a new templates folder with the following `teamcity.service.j2` file
```
```shell
[Unit]
Description=JetBrains TeamCity
Requires=network.target
@ -127,7 +127,7 @@ WantedBy=multi-user.target
Your project should now look like the following:
```
```shell
$: ~/projects/teamcity-ansible-terraform
.
├── install-teamcity-server.yml
@ -139,7 +139,7 @@ $: ~/projects/teamcity-ansible-terraform
Thats it! Now you should have a fully automated installed of TeamCity Server ready to be deployed wherever you need it. Here is the final playbook file, also you can find the most up to date version in my [repo](https://git.hackanooga.com/mikeconrad/teamcity-ansible-scripts.git):
```
```yaml
---
- name: Install Teamcity
hosts: localhost