File tree Expand file tree Collapse file tree 5 files changed +23
-10
lines changed
Expand file tree Collapse file tree 5 files changed +23
-10
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
55The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
66and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
77
8+ ## 4.2.0
9+
10+ * Add: If ` buildkite_agent_logs_dir ` is unset for the target platform, log to stdout/stderr instead of an arbitrary default file.
11+
812## 4.1.0
913
1014* Add: macOS ` buildkite_agent_brew_dir ` to set where ` brew ` is installed.
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ An Ansible role to install the [Buildkite Agent](https://buildkite.com/docs/agen
2222 - Note: on Windows, this defaults to ` c:/b ` because long filenames still cause problems in the 21st Century.
2323- ` buildkite_agent_hooks_dir ` - Path to where agent will look for hooks.
2424- ` buildkite_agent_plugins_dir ` - Path to where agent will look for plugins.
25- - ` buildkite_agent_logs_dir ` - Path to write agent logs.
25+ - ` buildkite_agent_logs_dir ` - Path to write agent logs - if unset, logs are printed to stdout/stderr .
2626 - Note that this option only applies to Windows, and Linux platforms with [ systemd versions newer than late 2017] ( https://github.com/systemd/systemd/issues/3991 ) .
2727
2828### Configuration settings
Original file line number Diff line number Diff line change @@ -45,10 +45,6 @@ buildkite_agent_plugins_dir:
4545 Darwin : ' {{ buildkite_agent_home_dir[ansible_os_family] }}/plugins'
4646 Debian : ' {{ buildkite_agent_home_dir[ansible_os_family] }}/plugins'
4747 Windows : ' {{ buildkite_agent_conf_dir[ansible_os_family] }}/plugins'
48- buildkite_agent_logs_dir :
49- Darwin : ' {{ buildkite_agent_conf_dir[ansible_os_family] }}'
50- Debian : ' {{ buildkite_agent_conf_dir[ansible_os_family] }}'
51- Windows : ' {{ buildkite_agent_conf_dir[ansible_os_family] }}'
5248
5349# configuration values, see https://buildkite.com/docs/agent/v3/configuration
5450# note: the booleans are quoted otherwise they are rendered capitalised.
Original file line number Diff line number Diff line change 9898 with_items :
9999 - ' {{ buildkite_agent_builds_dir[ansible_os_family] }}'
100100
101- - name : configure buildkite-agent as an nssm service
101+ # Only one of the below tasks will run, depending on the type of service logging
102+ - name : configure buildkite-agent as an nssm service with journal-based logging
102103 win_nssm :
103104 name : buildkite-agent
104105 application : ' {{ buildkite_agent_executable[ansible_os_family] }}'
105106 arguments : ' {{ buildkite_agent_start_command[ansible_os_family] }}'
106107 stdout_file : ' {{ buildkite_agent_logs_dir[ansible_os_family] }}/buildkite-agent.log'
107108 stderr_file : ' {{ buildkite_agent_logs_dir[ansible_os_family] }}/buildkite-agent.log'
108109 executable : ' {{ buildkite_agent_nssm_exe }}'
110+ when : buildkite_agent_logs_dir[ansible_os_family] is undefined
111+
112+ - name : configure buildkite-agent as an nssm service with file-based logging
113+ win_nssm :
114+ name : buildkite-agent
115+ application : ' {{ buildkite_agent_executable[ansible_os_family] }}'
116+ arguments : ' {{ buildkite_agent_start_command[ansible_os_family] }}'
117+ stdout_file : ' {{ buildkite_agent_logs_dir[ansible_os_family] }}/buildkite-agent.log'
118+ stderr_file : ' {{ buildkite_agent_logs_dir[ansible_os_family] }}/buildkite-agent.log'
119+ executable : ' {{ buildkite_agent_nssm_exe }}'
120+ when : buildkite_agent_logs_dir[ansible_os_family] is defined
109121
110122 - name : configure service
111123 win_service :
Original file line number Diff line number Diff line change @@ -8,7 +8,8 @@ ExecStart={{ buildkite_agent_executable[ansible_os_family] }} {{ buildkite_agent
88
99User={{ buildkite_agent_username }}
1010
11- # These options will only work on systemd newer than late 2017 (https://github.com/systemd/systemd/issues/3991)
12- # On older systemd, they will generate a warning, but no error.
13- StandardOutput=file:{{ buildkite_agent_logs_dir[ansible_os_family] }}/buildkite-agent.log
14- StandardError=file:{{ buildkite_agent_logs_dir[ansible_os_family] }}/buildkite-agent.log
11+ {% if buildkite_agent_logs_dir [ansible_os_family ] is defined %}
12+ # Point the agent logs at files if the user chooses a log dir. Otherwise they will flow to stdout/stderr/journal.
13+ StandardOutput=file:{{ buildkite_agent_logs_dir[ansible_os_family] }}/buildkite-agent.log
14+ StandardError=file:{{ buildkite_agent_logs_dir[ansible_os_family] }}/buildkite-agent.log
15+ {% endif %}
You can’t perform that action at this time.
0 commit comments