Skip to content

Commit

Permalink
brew dependent path symlink creation error fix (#26)
Browse files Browse the repository at this point in the history
* brew dependent path symlink creation error fix

* preferred use module "package" instead "yum" in an heterogeneous environment

* defined the path of "brew" as in included role

* Implemented deployment of variable Java version in several operating systems (Debian, Darwin, Windows)
  • Loading branch information
SPR0STO authored May 10, 2024
1 parent a27948c commit 83e8c97
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 7 deletions.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ None.
## Example Playbook

- hosts: all
vars:
homebrew_prefix: '/opt/homebrew'
roles:
- ccdc.teamcity_agent

## Example Playbook with specific java version

- hosts: all
vars:
homebrew_prefix: '/opt/homebrew'
java_version: '18'
roles:
- ccdc.teamcity_agent

Expand All @@ -36,4 +47,4 @@ MIT / BSD

## Author Information

This role was created in 2020 by Claudio Bantaloukas/Florian Piesche, based on existing roles at CCDC, by Jeff Geerling and google searches
This role was created in 2020 by Claudio Bantaloukas/Florian Piesche, based on existing roles at CCDC, by Jeff Geerling and google searches
11 changes: 11 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,14 @@ teamcity_downloaded_buildagent_zip: "{{ teamcity_agent_install_dir }}/teamcity-a
teamcity_buildagent_zip_url: "{{ teamcity_server_url }}/update/buildAgent.zip"
teamcity_buildagent_drive: E
teamcity_agent_hostname: "{{ inventory_hostname }}"

homebrew_prefix: "{{ (ansible_machine == 'arm64') | ternary('/opt/homebrew', '/usr/local') }}"

java_version: '17'
java:
openjdk:
Debian: "openjdk-{{ java_version }}-jdk"
RedHat: "java-{{ java_version }}-openjdk"
FreeBSD: "openjdk{{ java_version }}"
Darwin: "openjdk@{{ java_version }}"
Windows: "microsoft-openjdk{{ java_version }}"
6 changes: 3 additions & 3 deletions tasks/Darwin.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
---
- name: Insatll Homebrew + OpenJDK
- name: Install Homebrew + OpenJDK
ansible.builtin.include_role:
name: geerlingguy.mac.homebrew
vars:
# This is overwritten by our group_vars (cpp.build-machines)
homebrew_installed_packages:
- openjdk@17
- "{{ java.openjdk[ansible_os_family] }}"
when: not cpp_buildmachine

- name: Symlink OpenJDK to system-wide Java VMs
ansible.builtin.file:
state: link
src: /usr/local/opt/openjdk@17/libexec/openjdk.jdk
src: "{{ homebrew_prefix }}/opt/openjdk@17/libexec/openjdk.jdk"
dest: /Library/Java/JavaVirtualMachines/openjdk-17.jdk
become: true

Expand Down
4 changes: 2 additions & 2 deletions tasks/Linux.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
- name: Install Java
ansible.builtin.yum:
name: java-1.8.0-openjdk-devel
ansible.builtin.package:
name: "{{ java.openjdk[ansible_os_family] }}"
state: present
become: true

Expand Down
2 changes: 1 addition & 1 deletion tasks/Windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
win_chocolatey:
name:
- 7zip.install
- microsoft-openjdk17
- "{{ java.openjdk[ansible_os_family] }}"
state: present

- name: Create teamcity agent install directory # noqa: name[template]
Expand Down

0 comments on commit 83e8c97

Please sign in to comment.