style: pass ansible-lint

This commit is contained in:
Nathaniel Landau
2023-04-25 11:32:29 -04:00
parent 76f4af703e
commit d36212b7d7
18 changed files with 1246 additions and 1214 deletions

View File

@@ -1,7 +1,7 @@
--- ---
repos: repos:
- repo: "https://github.com/commitizen-tools/commitizen" - repo: "https://github.com/commitizen-tools/commitizen"
rev: v2.42.1 rev: 3.0.1
hooks: hooks:
- id: "commitizen" - id: "commitizen"
@@ -31,7 +31,7 @@ repos:
args: [--markdown-linebreak-ext=md] args: [--markdown-linebreak-ext=md]
- repo: "https://github.com/adrienverge/yamllint.git" - repo: "https://github.com/adrienverge/yamllint.git"
rev: v1.29.0 rev: v1.31.0
hooks: hooks:
- id: yamllint - id: yamllint
files: \.(yaml|yml)$ files: \.(yaml|yml)$

View File

@@ -6,6 +6,7 @@
cmd: automount -cv cmd: automount -cv
register: automount_output register: automount_output
failed_when: automount_output.rc > 0 failed_when: automount_output.rc > 0
changed_when: automount_output.rc == 0
when: when:
- "'macs' in group_names" - "'macs' in group_names"
- not ansible_check_mode - not ansible_check_mode
@@ -17,6 +18,7 @@
cmd: automount -cvu cmd: automount -cvu
register: automount_output register: automount_output
failed_when: automount_output.rc > 0 failed_when: automount_output.rc > 0
changed_when: automount_output.rc == 0
when: when:
- "'macs' in group_names" - "'macs' in group_names"
- not ansible_check_mode - not ansible_check_mode
@@ -28,6 +30,9 @@
ansible.builtin.service: ansible.builtin.service:
name: telegraf name: telegraf
state: restarted state: restarted
register: telegraf_service
failed_when: telegraf_service.rc > 0
changed_when: telegraf_service.rc == 0
when: when:
- ansible_os_family == 'Debian' - ansible_os_family == 'Debian'
listen: restart_telegraf listen: restart_telegraf
@@ -37,46 +42,57 @@
cmd: /usr/local/bin/brew services restart telegraf cmd: /usr/local/bin/brew services restart telegraf
executable: /usr/local/bin/bash executable: /usr/local/bin/bash
ignore_errors: true ignore_errors: true
register: telegraf_service
failed_when: telegraf_service.rc > 0
changed_when: telegraf_service.rc == 0
when: when:
- ansible_os_family == 'Darwin' - ansible_os_family == 'Darwin'
listen: restart_telegraf listen: restart_telegraf
##################################### NOMAD ##################################### NOMAD
- name: restart nomad (Debian) - name: Restart nomad (Debian)
become: true become: true
ansible.builtin.systemd: ansible.builtin.systemd:
name: nomad name: nomad
enabled: true enabled: true
state: restarted state: restarted
register: nomad_service
failed_when: nomad_service.rc > 0
changed_when: nomad_service.rc == 0
when: when:
- ansible_os_family == 'Debian' - ansible_os_family == 'Debian'
- "'nostart' not in ansible_run_tags" - "'nostart' not in ansible_run_tags"
listen: "restart nomad" listen: "restart nomad"
- name: "unload nomad agent (MacOSX)" - name: "Unload nomad agent (MacOSX)"
ansible.builtin.command: ansible.builtin.command:
cmd: "launchctl unload -w {{ nomad_plist_macos }}" cmd: "launchctl unload -w {{ nomad_plist_macos }}"
failed_when: false register: nomad_service
changed_when: nomad_service.rc == 0
failed_when: nomad_service.rc > 0
when: when:
- ansible_os_family == 'Darwin' - ansible_os_family == 'Darwin'
- "'nostart' not in ansible_run_tags" - "'nostart' not in ansible_run_tags"
listen: "restart nomad" listen: "restart nomad"
- name: "load the nomad agent (MacOSX)" - name: "Load the nomad agent (MacOSX)"
ansible.builtin.command: ansible.builtin.command:
cmd: "launchctl load -w {{ nomad_plist_macos }}" cmd: "launchctl load -w {{ nomad_plist_macos }}"
register: nomad_service
changed_when: nomad_service.rc == 0
failed_when: nomad_service.rc > 0
when: when:
- ansible_os_family == 'Darwin' - ansible_os_family == 'Darwin'
- "'nostart' not in ansible_run_tags" - "'nostart' not in ansible_run_tags"
listen: "restart nomad" listen: "restart nomad"
- name: "ensure nomad is really running" - name: "Ensure nomad is really running"
ansible.builtin.shell: ansible.builtin.shell:
cmd: "sleep 10 && /usr/local/bin/nomad node status -self -short | grep {{ inventory_hostname }}" cmd: "set -o pipefail && sleep 10 && /usr/local/bin/nomad node status -self -short | grep {{ inventory_hostname }}"
register: node_status_response register: node_status_response
failed_when: node_status_response.rc > 0 failed_when: node_status_response.rc > 0
changed_when: false changed_when: node_status_response.rc == 0
when: "'nostart' not in ansible_run_tags" when: "'nostart' not in ansible_run_tags"
listen: "restart nomad" listen: "restart nomad"
# - name: "Ensure sure Nomad service is really running" # - name: "Ensure sure Nomad service is really running"

View File

@@ -11,13 +11,13 @@
- name: Run sanity checks - name: Run sanity checks
ansible.builtin.import_tasks: tasks/sanity.yml ansible.builtin.import_tasks: tasks/sanity.yml
tags: ["always", "sanity"] tags: ["always", "sanity"]
- name: populate service facts - name: Populate service facts
ansible.builtin.service_facts: ansible.builtin.service_facts:
tags: ["nomad", "consul"] tags: ["nomad", "consul"]
- name: Run debug tasks - name: Run debug tasks
ansible.builtin.import_tasks: tasks/debug.yml ansible.builtin.import_tasks: tasks/debug.yml
tags: [never, debug] tags: [never, debug]
- name: populate device specific variables - name: Populate device specific variables
ansible.builtin.import_tasks: tasks/interpolated_variables.yml ansible.builtin.import_tasks: tasks/interpolated_variables.yml
tags: ["always"] tags: ["always"]
- name: Ensure we have up-to-date packages - name: Ensure we have up-to-date packages

View File

