diff --git a/roles/grafana_agent/tasks/install.yaml b/roles/grafana_agent/tasks/install.yaml index a93a461..ff101eb 100644 --- a/roles/grafana_agent/tasks/install.yaml +++ b/roles/grafana_agent/tasks/install.yaml @@ -1,19 +1,19 @@ --- # user and group creation -- name: Configure User Groups +- name: Configure user groups ansible.builtin.import_tasks: install/user-group.yaml # directory creation -- name: Configure Directories +- name: Configure directories ansible.builtin.import_tasks: install/directories.yaml # download and install agent -- name: Download and Install Agent +- name: Download and install Grafana Agent ansible.builtin.import_tasks: install/download-install.yaml when: (grafana_agent_local_binary_file is not defined) or (grafana_agent_local_binary_file | length == 0) # local install of agent -- name: Local Install of Agent +- name: Local install of Grafana Agent ansible.builtin.import_tasks: file: install/local-install.yaml when: __grafana_agent_local_install diff --git a/roles/grafana_agent/tasks/install/directories.yaml b/roles/grafana_agent/tasks/install/directories.yaml index 593f9ea..13f3851 100644 --- a/roles/grafana_agent/tasks/install/directories.yaml +++ b/roles/grafana_agent/tasks/install/directories.yaml @@ -1,7 +1,7 @@ --- -- name: Create Install Directories +- name: Create install directories block: - - name: Create Grafana Agent Install Directory + - name: Create Grafana Agent install directory ansible.builtin.file: path: "{{ grafana_agent_install_dir }}" state: directory @@ -9,7 +9,7 @@ group: "{{ grafana_agent_user_group }}" mode: 0770 - - name: Create Grafana Agent Conf Directory + - name: Create Grafana Agent conf directory ansible.builtin.file: path: "{{ grafana_agent_config_dir }}" state: directory @@ -17,7 +17,7 @@ group: "{{ grafana_agent_user_group }}" mode: 0770 - - name: Create Grafana Agent Data Directory + - name: Create Grafana Agent data directory ansible.builtin.file: path: "{{ grafana_agent_data_dir }}" state: directory diff --git a/roles/grafana_agent/tasks/install/download-install.yaml b/roles/grafana_agent/tasks/install/download-install.yaml index c5b0d21..26c9612 100644 --- a/roles/grafana_agent/tasks/install/download-install.yaml +++ b/roles/grafana_agent/tasks/install/download-install.yaml @@ -1,7 +1,7 @@ --- -- name: Download Grafana Agent Binary to controller (localhost) +- name: Download Grafana Agent binary to controller (localhost) block: - - name: Create Grafana Agent temp Directory + - name: Create Grafana Agent temp directory become: false ansible.builtin.file: path: "{{ grafana_agent_local_tmp_dir }}" @@ -11,7 +11,7 @@ check_mode: false run_once: true - - name: Download Grafana Agent Archive to local folder + - name: Download Grafana Agent archive to local folder become: false ansible.builtin.get_url: url: "{{ _grafana_agent_download_url }}" diff --git a/roles/grafana_agent/tasks/install/local-install.yaml b/roles/grafana_agent/tasks/install/local-install.yaml index 15ad384..a2859bb 100644 --- a/roles/grafana_agent/tasks/install/local-install.yaml +++ b/roles/grafana_agent/tasks/install/local-install.yaml @@ -1,5 +1,5 @@ --- -- name: Install from Local +- name: Install from local block: - name: "Propagate local binary {{ grafana_agent_local_binary_file }}" ansible.builtin.copy: diff --git a/roles/grafana_agent/tasks/install/user-group.yaml b/roles/grafana_agent/tasks/install/user-group.yaml index a217653..317e97f 100644 --- a/roles/grafana_agent/tasks/install/user-group.yaml +++ b/roles/grafana_agent/tasks/install/user-group.yaml @@ -1,5 +1,5 @@ --- -- name: Grafana Agent Group Creation +- name: Grafana Agent group creation block: - name: "Check if the group exists ({{ grafana_agent_user_group }})" ansible.builtin.getent: @@ -18,14 +18,14 @@ state: present when: not __grafana_agent_user_group_exists and grafana_agent_user_group != 'root' - - name: Grafana Agent User Group Exists + - name: Grafana Agent user group exists ansible.builtin.debug: msg: |- The user group \"{{ grafana_agent_user_group }}\" already exists and will not be modified, if modifying permissions please perform a separate task when: __grafana_agent_user_group_exists -- name: Grafana Agent User Creation +- name: Grafana Agent user creation block: - name: "Check if the user exists ({{ grafana_agent_user }})" ansible.builtin.getent: @@ -48,7 +48,7 @@ createhome: "{{ grafana_agent_user_createhome }}" when: not __grafana_agent_user_exists and grafana_agent_user != 'root' - - name: Grafana Agent User Exists + - name: Grafana Agent user exists ansible.builtin.debug: msg: |- The user \"{{ grafana_agent_user }}\" already exists and will not be modified, diff --git a/roles/grafana_agent/tasks/main.yaml b/roles/grafana_agent/tasks/main.yaml index 648f127..804fa1c 100644 --- a/roles/grafana_agent/tasks/main.yaml +++ b/roles/grafana_agent/tasks/main.yaml @@ -1,5 +1,5 @@ --- -- name: Preflight Tasks +- name: Preflight tasks ansible.builtin.include_tasks: file: preflight.yaml apply: @@ -13,7 +13,7 @@ - grafana_agent_configure - grafana_agent_run -- name: Install Tasks +- name: Install tasks ansible.builtin.include_tasks: file: install.yaml apply: @@ -24,7 +24,7 @@ - grafana_agent_install when: __grafana_agent_do_install -- name: Configuration Tasks +- name: Configuration tasks ansible.builtin.include_tasks: file: configure.yaml apply: @@ -34,7 +34,7 @@ tags: - grafana_agent_configure -- name: Ensure Grafana Agent is Started and Enabled on Boot +- name: Ensure Grafana Agent is started and enabled on boot become: true ansible.builtin.systemd: daemon_reload: true diff --git a/roles/grafana_agent/tasks/preflight.yaml b/roles/grafana_agent/tasks/preflight.yaml index 13d8420..95d3ea7 100644 --- a/roles/grafana_agent/tasks/preflight.yaml +++ b/roles/grafana_agent/tasks/preflight.yaml @@ -1,14 +1,14 @@ --- -- name: Preflight Variable Checks +- name: Preflight variable checks ansible.builtin.import_tasks: preflight/vars.yaml -- name: Systemd Variable Checks +- name: Systemd variable checks ansible.builtin.import_tasks: preflight/systemd.yaml -- name: Install Variable Checks +- name: Install variable checks ansible.builtin.import_tasks: preflight/install.yaml -- name: Download Variable Checks +- name: Download variable checks ansible.builtin.import_tasks: preflight/download.yaml - name: Set whether or not to do the install @@ -16,6 +16,6 @@ __grafana_agent_do_install: >- {{ not __grafana_agent_is_installed.stat.exists or __grafana_agent_installed_version is version_compare(grafana_agent_version, '<') }} -- name: Do Install +- name: Do install ansible.builtin.debug: var: __grafana_agent_do_install diff --git a/roles/grafana_agent/tasks/preflight/download.yaml b/roles/grafana_agent/tasks/preflight/download.yaml index 9965f78..145eff8 100644 --- a/roles/grafana_agent/tasks/preflight/download.yaml +++ b/roles/grafana_agent/tasks/preflight/download.yaml @@ -1,8 +1,8 @@ --- -- name: Get Grafana Agent Version from Github +- name: Get Grafana Agent version from Github when: grafana_agent_version == 'latest' and not __grafana_agent_local_install block: - - name: Get the latest published Grafana-Agent # noqa command-instead-of-module + - name: Get the latest published Grafana Agent # noqa command-instead-of-module ansible.builtin.shell: | curl -s https://api.github.com/repos/{{ _grafana_agent_github_org }}/{{ _grafana_agent_github_repo }}/releases/latest \ | grep -m 1 tag_name \ @@ -13,7 +13,7 @@ become: false register: _grafana_agent_version_request - - name: Set the Grafana Agent Version + - name: Set the Grafana Agent version ansible.builtin.set_fact: grafana_agent_version: "{{ _grafana_agent_version_request.stdout }}" @@ -21,11 +21,11 @@ ansible.builtin.debug: var: grafana_agent_version -- name: Set the Grafana Agent Download URL +- name: Set the Grafana Agent download URL ansible.builtin.set_fact: _grafana_agent_download_url: |- {{ _grafana_agent_base_download_url }}/v{{ grafana_agent_version }}/{{ _grafana_agent_download_archive_file }} -- name: Grafana Agent Download URL +- name: Grafana Agent download URL ansible.builtin.debug: var: _grafana_agent_download_url diff --git a/roles/grafana_agent/tasks/preflight/install.yaml b/roles/grafana_agent/tasks/preflight/install.yaml index defdadd..833ecec 100644 --- a/roles/grafana_agent/tasks/preflight/install.yaml +++ b/roles/grafana_agent/tasks/preflight/install.yaml @@ -49,7 +49,7 @@ ansible.builtin.debug: var: __grafana_agent_is_installed.stat.exists -- name: Install Checks +- name: Install checks when: __grafana_agent_is_installed.stat.exists and not __grafana_agent_local_install block: - name: Gather currently installed grafana-agent version from the host @@ -63,10 +63,10 @@ register: __grafana_agent_current_version_output check_mode: false - - name: Set Grafana Agent Installed Version for the host + - name: Set Grafana Agent installed version for the host ansible.builtin.set_fact: __grafana_agent_installed_version: "{{ __grafana_agent_current_version_output.stdout }}" - - name: Grafana Agent Installed Version on host + - name: Grafana Agent installed version on host ansible.builtin.debug: var: __grafana_agent_installed_version