[TIDY] Set some "diff: false", fix linter warnings
This commit is contained in:
parent
f97ef4dee6
commit
fe97b0ae76
|
@ -117,11 +117,11 @@ The different tasks should be used on a case-by-case basis:
|
|||
name: server
|
||||
tasks_from: docker
|
||||
- name: Servers - Add telegraf to docker group
|
||||
become: yes
|
||||
become: true
|
||||
ansible.builtin.user:
|
||||
name: telegraf
|
||||
groups: docker
|
||||
append: yes
|
||||
append: true
|
||||
|
||||
# Caddy Webserver
|
||||
- name: Servers - Install and setup caddy
|
||||
|
@ -129,7 +129,7 @@ The different tasks should be used on a case-by-case basis:
|
|||
name: server
|
||||
tasks_from: caddyserver
|
||||
- name: Servers - Start caddy service
|
||||
become: yes
|
||||
become: true
|
||||
ansible.builtin.service:
|
||||
name: caddy
|
||||
enabled: yes
|
||||
|
@ -137,7 +137,7 @@ The different tasks should be used on a case-by-case basis:
|
|||
|
||||
# UFW Firewall
|
||||
- name: Servers - Install UFW
|
||||
become: yes
|
||||
become: true
|
||||
ansible.builtin.apt:
|
||||
name: ufw
|
||||
state: present
|
||||
|
|
|
@ -2,26 +2,26 @@
|
|||
# handlers file for server
|
||||
|
||||
- name: Restart sshd
|
||||
become: yes
|
||||
become: true
|
||||
ansible.builtin.service:
|
||||
name: ssh
|
||||
state: restarted
|
||||
|
||||
- name: Enable caddy
|
||||
become: yes
|
||||
become: true
|
||||
ansible.builtin.service:
|
||||
name: caddy
|
||||
enabled: yes
|
||||
enabled: true
|
||||
|
||||
- name: Restart caddy
|
||||
become: yes
|
||||
become: true
|
||||
ansible.builtin.service:
|
||||
name: caddy
|
||||
state: restarted
|
||||
|
||||
- name: Enable and restart caddy
|
||||
become: yes
|
||||
become: true
|
||||
ansible.builtin.service:
|
||||
name: caddy
|
||||
state: restarted
|
||||
enabled: yes
|
||||
enabled: true
|
||||
|
|
|
@ -7,31 +7,32 @@
|
|||
|
||||
# For Debian Stretch, use a newer package version from backports
|
||||
|
||||
- name: borgbackup - Add debian repo key
|
||||
- name: Borgbackup - Add debian repo key
|
||||
when:
|
||||
- ansible_distribution_release == 'stretch'
|
||||
become: yes
|
||||
become: true
|
||||
ansible.builtin.apt_key:
|
||||
keyserver: pgpkeys.mit.edu
|
||||
id: 8B48AD6246925553
|
||||
state: present
|
||||
- name: borgbackup - Add stretch-backports
|
||||
- name: Borgbackup - Add stretch-backports
|
||||
when:
|
||||
- ansible_distribution_release == 'stretch'
|
||||
become: yes
|
||||
become: true
|
||||
ansible.builtin.apt_repository:
|
||||
repo: deb http://ftp.debian.org/debian stretch-backports main
|
||||
state: present
|
||||
- name: borgbackup - Install borgbackup from stretch-backports
|
||||
- name: Borgbackup - Install borgbackup from stretch-backports
|
||||
when:
|
||||
- borgbackup_passphrase is defined
|
||||
- borgbackup_repo is defined
|
||||
- borgbackup_hostname is defined
|
||||
- ansible_distribution_release == 'stretch'
|
||||
become: yes
|
||||
become: true
|
||||
ansible.builtin.apt:
|
||||
name: borgbackup
|
||||
state: latest
|
||||
default_release: stretch-backports
|
||||
update_cache: yes
|
||||
update_cache: true
|
||||
cache_valid_time: 3600
|
||||
diff: false
|
||||
|
|
|
@ -7,13 +7,14 @@
|
|||
|
||||
# For all other Debian versions, simply install borgbackup
|
||||
|
||||
- name: borgbackup - Install borgbackup
|
||||
- name: Borgbackup - Install borgbackup
|
||||
when:
|
||||
- borgbackup_passphrase is defined
|
||||
- borgbackup_repo is defined
|
||||
- borgbackup_hostname is defined
|
||||
- ansible_distribution_release != 'stretch'
|
||||
become: yes
|
||||
become: true
|
||||
ansible.builtin.apt:
|
||||
name: borgbackup
|
||||
state: present
|
||||
diff: false
|
||||
|
|
|
@ -5,31 +5,31 @@
|
|||
# - borgbackup_repo
|
||||
# - borgbackup_hostname
|
||||
|
||||
- name: borgbackup - Install
|
||||
- name: Borgbackup - Install
|
||||
when:
|
||||
- borgbackup_passphrase is defined
|
||||
- borgbackup_repo is defined
|
||||
- borgbackup_hostname is defined
|
||||
block:
|
||||
- name: borgbackup - Install application
|
||||
- name: Borgbackup - Install application
|
||||
ansible.builtin.include_tasks: "{{ item }}"
|
||||
with_first_found:
|
||||
- "borgbackup-{{ ansible_distribution }}.{{ ansible_distribution_release }}.yml"
|
||||
- "borgbackup-{{ ansible_distribution }}.yml"
|
||||
- "borgbackup-{{ (override_os_family is defined) | ternary(override_os_family,ansible_os_family) }}.yml"
|
||||
- "borgbackup-{{ (override_os_family is defined) | ternary(override_os_family, ansible_os_family) }}.yml"
|
||||
ignore_errors: true
|
||||
|
||||
# copy backup script and enable cronjob
|
||||
- name: borgbackup - Copy Borgbackup script
|
||||
become: yes
|
||||
- name: Borgbackup - Copy Borgbackup script
|
||||
become: true
|
||||
ansible.builtin.template:
|
||||
src: "{{ role_path }}/templates/borgbackup.sh"
|
||||
dest: /usr/local/bin/borgbackup.sh
|
||||
owner: "{{ ansible_user_id }}"
|
||||
group: "{{ ansible_user_id }}"
|
||||
mode: 0775
|
||||
- name: borgbackup - Run Borgbackup script at 1:00 daily
|
||||
become: yes
|
||||
mode: "0775"
|
||||
- name: Borgbackup - Run Borgbackup script at 1:00 daily
|
||||
become: true
|
||||
ansible.builtin.cron:
|
||||
name: "Create Backup"
|
||||
minute: "0"
|
||||
|
@ -37,16 +37,16 @@
|
|||
job: "/usr/local/bin/borgbackup.sh"
|
||||
|
||||
# safeguard, if the host variables were removed
|
||||
- name: borgbackup - Uninstall
|
||||
- name: Borgbackup - Uninstall
|
||||
when: (borgbackup_passphrase is not defined) or (borgbackup_repo is not defined) or (borgbackup_hostname is not defined)
|
||||
block:
|
||||
- name: borgbackup - Remove Borgbackup script if no borgbackup config
|
||||
become: yes
|
||||
- name: Borgbackup - Remove Borgbackup script if no borgbackup config
|
||||
become: true
|
||||
ansible.builtin.file:
|
||||
path: /usr/local/bin/borgbackup.sh
|
||||
state: absent
|
||||
- name: borgbackup - Remove Cronjob if no borgbackup config
|
||||
become: yes
|
||||
- name: Borgbackup - Remove Cronjob if no borgbackup config
|
||||
become: true
|
||||
ansible.builtin.cron:
|
||||
name: "Create Backup"
|
||||
minute: "0"
|
||||
|
|
|
@ -1,66 +1,66 @@
|
|||
---
|
||||
# Server/Caddyserver-Install: Install/Update Caddy Webserver (with some modules)
|
||||
|
||||
- name: caddyserver - Create cache directory
|
||||
- name: Caddyserver - Create cache directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ caddy_cachedir }}"
|
||||
state: directory
|
||||
|
||||
- name: caddyserver - Get all caddy releases
|
||||
- name: Caddyserver - Get all caddy releases
|
||||
ansible.builtin.get_url:
|
||||
url: https://api.github.com/repos/caddyserver/caddy/git/refs/tags
|
||||
dest: "{{ caddy_cachedir }}/releases.txt"
|
||||
force: yes
|
||||
force: true
|
||||
register: caddy_releases_cache
|
||||
|
||||
- name: caddyserver - Install or update
|
||||
- name: Caddyserver - Install or update
|
||||
when: caddy_releases_cache.changed
|
||||
block:
|
||||
- name: caddyserver - Make temp download directory
|
||||
- name: Caddyserver - Make temp download directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ caddy_cachedir }}/tmp"
|
||||
state: directory
|
||||
|
||||
- name: caddyserver - Download caddy webserver (amd64)
|
||||
- name: Caddyserver - Download caddy webserver (amd64)
|
||||
when: ansible_architecture == "x86_64"
|
||||
become: yes
|
||||
become: true
|
||||
ansible.builtin.get_url:
|
||||
url: "https://caddyserver.com/api/download?os=linux&arch=amd64"
|
||||
dest: "{{ caddy_cachedir }}/tmp/caddy"
|
||||
group: root
|
||||
owner: root
|
||||
mode: 0755
|
||||
- name: caddyserver - Download caddy webserver (armv7/ raspberry pi)
|
||||
mode: "0755"
|
||||
- name: Caddyserver - Download caddy webserver (armv7/ raspberry pi)
|
||||
when: ansible_architecture == "armv7l"
|
||||
become: yes
|
||||
become: true
|
||||
ansible.builtin.get_url:
|
||||
url: "https://caddyserver.com/api/download?os=linux&arch=arm&arm=7"
|
||||
dest: "{{ caddy_cachedir }}/tmp/caddy"
|
||||
group: root
|
||||
owner: root
|
||||
mode: 0755
|
||||
- name: caddyserver - Download caddy webserver (arm64)
|
||||
mode: "0755"
|
||||
- name: Caddyserver - Download caddy webserver (arm64)
|
||||
when: ansible_architecture == "aarch64"
|
||||
become: yes
|
||||
become: true
|
||||
ansible.builtin.get_url:
|
||||
url: "https://caddyserver.com/api/download?os=linux&arch=arm64"
|
||||
dest: "{{ caddy_cachedir }}/tmp/caddy"
|
||||
group: root
|
||||
owner: root
|
||||
mode: 0755
|
||||
mode: "0755"
|
||||
|
||||
- name: caddyserver - Stop caddy
|
||||
become: yes
|
||||
- name: Caddyserver - Stop caddy
|
||||
become: true
|
||||
ansible.builtin.service:
|
||||
name: caddy
|
||||
state: stopped
|
||||
ignore_errors: yes
|
||||
ignore_errors: true
|
||||
|
||||
- name: caddyserver - Copy caddy to a PATH location
|
||||
become: yes
|
||||
- name: Caddyserver - Copy caddy to a PATH location
|
||||
become: true
|
||||
ansible.builtin.shell: "cp {{ caddy_cachedir }}/tmp/caddy /usr/local/bin"
|
||||
- name: caddyserver - Clean up download files
|
||||
become: yes
|
||||
- name: Caddyserver - Clean up download files
|
||||
become: true
|
||||
ansible.builtin.file:
|
||||
path: "{{ caddy_cachedir }}/tmp"
|
||||
state: absent
|
||||
|
|
|
@ -1,45 +1,45 @@
|
|||
---
|
||||
# Server/Caddyserver-Setup: Setup Caddy Webserver (user, directories, etc)
|
||||
|
||||
- name: caddyserver - Add www-data system user
|
||||
become: yes
|
||||
- name: Caddyserver - Add www-data system user
|
||||
become: true
|
||||
ansible.builtin.user:
|
||||
name: www-data
|
||||
create_home: no
|
||||
system: yes
|
||||
create_home: false
|
||||
system: true
|
||||
shell: /bin/false
|
||||
state: present
|
||||
- name: caddyserver - Add Caddy directories
|
||||
become: yes
|
||||
- name: Caddyserver - Add Caddy directories
|
||||
become: true
|
||||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
owner: www-data
|
||||
group: www-data
|
||||
mode: 0770
|
||||
mode: "0770"
|
||||
with_items:
|
||||
- /var/lib/caddy
|
||||
- /etc/caddy
|
||||
- name: caddyserver - Add Caddy home directory
|
||||
become: yes
|
||||
- name: Caddyserver - Add Caddy home directory
|
||||
become: true
|
||||
ansible.builtin.file:
|
||||
path: /var/www
|
||||
state: directory
|
||||
owner: www-data
|
||||
group: www-data
|
||||
mode: 0555
|
||||
- name: caddyserver - Copy Caddy systemd service file
|
||||
become: yes
|
||||
mode: "0555"
|
||||
- name: Caddyserver - Copy Caddy systemd service file
|
||||
become: true
|
||||
ansible.builtin.template:
|
||||
src: "{{ role_path }}/templates/caddy.service"
|
||||
dest: /etc/systemd/system/caddy.service
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
mode: "0644"
|
||||
|
||||
- name: caddyserver - Add standard user to www-data group
|
||||
become: yes
|
||||
- name: Caddyserver - Add standard user to www-data group
|
||||
become: true
|
||||
ansible.builtin.user:
|
||||
name: "{{ ansible_user_id }}"
|
||||
groups: www-data
|
||||
append: yes
|
||||
append: true
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
# Server/Caddyserver: Install Caddy Webserver (with some modules)
|
||||
# ATTENTION: No Caddyfile is created yet and caddy is not enabled or started!
|
||||
|
||||
- name: caddyserver - Install caddy server
|
||||
- name: Caddyserver - Install caddy server
|
||||
ansible.builtin.include_tasks: "caddy-install.yml"
|
||||
|
||||
- name: caddyserver - Setup caddy server
|
||||
- name: Caddyserver - Setup caddy server
|
||||
when: caddy_email is defined
|
||||
ansible.builtin.include_tasks: "caddy-setup.yml"
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
# Server/Cronmails: Setup Mails from Cronjobs (install exim) - CentOS Version
|
||||
|
||||
# Install exim
|
||||
- name: cronmails - Install exim4 as MTA
|
||||
become: yes
|
||||
- name: Cronmails - Install exim4 as MTA
|
||||
become: true
|
||||
ansible.builtin.yum:
|
||||
name: "{{ packages }}"
|
||||
state: present
|
||||
|
@ -12,31 +12,31 @@
|
|||
- exim
|
||||
|
||||
# Configure exim
|
||||
- name: cronmails - Create exim config folder
|
||||
become: yes
|
||||
- name: Cronmails - Create exim config folder
|
||||
become: true
|
||||
ansible.builtin.file:
|
||||
path: /etc/exim
|
||||
state: directory
|
||||
# TODO: exim config works quite differently on CentOS compared to Debian!!!
|
||||
# # - name: cronmails - Copy exim config template
|
||||
# # become: yes
|
||||
# # - name: Cronmails - Copy exim config template
|
||||
# # become: true
|
||||
# # ansible.builtin.copy:
|
||||
# # src: "{{ role_path }}/files/exim4.conf.template"
|
||||
# # dest: /etc/exim/exim.conf.template
|
||||
# # register: cronmails_conftmp_update
|
||||
# # - name: cronmails - Copy exim config file
|
||||
# # become: yes
|
||||
# # - name: Cronmails - Copy exim config file
|
||||
# # become: true
|
||||
# # ansible.builtin.template:
|
||||
# # src: "{{ role_path }}/templates/update-exim4.conf.conf"
|
||||
# # dest: /etc/exim/update-exim.conf.conf
|
||||
# # register: cronmails_conffile_update
|
||||
# # - name: cronmails - Run update-exim.conf
|
||||
# # - name: Cronmails - Run update-exim.conf
|
||||
# # when: cronmails_conftmp_update.changed or cronmails_conffile_update.changed
|
||||
# # become: yes
|
||||
# # become: true
|
||||
# # ansible.builtin.shell: "update-exim.conf"
|
||||
# - name: cronmails - Enable and start exim
|
||||
# become: yes
|
||||
# - name: Cronmails - Enable and start exim
|
||||
# become: true
|
||||
# ansible.builtin.service:
|
||||
# name: exim
|
||||
# state: started
|
||||
# enabled: yes
|
||||
# enabled: true
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
# Server/Cronmails: Setup Mails from Cronjobs (install exim) - Debian Version
|
||||
|
||||
# Install exim
|
||||
- name: cronmails - Install exim4 as MTA
|
||||
become: yes
|
||||
- name: Cronmails - Install exim4 as MTA
|
||||
become: true
|
||||
ansible.builtin.apt:
|
||||
name: "{{ packages }}"
|
||||
state: present
|
||||
|
@ -11,38 +11,39 @@
|
|||
packages:
|
||||
- exim4
|
||||
- mailutils
|
||||
diff: false
|
||||
|
||||
# Configure exim
|
||||
- name: cronmails - Create exim4 config folder
|
||||
become: yes
|
||||
- name: Cronmails - Create exim4 config folder
|
||||
become: true
|
||||
ansible.builtin.file:
|
||||
path: /etc/exim4
|
||||
state: directory
|
||||
- name: cronmails - Copy exim4 config template
|
||||
become: yes
|
||||
- name: Cronmails - Copy exim4 config template
|
||||
become: true
|
||||
ansible.builtin.copy:
|
||||
src: "{{ role_path }}/files/exim4.conf.template"
|
||||
dest: /etc/exim4/exim4.conf.template
|
||||
register: cronmails_conftmp_update
|
||||
- name: cronmails - Copy exim4 config file
|
||||
become: yes
|
||||
- name: Cronmails - Copy exim4 config file
|
||||
become: true
|
||||
ansible.builtin.template:
|
||||
src: "{{ role_path }}/templates/update-exim4.conf.conf"
|
||||
dest: /etc/exim4/update-exim4.conf.conf
|
||||
register: cronmails_conffile_update
|
||||
- name: cronmails - Set /etc/mailname
|
||||
become: yes
|
||||
- name: Cronmails - Set /etc/mailname
|
||||
become: true
|
||||
ansible.builtin.copy:
|
||||
dest: /etc/mailname
|
||||
content: "{{ exim_etc_mailname }}"
|
||||
register: cronmails_mailname_update
|
||||
- name: cronmails - Run update-exim4.conf
|
||||
- name: Cronmails - Run update-exim4.conf
|
||||
when: cronmails_conftmp_update.changed or cronmails_conffile_update.changed or cronmails_mailname_update.changed
|
||||
become: yes
|
||||
become: true
|
||||
ansible.builtin.shell: "update-exim4.conf"
|
||||
- name: cronmails - Enable and start exim4
|
||||
become: yes
|
||||
- name: Cronmails - Enable and start exim4
|
||||
become: true
|
||||
ansible.builtin.service:
|
||||
name: exim4
|
||||
state: restarted
|
||||
enabled: yes
|
||||
enabled: true
|
||||
|
|
|
@ -2,30 +2,30 @@
|
|||
# Server/Cronmails: Setup Mails from Cronjobs (install exim)
|
||||
|
||||
# Install and configure exim
|
||||
- name: cronmails - Install exim4
|
||||
- name: Cronmails - Install exim4
|
||||
when: not exim_skip_install
|
||||
ansible.builtin.include_tasks: "{{ item }}"
|
||||
with_first_found:
|
||||
- "cronmails-{{ ansible_distribution }}.{{ ansible_distribution_release }}.yml"
|
||||
- "cronmails-{{ ansible_distribution }}.yml"
|
||||
- "cronmails-{{ (override_os_family is defined) | ternary(override_os_family,ansible_os_family) }}.yml"
|
||||
- "cronmails-{{ (override_os_family is defined) | ternary(override_os_family, ansible_os_family) }}.yml"
|
||||
ignore_errors: true
|
||||
|
||||
# Set cronjob env variables/ settings
|
||||
- name: cronmails - Crontab set path
|
||||
become: yes
|
||||
- name: Cronmails - Crontab set path
|
||||
become: true
|
||||
ansible.builtin.cron:
|
||||
name: PATH
|
||||
env: yes
|
||||
env: true
|
||||
value: /bin:/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin
|
||||
- name: cronmails - Crontab set mailto
|
||||
become: yes
|
||||
- name: Cronmails - Crontab set mailto
|
||||
become: true
|
||||
ansible.builtin.cron:
|
||||
name: MAILTO
|
||||
env: yes
|
||||
env: true
|
||||
value: "{{ cron_email }}"
|
||||
- name: cronmails - Add monthly test mail
|
||||
become: yes
|
||||
- name: Cronmails - Add monthly test mail
|
||||
become: true
|
||||
ansible.builtin.cron:
|
||||
name: "Monthly Test Mail"
|
||||
minute: "0"
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
# - none
|
||||
|
||||
# Detect some more host facts
|
||||
- name: docker - Detect architecture
|
||||
- name: Docker - Detect architecture
|
||||
ansible.builtin.shell: dpkg --print-architecture
|
||||
register: dpkg_arch
|
||||
|
||||
# Install docker CE
|
||||
- name: docker - Install docker CE APT dependencies
|
||||
become: yes
|
||||
- name: Docker - Install docker CE APT dependencies
|
||||
become: true
|
||||
ansible.builtin.apt:
|
||||
name: "{{ packages }}"
|
||||
state: present
|
||||
|
@ -21,40 +21,42 @@
|
|||
- curl
|
||||
- gnupg2
|
||||
- software-properties-common
|
||||
- name: docker - Add docker CE repo key
|
||||
become: yes
|
||||
diff: false
|
||||
- name: Docker - Add docker CE repo key
|
||||
become: true
|
||||
ansible.builtin.apt_key:
|
||||
url: https://download.docker.com/linux/debian/gpg
|
||||
state: present
|
||||
|
||||
# IMPORTANT: raspbian needs deb [arch=armhf] https://download.docker.com/linux/raspbian ...
|
||||
- name: docker - Add docker CE repo (Debian)
|
||||
- name: Docker - Add docker CE repo (Debian)
|
||||
when: ansible_facts['lsb']['id'] != "Raspbian"
|
||||
become: yes
|
||||
become: true
|
||||
ansible.builtin.apt_repository:
|
||||
repo: "deb [arch={{ dpkg_arch.stdout }}] https://download.docker.com/linux/debian {{ ansible_distribution_release }} stable"
|
||||
state: present
|
||||
- name: docker - Add docker CE repo (Raspbian)
|
||||
- name: Docker - Add docker CE repo (Raspbian)
|
||||
when: ansible_facts['lsb']['id'] == "Raspbian"
|
||||
become: yes
|
||||
become: true
|
||||
ansible.builtin.apt_repository:
|
||||
repo: "deb [arch={{ dpkg_arch.stdout }}] https://download.docker.com/linux/raspbian {{ ansible_distribution_release }} stable"
|
||||
state: present
|
||||
|
||||
- name: docker - Install docker CE
|
||||
become: yes
|
||||
- name: Docker - Install docker CE
|
||||
become: true
|
||||
ansible.builtin.apt:
|
||||
name: docker-ce
|
||||
state: latest
|
||||
install_recommends: no
|
||||
update_cache: yes
|
||||
install_recommends: false
|
||||
update_cache: true
|
||||
cache_valid_time: "3600"
|
||||
diff: false
|
||||
|
||||
# Just always use the python package, because the ansible module won't work otherwise
|
||||
- name: docker-compose - Install python package
|
||||
- name: Docker-compose - Install python package
|
||||
block:
|
||||
- name: docker-compose - Install requirements
|
||||
become: yes
|
||||
- name: Docker-compose - Install requirements
|
||||
become: true
|
||||
ansible.builtin.apt:
|
||||
name: "{{ packages }}"
|
||||
state: present
|
||||
|
@ -62,8 +64,9 @@
|
|||
packages:
|
||||
- python3-pip
|
||||
- python3-setuptools
|
||||
- name: docker-compose - Install using pip3
|
||||
become: yes
|
||||
diff: false
|
||||
- name: Docker-compose - Install using pip3
|
||||
become: true
|
||||
ansible.builtin.pip:
|
||||
name: docker-compose
|
||||
executable: pip3
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# Variables:
|
||||
# - none
|
||||
|
||||
- name: docker - Install
|
||||
- name: Docker - Install
|
||||
ansible.builtin.include_tasks: "{{ item }}"
|
||||
with_first_found:
|
||||
- "docker-{{ ansible_distribution }}.{{ ansible_distribution_release }}.yml"
|
||||
|
@ -11,9 +11,9 @@
|
|||
- "docker-{{ ansible_os_family }}.yml"
|
||||
|
||||
# Other setup tasks
|
||||
- name: docker - Add standard user to docker group
|
||||
become: yes
|
||||
- name: Docker - Add standard user to docker group
|
||||
become: true
|
||||
ansible.builtin.user:
|
||||
name: "{{ ansible_user_id }}"
|
||||
groups: docker
|
||||
append: yes
|
||||
append: true
|
||||
|
|
|
@ -1,22 +1,23 @@
|
|||
---
|
||||
# Server/Dyndns: Setup dynDNS Script
|
||||
|
||||
- name: dyndns - Install needed tools
|
||||
become: yes
|
||||
- name: Dyndns - Install needed tools
|
||||
become: true
|
||||
ansible.builtin.package:
|
||||
name: curl
|
||||
state: present
|
||||
diff: false
|
||||
|
||||
- name: dyndns - Copy dynDNS script
|
||||
become: yes
|
||||
- name: Dyndns - Copy dynDNS script
|
||||
become: true
|
||||
ansible.builtin.template:
|
||||
src: "{{ role_path }}/templates/ddns-hosts.sh"
|
||||
dest: /usr/local/bin/ddns-hosts.sh
|
||||
owner: "{{ ansible_user_id }}"
|
||||
group: "{{ ansible_user_id }}"
|
||||
mode: 0775
|
||||
- name: "dyndns - Create cronjob for {{ ddns_zone }} dynDNS script"
|
||||
become: yes
|
||||
mode: "0775"
|
||||
- name: "Dyndns - Create cronjob for {{ ddns_zone }} dynDNS script"
|
||||
become: true
|
||||
ansible.builtin.cron:
|
||||
name: "{{ ddns_zone }} dynDNS"
|
||||
minute: "*/5"
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
|
||||
# SSH
|
||||
- name: setup - Copy sshd_config
|
||||
become: yes
|
||||
become: true
|
||||
ansible.builtin.template:
|
||||
src: "{{ role_path }}/templates/sshd_config.j2"
|
||||
dest: "/etc/ssh/sshd_config"
|
||||
backup: yes
|
||||
backup: true
|
||||
notify:
|
||||
- Restart sshd
|
||||
|
|
|
@ -1,18 +1,19 @@
|
|||
---
|
||||
# Server/Telegraf: Install and Setup Telegraf Monitoring - CentOS Version
|
||||
|
||||
- name: telegraf - Add telegraf repo
|
||||
- name: Telegraf - Add telegraf repo
|
||||
become: true
|
||||
ansible.builtin.yum_repository:
|
||||
name: influxdb
|
||||
description: InfluxDB Repository
|
||||
baseurl: https://repos.influxdata.com/rhel/7/\$basearch/stable
|
||||
enabled: yes
|
||||
gpgcheck: yes
|
||||
enabled: true
|
||||
gpgcheck: true
|
||||
gpgkey: https://repos.influxdata.com/influxdata-archive_compat.key
|
||||
- name: telegraf - Install telegraf
|
||||
- name: Telegraf - Install telegraf
|
||||
become: true
|
||||
ansible.builtin.yum:
|
||||
name: telegraf
|
||||
state: latest
|
||||
update_cache: yes
|
||||
update_cache: true
|
||||
diff: false
|
||||
|
|
|
@ -1,33 +1,35 @@
|
|||
---
|
||||
# Server/Telegraf: Install and Setup Telegraf Monitoring - Debian Version
|
||||
|
||||
- name: telegraf - Install apt-transport-https
|
||||
become: yes
|
||||
- name: Telegraf - Install apt-transport-https
|
||||
become: true
|
||||
ansible.builtin.apt:
|
||||
name: apt-transport-https
|
||||
state: present
|
||||
- name: telegraf - Add telegraf repo key
|
||||
become: yes
|
||||
diff: false
|
||||
- name: Telegraf - Add telegraf repo key
|
||||
become: true
|
||||
ansible.builtin.apt_key:
|
||||
url: https://repos.influxdata.com/influxdata-archive_compat.key
|
||||
state: present
|
||||
- name: telegraf - Add telegraf repo
|
||||
become: yes
|
||||
- name: Telegraf - Add telegraf repo
|
||||
become: true
|
||||
ansible.builtin.apt_repository:
|
||||
repo: "deb https://repos.influxdata.com/debian {{ ansible_distribution_release }} stable"
|
||||
state: present
|
||||
- name: telegraf - Install telegraf
|
||||
become: yes
|
||||
- name: Telegraf - Install telegraf
|
||||
become: true
|
||||
ansible.builtin.apt:
|
||||
name: telegraf
|
||||
state: latest
|
||||
update_cache: yes
|
||||
update_cache: true
|
||||
cache_valid_time: 3600
|
||||
diff: false
|
||||
|
||||
# Install SNMP utilities for telegraf monitoring
|
||||
- name: telegraf - Install SNMP utilities
|
||||
- name: Telegraf - Install SNMP utilities
|
||||
when: telegraf_ubnt_ns_ips is defined
|
||||
become: yes
|
||||
become: true
|
||||
ansible.builtin.apt:
|
||||
name: "{{ packages }}"
|
||||
state: present
|
||||
|
@ -35,3 +37,4 @@
|
|||
packages:
|
||||
- snmp
|
||||
- snmp-mibs-downloader
|
||||
diff: false
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
---
|
||||
# Server/Telegraf: Install and Setup Telegraf Monitoring - FreeBSD Version
|
||||
|
||||
- name: telegraf - Install telegraf
|
||||
become: yes
|
||||
- name: Telegraf - Install telegraf
|
||||
become: true
|
||||
ansible.builtin.package:
|
||||
name: telegraf
|
||||
state: latest
|
||||
diff: false
|
||||
|
||||
# # Install SNMP utilities for telegraf monitoring
|
||||
# - name: telegraf - Install SNMP utilities
|
||||
# - name: Telegraf - Install SNMP utilities
|
||||
# when: telegraf_ubnt_ns_ips is defined
|
||||
# become: yes
|
||||
# become: true
|
||||
# ansible.builtin.package:
|
||||
# name: "{{ packages }}"
|
||||
# state: present
|
||||
|
@ -18,10 +19,11 @@
|
|||
# packages:
|
||||
# - snmp
|
||||
# - snmp-mibs-downloader
|
||||
# diff: false
|
||||
|
||||
- name: telegraf - Install SNMP utilities
|
||||
- name: Telegraf - Install SNMP utilities
|
||||
when: telegraf_ubnt_ns_ips is defined
|
||||
become: yes
|
||||
become: true
|
||||
ansible.builtin.package:
|
||||
name: "{{ packages }}"
|
||||
state: present
|
||||
|
@ -29,3 +31,4 @@
|
|||
packages:
|
||||
- snmp
|
||||
- snmp-mibs-downloader
|
||||
diff: false
|
||||
|
|
|
@ -2,17 +2,17 @@
|
|||
# Server/Telegraf: Install and Setup Telegraf Monitoring
|
||||
|
||||
# Install
|
||||
- name: telegraf - Install telegraf
|
||||
- name: Telegraf - Install telegraf
|
||||
ansible.builtin.include_tasks: "{{ item }}"
|
||||
with_first_found:
|
||||
- "telegraf-{{ ansible_distribution }}.{{ ansible_distribution_release }}.yml"
|
||||
- "telegraf-{{ ansible_distribution }}.yml"
|
||||
- "telegraf-{{ (override_os_family is defined) | ternary(override_os_family,ansible_os_family) }}.yml"
|
||||
- "telegraf-{{ (override_os_family is defined) | ternary(override_os_family, ansible_os_family) }}.yml"
|
||||
|
||||
# Install SNMP MIBs
|
||||
- name: telegraf - Install SNMP MIBs
|
||||
- name: Telegraf - Install SNMP MIBs
|
||||
when: telegraf_ubnt_ns_ips is defined
|
||||
become: yes
|
||||
become: true
|
||||
block:
|
||||
- name: SNMP - Download and install Ubiquiti MIB
|
||||
ansible.builtin.copy:
|
||||
|
@ -33,23 +33,23 @@
|
|||
create: yes
|
||||
|
||||
# Configure
|
||||
- name: telegraf - Copy telegraf config (Linux)
|
||||
when: (override_os_family is defined) | ternary(override_os_family,ansible_os_family) != "FreeBSD"
|
||||
become: yes
|
||||
- name: Telegraf - Copy telegraf config (Linux)
|
||||
when: (override_os_family is defined) | ternary(override_os_family, ansible_os_family) != "FreeBSD"
|
||||
become: true
|
||||
ansible.builtin.template:
|
||||
src: "{{ role_path }}/templates/telegraf.conf.j2"
|
||||
dest: /etc/telegraf/telegraf.conf
|
||||
|
||||
- name: telegraf - Copy telegraf config (FreeBSD)
|
||||
when: (override_os_family is defined) | ternary(override_os_family,ansible_os_family) == "FreeBSD"
|
||||
become: yes
|
||||
- name: Telegraf - Copy telegraf config (FreeBSD)
|
||||
when: (override_os_family is defined) | ternary(override_os_family, ansible_os_family) == "FreeBSD"
|
||||
become: true
|
||||
ansible.builtin.template:
|
||||
src: "{{ role_path }}/templates/telegraf.conf.j2"
|
||||
dest: /usr/local/etc/telegraf.conf
|
||||
|
||||
- name: telegraf - Enable and restart telegraf
|
||||
become: yes
|
||||
- name: Telegraf - Enable and restart telegraf
|
||||
become: true
|
||||
ansible.builtin.service:
|
||||
name: telegraf
|
||||
state: restarted
|
||||
enabled: yes
|
||||
enabled: true
|
||||
|
|
Loading…
Reference in a new issue