@@ -6,7 +6,7 @@
# 1. Copies a backup and restore shellscript to /usr/local/bin # 1. Copies a backup and restore shellscript to /usr/local/bin
# 2. Edits the sudoers file to allow the script to be invoked with sudo privileges # 2. Edits the sudoers file to allow the script to be invoked with sudo privileges
- name: copy backup shellscript to server - name: Copy backup shellscript to server
become: true become: true
ansible.builtin.template: ansible.builtin.template:
src: scripts/service_backups.sh.j2 src: scripts/service_backups.sh.j2
@@ -15,7 +15,7 @@
when: when:
- is_nomad_client or is_nomad_server - is_nomad_client or is_nomad_server
- name: copy restore shellscript to server - name: Copy restore shellscript to server
become: true become: true
ansible.builtin.template: ansible.builtin.template:
src: scripts/service_restore.sh.j2 src: scripts/service_restore.sh.j2
@@ -24,7 +24,7 @@
when: when:
- is_nomad_client or is_nomad_server - is_nomad_client or is_nomad_server
- name: ensure nomad user can run sudo with the restore script - name: Ensure nomad user can run sudo with the restore script
become: true become: true
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: /etc/sudoers path: /etc/sudoers
@@ -35,7 +35,7 @@
- is_nomad_client or is_nomad_server - is_nomad_client or is_nomad_server
- "'pis' in group_names" - "'pis' in group_names"
- name: ensure my user can run sudo with the restore script - name: Ensure my user can run sudo with the restore script
become: true become: true
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: /etc/sudoers path: /etc/sudoers

View File

@@ -6,7 +6,7 @@
- name: "Mount storage on Raspberry Pis" - name: "Mount storage on Raspberry Pis"
when: "'pis' in group_names" when: "'pis' in group_names"
block: block:
- name: ensure local mount points exist - name: Ensure local mount points exist
become: true become: true
ansible.builtin.file: ansible.builtin.file:
path: "{{ item.local }}" path: "{{ item.local }}"
@@ -16,7 +16,7 @@
# group: "{{ ansible_user_gid }}" # group: "{{ ansible_user_gid }}"
loop: "{{ rpi_nfs_mounts_list }}" loop: "{{ rpi_nfs_mounts_list }}"
- name: remove old nfs drives - name: Remove old nfs drives
become: true become: true
ansible.posix.mount: ansible.posix.mount:
path: "{{ item.local }}" path: "{{ item.local }}"
@@ -26,7 +26,7 @@
state: absent state: absent
loop: "{{ rpi_nfs_mounts_remove }}" loop: "{{ rpi_nfs_mounts_remove }}"
- name: mount all nfs drives - name: Mount all nfs drives
become: true become: true
ansible.posix.mount: ansible.posix.mount:
path: "{{ item.local }}" path: "{{ item.local }}"
@@ -42,7 +42,7 @@
- name: "Mount storage on Macs" - name: "Mount storage on Macs"
when: "'macs' in group_names" when: "'macs' in group_names"
block: block:
- name: create mount_point - name: Create mount_point
become: true become: true
ansible.builtin.file: ansible.builtin.file:
path: "{{ mac_storage_mount_point }}" path: "{{ mac_storage_mount_point }}"
@@ -52,10 +52,10 @@
# I ran into problems getting this to run successfully. If errors occur, add the line manually using: # I ran into problems getting this to run successfully. If errors occur, add the line manually using:
# $ sudo nano /private/etc/auto_master # $ sudo nano /private/etc/auto_master
- name: add NFS shared drives to macs - name: Add NFS shared drives to macs
when: mac_autofs_type == 'nfs' when: mac_autofs_type == 'nfs'
block: block:
- name: add auto_nfs to "/private/etc/auto_master" - name: Add auto_nfs to "/private/etc/auto_master"
become: true become: true
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: /private/etc/auto_master path: /private/etc/auto_master
@@ -63,7 +63,7 @@
line: "/- auto_nfs -nobrowse,nosuid" line: "/- auto_nfs -nobrowse,nosuid"
unsafe_writes: true unsafe_writes: true
- name: add mounts to /etc/auto_nfs - name: Add mounts to /etc/auto_nfs
become: true become: true
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
create: true create: true
@@ -76,7 +76,7 @@
loop: "{{ mac_nfs_mounts_list if mac_nfs_mounts_list is iterable else [] }}" loop: "{{ mac_nfs_mounts_list if mac_nfs_mounts_list is iterable else [] }}"
notify: mac_run_automount notify: mac_run_automount
- name: remove old mounts from /etc/auto_nfs - name: Remove old mounts from /etc/auto_nfs
become: true become: true
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
create: true create: true
@@ -89,10 +89,10 @@
notify: mac_run_automount_unmount notify: mac_run_automount_unmount
loop: "{{ mac_nfs_mounts_remove if mac_nfs_mounts_remove is iterable else [] }}" loop: "{{ mac_nfs_mounts_remove if mac_nfs_mounts_remove is iterable else [] }}"
- name: add AFP shared drives to macs - name: Add AFP shared drives to macs
when: mac_autofs_type == 'afp' when: mac_autofs_type == 'afp'
block: block:
- name: add auto_afp to "/private/etc/auto_master" - name: Add auto_afp to "/private/etc/auto_master"
become: true become: true
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: /private/etc/auto_master path: /private/etc/auto_master
@@ -100,7 +100,7 @@
line: "/- auto_afp -nobrowse,nosuid" line: "/- auto_afp -nobrowse,nosuid"
unsafe_writes: true unsafe_writes: true
- name: add mounts to /etc/auto_afp - name: Add mounts to /etc/auto_afp
become: true become: true
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
create: true create: true
@@ -113,7 +113,7 @@
loop: "{{ mac_afp_or_smb_mounts_list if mac_afp_or_smb_mounts_list is iterable else [] }}" loop: "{{ mac_afp_or_smb_mounts_list if mac_afp_or_smb_mounts_list is iterable else [] }}"
notify: mac_run_automount notify: mac_run_automount
- name: remove mounts from /etc/auto_afp - name: Remove mounts from /etc/auto_afp
become: true become: true
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
create: true create: true
@@ -126,10 +126,10 @@
loop: "{{ mac_afp_or_smb_mounts_remove if mac_afp_or_smb_mounts_remove is iterable else [] }}" loop: "{{ mac_afp_or_smb_mounts_remove if mac_afp_or_smb_mounts_remove is iterable else [] }}"
notify: mac_run_automount_unmount notify: mac_run_automount_unmount
- name: add SMB shared drives to macs - name: Add SMB shared drives to macs
when: mac_autofs_type == 'smb' when: mac_autofs_type == 'smb'
block: block:
- name: add auto_smb to "/private/etc/auto_master" - name: Add auto_smb to "/private/etc/auto_master"
become: true become: true
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: /private/etc/auto_master path: /private/etc/auto_master
@@ -137,7 +137,7 @@
line: "/- auto_smb -noowners,nosuid" line: "/- auto_smb -noowners,nosuid"
unsafe_writes: true unsafe_writes: true
- name: add mounts to /etc/auto_smb - name: Add mounts to /etc/auto_smb
become: true become: true
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
create: true create: true
@@ -150,7 +150,7 @@
loop: "{{ mac_afp_or_smb_mounts_list if mac_afp_or_smb_mounts_list is iterable else [] }}" loop: "{{ mac_afp_or_smb_mounts_list if mac_afp_or_smb_mounts_list is iterable else [] }}"
notify: mac_run_automount notify: mac_run_automount
- name: remove mounts from /etc/auto_smb - name: Remove mounts from /etc/auto_smb
become: true become: true
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
create: true create: true

View File

@@ -92,6 +92,9 @@
become: true become: true
ansible.builtin.command: ansible.builtin.command:
cmd: "launchctl unload {{ consul_plist_macos }}" cmd: "launchctl unload {{ consul_plist_macos }}"
register: consul_unload
failed_when: consul_unload.rc != 0
changed_when: consul_unload.rc == 0
when: when:
- ansible_os_family == 'Darwin' - ansible_os_family == 'Darwin'
- consul_file.stat.exists - consul_file.stat.exists
@@ -308,6 +311,9 @@
- name: Load the Consul agent (MacOSX) - name: Load the Consul agent (MacOSX)
ansible.builtin.command: ansible.builtin.command:
cmd: "launchctl load -w {{ consul_plist_macos }}" cmd: "launchctl load -w {{ consul_plist_macos }}"
register: consul_loaded
changed_when: consul_loaded.rc == 0
failed_when: consul_loaded.rc > 0
when: when:
- mac_intel or mac_arm - mac_intel or mac_arm
- "'nostart' not in ansible_run_tags" - "'nostart' not in ansible_run_tags"

View File

@@ -33,5 +33,5 @@
# when: # when:
# - ansible_facts['system_vendor'] is search("Synology") # - ansible_facts['system_vendor'] is search("Synology")
- name: "end play" - name: "End play"
ansible.builtin.meta: end_play ansible.builtin.meta: end_play

View File

@@ -9,7 +9,7 @@
changed_when: docker_command_result.rc == 1 changed_when: docker_command_result.rc == 1
failed_when: false failed_when: false
- name: install docker on Debian - name: Install docker on Debian
when: ansible_os_family == 'Debian' when: ansible_os_family == 'Debian'
block: block:
- name: "Add docker local filesystem storage directory" - name: "Add docker local filesystem storage directory"
@@ -29,6 +29,9 @@
ansible.builtin.command: /tmp/get-docker.sh ansible.builtin.command: /tmp/get-docker.sh
environment: environment:
CHANNEL: stable CHANNEL: stable
register: docker_install
failed_when: docker_install.rc > 0
changed_when: docker_install.rc == 0
when: docker_command_result.rc == 1 when: docker_command_result.rc == 1
- name: Make sure Docker CE is the version specified - name: Make sure Docker CE is the version specified
@@ -51,7 +54,7 @@
append: true append: true
when: docker_command_result.rc == 1 when: docker_command_result.rc == 1
- name: install docker on macOS - name: Install docker on macOS
when: "'macs' in group_names" when: "'macs' in group_names"
block: block:
- name: "Add docker directory to ~/Library" - name: "Add docker directory to ~/Library"
@@ -60,7 +63,7 @@
mode: 0755 mode: 0755
state: directory state: directory
- name: install base homebrew packages - name: Install base homebrew packages
community.general.homebrew: community.general.homebrew:
name: docker name: docker
state: present state: present
@@ -68,9 +71,12 @@
upgrade_all: false upgrade_all: false
when: docker_command_result.rc == 1 when: docker_command_result.rc == 1
- name: open docker application - name: Open docker application
ansible.builtin.command: ansible.builtin.command:
cmd: open /Applications/Docker.app cmd: open /Applications/Docker.app
register: docker_open_app
failed_when: docker_open_app.rc > 0
changed_when: docker_open_app.rc == 0
when: docker_command_result.rc == 1 when: docker_command_result.rc == 1
- name: Must install Docker manually - name: Must install Docker manually
@@ -83,6 +89,6 @@
- add '{{ mac_storage_mount_point }}' to mountable file system directories - add '{{ mac_storage_mount_point }}' to mountable file system directories
when: docker_command_result.rc == 1 when: docker_command_result.rc == 1
- name: end play - name: End play
ansible.builtin.meta: end_play ansible.builtin.meta: end_play
when: docker_command_result.rc == 1 when: docker_command_result.rc == 1

View File

@@ -34,19 +34,19 @@
when: when:
- "'macs' in group_names" - "'macs' in group_names"
- name: "set consul configuration directory (synology)" - name: "Set consul configuration directory (synology)"
ansible.builtin.set_fact: ansible.builtin.set_fact:
interpolated_consul_configuration_dir: "{{ synology_consul_configuration_dir }}" interpolated_consul_configuration_dir: "{{ synology_consul_configuration_dir }}"
when: when:
- inventory_hostname == 'synology' - inventory_hostname == 'synology'
- name: "set consul configuration directory (pis)" - name: "Set consul configuration directory (pis)"
ansible.builtin.set_fact: ansible.builtin.set_fact:
interpolated_consul_configuration_dir: "{{ rpi_consul_configuration_dir }}" interpolated_consul_configuration_dir: "{{ rpi_consul_configuration_dir }}"
when: when:
- "'pis' in group_names" - "'pis' in group_names"
- name: "set consul configuration directory (macs)" - name: "Set consul configuration directory (macs)"
ansible.builtin.set_fact: ansible.builtin.set_fact:
interpolated_consul_configuration_dir: "{{ mac_consul_configuration_dir }}" interpolated_consul_configuration_dir: "{{ mac_consul_configuration_dir }}"
when: when:

View File

@@ -4,7 +4,7 @@
# #
# NOTE: This task exists due to the arillso.logrotate failing completely on macOS # NOTE: This task exists due to the arillso.logrotate failing completely on macOS
- name: add service_backups.log to logrotate - name: Add service_backups.log to logrotate
become: true become: true
vars: vars:
logrotate_applications: logrotate_applications:

View File

@@ -4,7 +4,7 @@
- name: "Set variables needed to install Nomad" - name: "Set variables needed to install Nomad"
block: block:
- name: "set variable: check if we have a mounted USB drive (Debian)" - name: "Set variable: check if we have a mounted USB drive (Debian)"
ansible.builtin.stat: ansible.builtin.stat:
path: "{{ rpi_usb_drive_mount_point }}" path: "{{ rpi_usb_drive_mount_point }}"
register: have_usb_drive register: have_usb_drive
@@ -12,41 +12,41 @@
when: when:
- ansible_os_family == 'Debian' - ansible_os_family == 'Debian'
- name: "set variable: Use USB drive for nomad /opt (Debian)" - name: "Set variable: Use USB drive for nomad /opt (Debian)"
ansible.builtin.set_fact: ansible.builtin.set_fact:
nomad_opt_dir_location: "{{ rpi_usb_drive_mount_point }}/opt/nomad" nomad_opt_dir_location: "{{ rpi_usb_drive_mount_point }}/opt/nomad"
when: when:
- ansible_os_family == 'Debian' - ansible_os_family == 'Debian'
- have_usb_drive.stat.exists - have_usb_drive.stat.exists
- name: "set variable: Use root dist for nomad /opt (Debian)" - name: "Set variable: Use root dist for nomad /opt (Debian)"
ansible.builtin.set_fact: ansible.builtin.set_fact:
nomad_opt_dir_location: "/opt/nomad" nomad_opt_dir_location: "/opt/nomad"
when: when:
- ansible_os_family == 'Debian' - ansible_os_family == 'Debian'
- not have_usb_drive.stat.exists - not have_usb_drive.stat.exists
- name: "set variable: Use ~/library for /opt files (macOSX)" - name: "Set variable: Use ~/library for /opt files (macOSX)"
ansible.builtin.set_fact: ansible.builtin.set_fact:
nomad_opt_dir_location: "/Users/{{ ansible_user }}/Library/nomad" nomad_opt_dir_location: "/Users/{{ ansible_user }}/Library/nomad"
when: when:
- ansible_os_family == 'Darwin' - ansible_os_family == 'Darwin'
- name: "set variable: Set Nomad download Binary (armv7l)" - name: "Set variable: Set Nomad download Binary (armv7l)"
ansible.builtin.set_fact: ansible.builtin.set_fact:
nomad_download_file_uri: "https://releases.hashicorp.com/nomad/{{ nomad_version }}/nomad_{{ nomad_version }}_linux_arm.zip" nomad_download_file_uri: "https://releases.hashicorp.com/nomad/{{ nomad_version }}/nomad_{{ nomad_version }}_linux_arm.zip"
when: when:
- ansible_os_family == 'Debian' - ansible_os_family == 'Debian'
- ansible_architecture == 'armv7l' - ansible_architecture == 'armv7l'
- name: "set variable: Set Nomad download Binary (aarch64)" - name: "Set variable: Set Nomad download Binary (aarch64)"
ansible.builtin.set_fact: ansible.builtin.set_fact:
nomad_download_file_uri: "https://releases.hashicorp.com/nomad/{{ nomad_version }}/nomad_{{ nomad_version }}_linux_arm64.zip" nomad_download_file_uri: "https://releases.hashicorp.com/nomad/{{ nomad_version }}/nomad_{{ nomad_version }}_linux_arm64.zip"
when: when:
- ansible_os_family == 'Debian' - ansible_os_family == 'Debian'
- ansible_architecture == 'aarch64' - ansible_architecture == 'aarch64'
- name: "set variable: Set Nomad download Binary (MacOSX)" - name: "Set variable: Set Nomad download Binary (MacOSX)"
ansible.builtin.set_fact: ansible.builtin.set_fact:
nomad_download_file_uri: "https://releases.hashicorp.com/nomad/{{ nomad_version }}/nomad_{{ nomad_version }}_darwin_amd64.zip" nomad_download_file_uri: "https://releases.hashicorp.com/nomad/{{ nomad_version }}/nomad_{{ nomad_version }}_darwin_amd64.zip"
when: when:
@@ -83,7 +83,7 @@
- name: "Create Nomad /opt storage" - name: "Create Nomad /opt storage"
block: block:
- name: "create {{ nomad_opt_dir_location }} directories" - name: "Create {{ nomad_opt_dir_location }} directories"
become: true become: true
ansible.builtin.file: ansible.builtin.file:
path: "{{ item }}" path: "{{ item }}"
@@ -121,7 +121,7 @@
notify: "restart nomad" notify: "restart nomad"
when: is_nomad_client when: is_nomad_client
- name: "set owner of files to nomad:nomad (debian)" - name: "Set owner of files to nomad:nomad (debian)"
become: true become: true
ansible.builtin.file: ansible.builtin.file:
path: "{{ nomad_opt_dir_location }}" path: "{{ nomad_opt_dir_location }}"
@@ -130,7 +130,7 @@
recurse: true recurse: true
when: ansible_os_family == 'Debian' when: ansible_os_family == 'Debian'
- name: "set owner of files to {{ ansible_user_uid }}:{{ ansible_user_gid }} (MacOSX)" - name: "Set owner of files to {{ ansible_user_uid }}:{{ ansible_user_gid }} (MacOSX)"
become: true become: true
ansible.builtin.file: ansible.builtin.file:
path: "{{ nomad_opt_dir_location }}" path: "{{ nomad_opt_dir_location }}"
@@ -141,14 +141,14 @@
- name: "Template out the configuration file" - name: "Template out the configuration file"
block: block:
- name: "create {{ nomad_configuration_dir }}" - name: "Create {{ nomad_configuration_dir }}"
become: true become: true
ansible.builtin.file: ansible.builtin.file:
path: "{{ nomad_configuration_dir }}" path: "{{ nomad_configuration_dir }}"
state: directory state: directory
mode: 0755 mode: 0755
- name: copy base config file - name: Copy base config file
become: true become: true
ansible.builtin.template: ansible.builtin.template:
src: nomad.hcl.j2 src: nomad.hcl.j2
@@ -156,7 +156,7 @@
mode: 0644 mode: 0644
notify: "restart nomad" notify: "restart nomad"
- name: "set owner of files to nomad:nomad (Debian)" - name: "Set owner of files to nomad:nomad (Debian)"
become: true become: true
ansible.builtin.file: ansible.builtin.file:
path: "{{ nomad_configuration_dir }}" path: "{{ nomad_configuration_dir }}"
@@ -168,7 +168,7 @@
- name: Install or Update Nomad - name: Install or Update Nomad
block: block:
- name: "set fact: do we need a nomad install?" - name: "Set fact: do we need a nomad install?"
ansible.builtin.set_fact: ansible.builtin.set_fact:
need_nomad_install: false need_nomad_install: false
@@ -177,7 +177,7 @@
path: /usr/local/bin/nomad path: /usr/local/bin/nomad
register: nomad_binary_file_location register: nomad_binary_file_location
- name: "set fact: do we need a nomad install" - name: "Set fact: do we need a nomad install"
ansible.builtin.set_fact: ansible.builtin.set_fact:
need_nomad_install: true need_nomad_install: true
when: when:
@@ -192,14 +192,14 @@
when: when:
- not need_nomad_install - not need_nomad_install
- name: "set fact: do we need a nomad install" - name: "Set fact: do we need a nomad install"
ansible.builtin.set_fact: ansible.builtin.set_fact:
need_nomad_install: true need_nomad_install: true
when: when:
- not need_nomad_install - not need_nomad_install
- current_nomad_version.stdout is version(nomad_version, '<') - current_nomad_version.stdout is version(nomad_version, '<')
- name: install Nomad - name: Install Nomad
become: true become: true
ansible.builtin.unarchive: ansible.builtin.unarchive:
src: "{{ nomad_download_file_uri }}" src: "{{ nomad_download_file_uri }}"
@@ -211,7 +211,7 @@
- name: "Copy system.d or launchctrl service files" - name: "Copy system.d or launchctrl service files"
block: block:
- name: ensure /Library/LaunchAgents exists (MacOSX) - name: Ensure /Library/LaunchAgents exists (MacOSX)
ansible.builtin.file: ansible.builtin.file:
path: "{{ nomad_plist_macos | dirname }}" path: "{{ nomad_plist_macos | dirname }}"
state: directory state: directory
@@ -219,7 +219,7 @@
when: when:
- ansible_os_family == 'Darwin' - ansible_os_family == 'Darwin'
- name: create nomad launchd service (MacOSX) - name: Create nomad launchd service (MacOSX)
ansible.builtin.template: ansible.builtin.template:
src: nomad.launchd.j2 src: nomad.launchd.j2
dest: "{{ nomad_plist_macos }}" dest: "{{ nomad_plist_macos }}"
@@ -228,7 +228,7 @@
when: when:
- ansible_os_family == 'Darwin' - ansible_os_family == 'Darwin'
- name: create nomad service (Debian) - name: Create nomad service (Debian)
become: true become: true
ansible.builtin.template: ansible.builtin.template:
src: nomad.service.j2 src: nomad.service.j2
@@ -238,7 +238,7 @@
when: when:
- ansible_os_family == 'Debian' - ansible_os_family == 'Debian'
- name: "start nomad, if stopped" - name: "Start nomad, if stopped"
ansible.builtin.shell: ansible.builtin.shell:
cmd: "/usr/local/bin/nomad node status -self -short | grep {{ inventory_hostname }}" cmd: "/usr/local/bin/nomad node status -self -short | grep {{ inventory_hostname }}"
register: node_status_response register: node_status_response

View File

@@ -27,7 +27,7 @@
- is_nomad_client or is_nomad_server or ("'macs' in group_names") - is_nomad_client or is_nomad_server or ("'macs' in group_names")
- "'nas' not in group_names" - "'nas' not in group_names"
- name: synchronize nomad job templates (jinja) - name: Synchronize nomad job templates (jinja)
ansible.builtin.template: ansible.builtin.template:
src: "{{ item }}" src: "{{ item }}"
dest: "{{ nomad_jobfile_location }}/{{ item | basename | regex_replace('.j2$', '') }}" dest: "{{ nomad_jobfile_location }}/{{ item | basename | regex_replace('.j2$', '') }}"
@@ -37,7 +37,7 @@
- is_nomad_client or is_nomad_server or ("'macs' in group_names") - is_nomad_client or is_nomad_server or ("'macs' in group_names")
- "'nas' not in group_names" - "'nas' not in group_names"
- name: synchronize nomad job templates (hcl) - name: Synchronize nomad job templates (hcl)
ansible.builtin.template: ansible.builtin.template:
src: "{{ item }}" src: "{{ item }}"
dest: "{{ nomad_jobfile_location }}/{{ item | basename }}" dest: "{{ nomad_jobfile_location }}/{{ item | basename }}"
@@ -59,16 +59,16 @@
- is_nomad_client or is_nomad_server - is_nomad_client or is_nomad_server
loop: "{{ service_localfs_dirs }}" loop: "{{ service_localfs_dirs }}"
- name: "Sync docker compose files" - name: Sync docker compose files
when: is_docker_compose_client when: is_docker_compose_client
block: block:
- name: confirm compose file dir exists - name: Confirm compose file dir exists
ansible.builtin.file: ansible.builtin.file:
path: "{{ docker_compose_file_location }}" path: "{{ docker_compose_file_location }}"
state: directory state: directory
mode: 0755 mode: 0755
- name: synchronize docker-compose files - name: Synchronize docker-compose files
ansible.builtin.template: ansible.builtin.template:
src: "{{ item }}" src: "{{ item }}"
dest: "{{ docker_compose_file_location }}/{{ item | basename | regex_replace('.j2$', '') }}" dest: "{{ docker_compose_file_location }}/{{ item | basename | regex_replace('.j2$', '') }}"

View File

@@ -7,18 +7,18 @@
- ansible_os_family != 'Darwin' - ansible_os_family != 'Darwin'
- manage_apt_packages_list - manage_apt_packages_list
block: block:
- name: update APT package cache - name: Update APT package cache
become: true become: true
ansible.builtin.apt: ansible.builtin.apt:
update_cache: true update_cache: true
cache_valid_time: 3600 cache_valid_time: 3600
- name: "upgrade APT to the latest packages (this may take a while)" - name: "Upgrade APT to the latest packages (this may take a while)"
become: true become: true
ansible.builtin.apt: ansible.builtin.apt:
upgrade: safe upgrade: safe
- name: "install/upgrade APT packages (this may take a while)" - name: "Install/upgrade APT packages (this may take a while)"
become: true become: true
ansible.builtin.apt: ansible.builtin.apt:
pkg: "{{ item }}" pkg: "{{ item }}"
@@ -31,14 +31,14 @@
- manage_homebrew_package_list - manage_homebrew_package_list
- ansible_os_family == 'Darwin' - ansible_os_family == 'Darwin'
block: block:
- name: upgrade homebrew and all packages - name: Upgrade homebrew and all packages
community.general.homebrew: community.general.homebrew:
update_homebrew: true update_homebrew: true
upgrade_all: true upgrade_all: true
register: homebrew_output register: homebrew_output
ignore_errors: true ignore_errors: true
- name: install base homebrew packages - name: Install base homebrew packages
community.general.homebrew: community.general.homebrew:
name: "{{ homebrew_package_list | join(',') }}" name: "{{ homebrew_package_list | join(',') }}"
state: present state: present
@@ -46,15 +46,15 @@
upgrade_all: false upgrade_all: false
register: homebrew_output register: homebrew_output
- name: homebrew packages updated or installed - name: Homebrew packages updated or installed
ansible.builtin.debug: ansible.builtin.debug:
msg: "{{ homebrew_output.changed_pkgs }}" msg: "{{ homebrew_output.changed_pkgs }}"
- name: unchanged homebrew packages - name: Unchanged homebrew packages
ansible.builtin.debug: ansible.builtin.debug:
msg: "{{ homebrew_output.unchanged_pkgs }}" msg: "{{ homebrew_output.unchanged_pkgs }}"
- name: install homebrew casks - name: Install homebrew casks
community.general.homebrew_cask: community.general.homebrew_cask:
name: "{{ item }}" name: "{{ item }}"
state: present state: present

View File

@@ -15,7 +15,7 @@
check_mode: false check_mode: false
register: repos_directory_check register: repos_directory_check
- name: "run pull_all_repos script" - name: "Run pull_all_repos script"
ansible.builtin.command: ansible.builtin.command:
cmd: "~/bin/pull_all_repos --directory ~/repos" cmd: "~/bin/pull_all_repos --directory ~/repos"
register: pull_script_output register: pull_script_output
@@ -27,6 +27,7 @@
- repos_directory_check.stat.isdir - repos_directory_check.stat.isdir
- repos_directory_check.stat.writeable - repos_directory_check.stat.writeable
failed_when: pull_script_output.rc > 1 failed_when: pull_script_output.rc > 1
changed_when: pull_script_output.rc == 0
- name: "Output from pull_all_repos" - name: "Output from pull_all_repos"
ansible.builtin.debug: ansible.builtin.debug:

View File

@@ -1,12 +1,12 @@
--- ---
# TASK DESCRIPTION: # TASK DESCRIPTION:
# Always runs fist. Confirms we can actually use Ansible # Always runs fist. Confirms we can actually use Ansible
- name: sanity - user mode - name: Sanity - user mode
become: false become: false
ansible.builtin.debug: ansible.builtin.debug:
msg: "sanity check: user mode" msg: "Sanity check: user mode"
- name: sanity - become mode - name: Sanity - become mode
become: true become: true
ansible.builtin.debug: ansible.builtin.debug:
msg: "sanity check: become mode" msg: "Sanity check: become mode"

View File

@@ -4,10 +4,10 @@
# #
# NOTE: This is depreciated, I no longer use Prometheus and have migrated to Telegraf # NOTE: This is depreciated, I no longer use Prometheus and have migrated to Telegraf
- name: populate service facts - name: Populate service facts
ansible.builtin.service_facts: ansible.builtin.service_facts:
- name: stop node_exporter - name: Stop node_exporter
become: true become: true
ansible.builtin.systemd: ansible.builtin.systemd:
name: node_exporter name: node_exporter
@@ -29,7 +29,7 @@
append: true append: true
# --------------- Install or Update Prometheus # --------------- Install or Update Prometheus
- name: "set fact: need to install Prometheus?" - name: "Set fact: need to install Prometheus?"
ansible.builtin.set_fact: ansible.builtin.set_fact:
need_prometheus_install: false need_prometheus_install: false
@@ -38,7 +38,7 @@
path: /usr/local/bin/node_exporter path: /usr/local/bin/node_exporter
register: prometheus_binary_file_location register: prometheus_binary_file_location
- name: "set fact: need to install Prometheus?" - name: "Set fact: need to install Prometheus?"
ansible.builtin.set_fact: ansible.builtin.set_fact:
need_prometheus_install: true need_prometheus_install: true
when: when:
@@ -48,18 +48,20 @@
ansible.builtin.shell: /usr/local/bin/node_exporter --version 3>&1 1>&2 2>&3 | head -n1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' ansible.builtin.shell: /usr/local/bin/node_exporter --version 3>&1 1>&2 2>&3 | head -n1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+'
ignore_errors: true ignore_errors: true
register: current_prometheus_version register: current_prometheus_version
failed_when: false
changed_when: false
check_mode: false check_mode: false
when: when:
- need_prometheus_install is false - need_prometheus_install is false
- name: "set fact: need to install Prometheus?" - name: "Set fact: need to install Prometheus?"
ansible.builtin.set_fact: ansible.builtin.set_fact:
need_prometheus_install: true need_prometheus_install: true
when: when:
- need_prometheus_install is false - need_prometheus_install is false
- current_prometheus_version.stdout != prometheus_verssion - current_prometheus_version.stdout != prometheus_verssion
- name: install node_exporter - name: Install node_exporter
become: true become: true
ansible.builtin.unarchive: ansible.builtin.unarchive:
src: "https://github.com/prometheus/node_exporter/releases/download/v{{ prometheus_verssion }}/node_exporter-{{ prometheus_verssion }}.linux-armv7.tar.gz" src: "https://github.com/prometheus/node_exporter/releases/download/v{{ prometheus_verssion }}/node_exporter-{{ prometheus_verssion }}.linux-armv7.tar.gz"
@@ -75,14 +77,14 @@
when: when:
- need_prometheus_install is true - need_prometheus_install is true
- name: create node_exporter service - name: Create node_exporter service
become: true become: true
ansible.builtin.template: ansible.builtin.template:
src: node_exporter.service.j2 src: node_exporter.service.j2
dest: /etc/systemd/system/node_exporter.service dest: /etc/systemd/system/node_exporter.service
mode: 0644 mode: 0644
- name: start node_exporter - name: Start node_exporter
become: true become: true
ansible.builtin.systemd: ansible.builtin.systemd:
name: node_exporter name: node_exporter

View File

@@ -18,26 +18,26 @@
when: when:
- "'macs' in group_names" - "'macs' in group_names"
- name: "set variable: Set tdarr download Binary (armv7l)" - name: "Set variable: Set tdarr download Binary (armv7l)"
ansible.builtin.set_fact: ansible.builtin.set_fact:
tdarr_download_uri: "https://f000.backblazeb2.com/file/tdarrs/versions/{{ tdarr_installer_version }}/linux_arm/Tdarr_Updater.zip" tdarr_download_uri: "https://f000.backblazeb2.com/file/tdarrs/versions/{{ tdarr_installer_version }}/linux_arm/Tdarr_Updater.zip"
when: when:
- ansible_os_family == 'Debian' - ansible_os_family == 'Debian'
- ansible_architecture == 'armv7l' - ansible_architecture == 'armv7l'
- name: "set variable: Set tdarr download Binary (MacOSX) - Intel" - name: "Set variable: Set tdarr download Binary (MacOSX) - Intel"
ansible.builtin.set_fact: ansible.builtin.set_fact:
tdarr_download_uri: "https://f000.backblazeb2.com/file/tdarrs/versions/{{ tdarr_installer_version }}/darwin_x64/Tdarr_Updater.zip" tdarr_download_uri: "https://f000.backblazeb2.com/file/tdarrs/versions/{{ tdarr_installer_version }}/darwin_x64/Tdarr_Updater.zip"
when: when:
- mac_intel - mac_intel
- name: "set variable: Set tdarr download Binary (MacOSX) - ARM" - name: "Set variable: Set tdarr download Binary (MacOSX) - ARM"
ansible.builtin.set_fact: ansible.builtin.set_fact:
tdarr_download_uri: "https://f000.backblazeb2.com/file/tdarrs/versions/{{ tdarr_installer_version }}/darwin_arm64/Tdarr_Updater.zip" tdarr_download_uri: "https://f000.backblazeb2.com/file/tdarrs/versions/{{ tdarr_installer_version }}/darwin_arm64/Tdarr_Updater.zip"
when: when:
- mac_arm - mac_arm
- name: "set fact: do we need a tdarr install?" - name: "Set fact: do we need a tdarr install?"
ansible.builtin.set_fact: ansible.builtin.set_fact:
need_tdarr_install: false need_tdarr_install: false
@@ -50,7 +50,7 @@
- name: "Install ffmpeg and HandbrakeCLI" - name: "Install ffmpeg and HandbrakeCLI"
block: block:
- name: "ensure ffmpeg and handbrake are installed (Debian)" - name: "Ensure ffmpeg and handbrake are installed (Debian)"
become: true become: true
ansible.builtin.apt: ansible.builtin.apt:
pkg: "{{ item }}" pkg: "{{ item }}"
@@ -60,7 +60,7 @@
- handbrake - handbrake
when: "'pis' in group_names" when: "'pis' in group_names"
- name: "ensure ffmpeg and handbrake are installed (MacOS)" - name: "Ensure ffmpeg and handbrake are installed (MacOS)"
community.general.homebrew: community.general.homebrew:
name: "{{ item }}" name: "{{ item }}"
state: present state: present
@@ -71,7 +71,7 @@
- handbrake - handbrake
when: "'macs' in group_names" when: "'macs' in group_names"
- name: "ensure tdarr directory exists" - name: "Ensure tdarr directory exists"
become: true become: true
ansible.builtin.file: ansible.builtin.file:
path: "{{ interpolated_tdarr_dir }}" path: "{{ interpolated_tdarr_dir }}"
@@ -82,14 +82,14 @@
- name: "Install tdarr" - name: "Install tdarr"
block: block:
- name: "set_fact: need Tdarr install?" - name: "Set fact: need Tdarr install?"
ansible.builtin.stat: ansible.builtin.stat:
path: "{{ interpolated_tdarr_dir }}/configs" path: "{{ interpolated_tdarr_dir }}/configs"
register: tdarr_exists register: tdarr_exists
changed_when: false changed_when: false
failed_when: false failed_when: false
- name: "set fact: do we need a tdarr install?" - name: "Set fact: do we need a tdarr install?"
ansible.builtin.set_fact: ansible.builtin.set_fact:
need_tdarr_install: true need_tdarr_install: true
when: not tdarr_exists.stat.exists when: not tdarr_exists.stat.exists
@@ -119,6 +119,7 @@
cmd: "{{ interpolated_tdarr_dir }}/Tdarr_Updater" cmd: "{{ interpolated_tdarr_dir }}/Tdarr_Updater"
register: tdarr_install register: tdarr_install
failed_when: tdarr_install.rc > 0 failed_when: tdarr_install.rc > 0
changed_when: tdarr_install.rc == 0
when: need_tdarr_install when: need_tdarr_install
- name: Ensure correct permissions on server/node executables - name: Ensure correct permissions on server/node executables
@@ -130,23 +131,23 @@
- Tdarr_Node/Tdarr_Node - Tdarr_Node/Tdarr_Node
when: need_tdarr_install when: need_tdarr_install
- name: "configure tdarr" - name: "Configure tdarr"
block: block:
- name: update server configuration file - name: Update server configuration file
ansible.builtin.template: ansible.builtin.template:
src: Tdarr_Server_Config.json.j2 src: Tdarr_Server_Config.json.j2
dest: "{{ interpolated_tdarr_dir }}/configs/Tdarr_Server_Config.json" dest: "{{ interpolated_tdarr_dir }}/configs/Tdarr_Server_Config.json"
mode: 0644 mode: 0644
when: is_tdarr_server when: is_tdarr_server
- name: update node configuration file - name: Update node configuration file
ansible.builtin.template: ansible.builtin.template:
src: Tdarr_Node_Config.json.j2 src: Tdarr_Node_Config.json.j2
dest: "{{ interpolated_tdarr_dir }}/configs/Tdarr_Node_Config.json" dest: "{{ interpolated_tdarr_dir }}/configs/Tdarr_Node_Config.json"
mode: 0644 mode: 0644
when: is_tdarr_node when: is_tdarr_node
- name: check if consul is installed? - name: Check if consul is installed?
ansible.builtin.stat: ansible.builtin.stat:
path: "{{ interpolated_consul_configuration_dir }}" path: "{{ interpolated_consul_configuration_dir }}"
register: consul_installed register: consul_installed
@@ -155,7 +156,7 @@
when: when:
- is_tdarr_server - is_tdarr_server
- name: move consul service config into place - name: Move consul service config into place
become: true become: true
ansible.builtin.template: ansible.builtin.template:
src: consul_services/tdarr_service.json.j2 src: consul_services/tdarr_service.json.j2
@@ -177,7 +178,7 @@
- is_tdarr_server - is_tdarr_server
- consul_installed.stat.exists - consul_installed.stat.exists
- name: debug when consul agent reload fails - name: Debug when consul agent reload fails
ansible.builtin.debug: ansible.builtin.debug:
var: consul_agent_reload_http_response.msg var: consul_agent_reload_http_response.msg
when: when:
@@ -185,5 +186,5 @@
- consul_installed.stat.exists - consul_installed.stat.exists
- consul_agent_reload_http_response.status != 200 - consul_agent_reload_http_response.status != 200
- name: mount shared storage - name: Mount shared storage
ansible.builtin.import_tasks: cluster_storage.yml ansible.builtin.import_tasks: cluster_storage.yml

View File

@@ -5,31 +5,31 @@
# --------------------------------- Set variables depending on system type # --------------------------------- Set variables depending on system type
- name: "Configure variables" - name: "Configure variables"
block: block:
- name: "set variable: telegraph_binary_location (Debian)" - name: "Set variable: telegraph_binary_location (Debian)"
ansible.builtin.set_fact: ansible.builtin.set_fact:
telegraph_binary_location: "/usr/bin/telegraf" telegraph_binary_location: "/usr/bin/telegraf"
when: when:
- ansible_os_family == 'Debian' - ansible_os_family == 'Debian'
- name: "set variable: telegraph_binary_location (MacOS)" - name: "Set variable: telegraph_binary_location (MacOS)"
ansible.builtin.set_fact: ansible.builtin.set_fact:
telegraph_binary_location: "/usr/local/bin/telegraf" telegraph_binary_location: "/usr/local/bin/telegraf"
when: when:
- ansible_os_family == 'Darwin' - ansible_os_family == 'Darwin'
- name: "set fact: telegraph_config_location (Debian)" - name: "Set fact: telegraph_config_location (Debian)"
ansible.builtin.set_fact: ansible.builtin.set_fact:
telegraph_config_location: "/etc/telegraf" telegraph_config_location: "/etc/telegraf"
when: when:
- ansible_os_family == 'Debian' - ansible_os_family == 'Debian'
- name: "set fact: telegraph_config_location (macOS)" - name: "Set fact: telegraph_config_location (macOS)"
ansible.builtin.set_fact: ansible.builtin.set_fact:
telegraph_config_location: "/usr/local/etc" telegraph_config_location: "/usr/local/etc"
when: when:
- ansible_os_family == 'Darwin' - ansible_os_family == 'Darwin'
- name: "set fact: telegraph_config_location (macOS)" - name: "Set fact: telegraph_config_location (macOS)"
ansible.builtin.set_fact: ansible.builtin.set_fact:
telegraph_config_location: "/volume1/docker/telegraf/config" telegraph_config_location: "/volume1/docker/telegraf/config"
when: when:
@@ -43,14 +43,14 @@
- not mac_arm - not mac_arm
fail_msg: "Unable to install Telegraf on this host" fail_msg: "Unable to install Telegraf on this host"
- name: "set variable: Set speedtest download Binary (armv7l)" - name: "Set variable: Set speedtest download Binary (armv7l)"
ansible.builtin.set_fact: ansible.builtin.set_fact:
speedtest_download_file_uri: "https://install.speedtest.net/app/cli/ookla-speedtest-{{ speedtest_cli_version }}-linux-armhf.tgz" speedtest_download_file_uri: "https://install.speedtest.net/app/cli/ookla-speedtest-{{ speedtest_cli_version }}-linux-armhf.tgz"
when: when:
- ansible_os_family == 'Debian' - ansible_os_family == 'Debian'
- ansible_architecture == 'armv7l' - ansible_architecture == 'armv7l'
- name: "set variable: Set speedtest download Binary (aarch64)" - name: "Set variable: Set speedtest download Binary (aarch64)"
ansible.builtin.set_fact: ansible.builtin.set_fact:
speedtest_download_file_uri: "https://install.speedtest.net/app/cli/ookla-speedtest-{{ speedtest_cli_version }}-linux-aarch64.tgz" speedtest_download_file_uri: "https://install.speedtest.net/app/cli/ookla-speedtest-{{ speedtest_cli_version }}-linux-aarch64.tgz"
when: when:
@@ -59,7 +59,7 @@
- name: "Install/upgrade Telegraf" - name: "Install/upgrade Telegraf"
block: block:
- name: "set fact: Need telegraf install?" - name: "Set fact: Need telegraf install?"
ansible.builtin.set_fact: ansible.builtin.set_fact:
need_telegraf_install: false need_telegraf_install: false
when: telegraph_binary_location is defined when: telegraph_binary_location is defined
@@ -71,7 +71,7 @@
register: telegraf_binary_exists register: telegraf_binary_exists
when: telegraph_binary_location is defined when: telegraph_binary_location is defined
- name: "set fact: Need telegraf install?" - name: "Set fact: Need telegraf install?"
ansible.builtin.set_fact: ansible.builtin.set_fact:
need_telegraf_install: true need_telegraf_install: true
check_mode: false check_mode: false
@@ -89,7 +89,7 @@
- not need_telegraf_install - not need_telegraf_install
- telegraph_binary_location is defined - telegraph_binary_location is defined
- name: "set fact: Need telegraf install?" - name: "Set fact: Need telegraf install?"
ansible.builtin.set_fact: ansible.builtin.set_fact:
need_telegraf_install: true need_telegraf_install: true
when: when:
@@ -97,7 +97,7 @@
- not need_telegraf_install - not need_telegraf_install
- current_telegraf_version.stdout is version(telegraf_version, '<') - current_telegraf_version.stdout is version(telegraf_version, '<')
- name: install telegraf (MacOS) - name: Install telegraf (MacOS)
community.general.homebrew: community.general.homebrew:
name: telegraf name: telegraf
state: present state: present
@@ -106,7 +106,7 @@
- ansible_os_family == 'Darwin' - ansible_os_family == 'Darwin'
- need_telegraf_install - need_telegraf_install
- name: install base apt-transport (Debian) - name: Install base apt-transport (Debian)
become: true become: true
ansible.builtin.apt: ansible.builtin.apt:
pkg: apt-transport-https pkg: apt-transport-https
@@ -134,7 +134,7 @@
- ansible_os_family == 'Debian' - ansible_os_family == 'Debian'
- need_telegraf_install - need_telegraf_install
- name: install telegraf (Debian) - name: Install telegraf (Debian)
become: true become: true
ansible.builtin.apt: ansible.builtin.apt:
pkg: telegraf pkg: telegraf
@@ -162,7 +162,7 @@
- name: "Install speedtest" - name: "Install speedtest"
when: "'pis' in group_names" when: "'pis' in group_names"
block: block:
- name: "set fact: do we need speedtest installed?" - name: "Set fact: do we need speedtest installed?"
ansible.builtin.set_fact: ansible.builtin.set_fact:
need_speedtest_install: false need_speedtest_install: false
@@ -171,7 +171,7 @@
path: /usr/local/bin/speedtest path: /usr/local/bin/speedtest
register: speedtest_binary_file_location register: speedtest_binary_file_location
- name: "set fact: do we need a speedtest install" - name: "Set fact: do we need a speedtest install"
ansible.builtin.set_fact: ansible.builtin.set_fact:
need_speedtest_install: true need_speedtest_install: true
when: when:
@@ -186,7 +186,7 @@
when: when:
- not need_speedtest_install - not need_speedtest_install
- name: "set fact: do we need a speedtest install" - name: "Set fact: do we need a speedtest install"
ansible.builtin.set_fact: ansible.builtin.set_fact:
need_speedtest_install: true need_speedtest_install: true
when: when:
@@ -216,7 +216,7 @@
- "{{ telegraph_config_location }}" - "{{ telegraph_config_location }}"
- "{{ telegraph_config_location }}/telegraf.d" - "{{ telegraph_config_location }}/telegraf.d"
- name: template config files to server - name: Template config files to server
become: true become: true
ansible.builtin.template: ansible.builtin.template:
src: "{{ item.src }}" src: "{{ item.src }}"
@@ -229,7 +229,7 @@
- { src: "telegraf/docker.conf.j2", dest: "{{ telegraph_config_location }}/telegraf.d/docker.conf" } - { src: "telegraf/docker.conf.j2", dest: "{{ telegraph_config_location }}/telegraf.d/docker.conf" }
notify: restart_telegraf notify: restart_telegraf
- name: template leader configs (ie, configs that should be placed on a single server) - name: Template leader configs (ie, configs that should be placed on a single server)
become: true become: true
ansible.builtin.template: ansible.builtin.template:
src: "{{ item.src }}" src: "{{ item.src }}"