style: make ansible-lint happier
This commit is contained in:
@@ -1,9 +1,10 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- name: restart mariadb
|
- name: Restart mariadb
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name: mariadb
|
name: mariadb
|
||||||
state: restarted
|
state: restarted
|
||||||
|
|
||||||
- name: daemon-reload
|
- name: Daemon-reload
|
||||||
command: systemctl daemon-reload
|
ansible.builtin.systemd:
|
||||||
|
daemon_reload: true
|
||||||
|
@@ -1,67 +1,69 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- name: install mariadb
|
- name: Install mariadb
|
||||||
package:
|
ansible.builtin.package:
|
||||||
name: mariadb-server
|
name: mariadb-server
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: create mysql directory
|
- name: Create mysql directory
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: /srv/mysql
|
path: /srv/mysql
|
||||||
owner: mysql
|
owner: mysql
|
||||||
group: mysql
|
group: mysql
|
||||||
state: directory
|
state: directory
|
||||||
|
mode: 0755
|
||||||
|
|
||||||
- name: populate mysql directory
|
- name: Populate mysql directory
|
||||||
command: /usr/bin/mysql_install_db --datadir=/srv/mysql
|
ansible.builtin.command:
|
||||||
args:
|
cmd: /usr/bin/mysql_install_db --datadir=/srv/mysql
|
||||||
creates: /srv/mysql/ibdata1
|
creates: /srv/mysql/ibdata1
|
||||||
notify: restart mariadb
|
notify: Restart mariadb
|
||||||
|
|
||||||
- name: replace conffile
|
- name: Replace conffile
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: 50-server.cnf.j2
|
src: 50-server.cnf.j2
|
||||||
dest: /etc/mysql/mariadb.conf.d/50-server.cnf
|
dest: /etc/mysql/mariadb.conf.d/50-server.cnf
|
||||||
notify: restart mariadb
|
mode: 0644
|
||||||
|
notify: Restart mariadb
|
||||||
|
|
||||||
- name: debian upgrade file conf
|
- name: Debian upgrade file conf
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: debian.cnf.j2
|
src: debian.cnf.j2
|
||||||
dest: /etc/mysql/debian.cnf
|
dest: /etc/mysql/debian.cnf
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: '0600'
|
mode: '0600'
|
||||||
notify: restart mariadb
|
notify: Restart mariadb
|
||||||
|
|
||||||
- name: force handlers
|
- name: Force handlers
|
||||||
meta: flush_handlers
|
ansible.builtin.meta: flush_handlers
|
||||||
|
|
||||||
- name: install python-mysql
|
- name: Install python-mysql
|
||||||
package:
|
ansible.builtin.package:
|
||||||
name: python3-pymysql
|
name: python3-pymysql
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: check if .my.cnf file exists
|
- name: Check if .my.cnf file exists
|
||||||
stat:
|
ansible.builtin.stat:
|
||||||
path: /root/.my.cnf
|
path: /root/.my.cnf
|
||||||
register: dot_my_cnf
|
register: dot_my_cnf
|
||||||
|
|
||||||
- name: root password
|
- name: Root password
|
||||||
mysql_user:
|
community.mysql.mysql_user:
|
||||||
login_unix_socket: "/var/run/mysqld/mysqld.sock"
|
login_unix_socket: "/var/run/mysqld/mysqld.sock"
|
||||||
host: localhost
|
host: localhost
|
||||||
name: root
|
name: root
|
||||||
password: "{{ mariadb_root_pass }}"
|
password: "{{ mariadb_root_pass }}"
|
||||||
when: dot_my_cnf.stat.exists == False
|
when: not dot_my_cnf.stat.exists
|
||||||
|
|
||||||
- name: put .my.cnf file
|
- name: Put .my.cnf file
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: dot.my.cnf.j2
|
src: dot.my.cnf.j2
|
||||||
dest: ~/.my.cnf
|
dest: ~/.my.cnf
|
||||||
mode: '0600'
|
mode: '0600'
|
||||||
|
|
||||||
- name: root password (follow-up)
|
- name: Root password (follow-up)
|
||||||
mysql_user:
|
community.mysql.mysql_user:
|
||||||
login_user: root
|
login_user: root
|
||||||
host: "{{ item }}"
|
host: "{{ item }}"
|
||||||
name: root
|
name: root
|
||||||
@@ -71,9 +73,9 @@
|
|||||||
- "127.0.0.1"
|
- "127.0.0.1"
|
||||||
- "::1"
|
- "::1"
|
||||||
|
|
||||||
- name: scripted version of mysql_secure_installation
|
- name: Scripted version of mysql_secure_installation
|
||||||
shell: "{{ item }}"
|
ansible.builtin.command:
|
||||||
args:
|
cmd: "{{ item }}"
|
||||||
creates: ~/mysql_secure_installation
|
creates: ~/mysql_secure_installation
|
||||||
loop:
|
loop:
|
||||||
- "mysql -e \"DELETE FROM mysql.user WHERE User='';\""
|
- "mysql -e \"DELETE FROM mysql.user WHERE User='';\""
|
||||||
@@ -84,27 +86,28 @@
|
|||||||
- touch ~/mysql_secure_installation
|
- touch ~/mysql_secure_installation
|
||||||
|
|
||||||
- name: Create MariaDB service dir
|
- name: Create MariaDB service dir
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: /etc/systemd/system/mariadb.service.d/
|
path: /etc/systemd/system/mariadb.service.d/
|
||||||
state: directory
|
state: directory
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
|
||||||
- name: Create MariaDB service override
|
- name: Create MariaDB service override
|
||||||
copy:
|
ansible.builtin.copy:
|
||||||
src: files/override.conf
|
src: files/override.conf
|
||||||
dest: /etc/systemd/system/mariadb.service.d/override.conf
|
dest: /etc/systemd/system/mariadb.service.d/override.conf
|
||||||
|
mode: 0644
|
||||||
notify:
|
notify:
|
||||||
- restart mariadb
|
- Restart mariadb
|
||||||
- daemon-reload
|
- Daemon-reload
|
||||||
|
|
||||||
- name: install backup script
|
- name: Install backup script
|
||||||
copy:
|
ansible.builtin.copy:
|
||||||
src: files/backup_mysql.sh
|
src: files/backup_mysql.sh
|
||||||
dest: /usr/local/bin/backup_mysql.sh
|
dest: /usr/local/bin/backup_mysql.sh
|
||||||
mode: '0755'
|
mode: '0755'
|
||||||
|
|
||||||
- name: cron backup script
|
- name: Cron backup script
|
||||||
cron:
|
ansible.builtin.cron:
|
||||||
name: "MariaDB backup"
|
name: "MariaDB backup"
|
||||||
hour: "{{ mariadb_backup_hour }}"
|
hour: "{{ mariadb_backup_hour }}"
|
||||||
minute: "{{ mariadb_backup_minute }}"
|
minute: "{{ mariadb_backup_minute }}"
|
||||||
|
@@ -1,39 +1,41 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- name: install nodejs
|
- name: Install nodejs
|
||||||
include_tasks: nodejs.yml
|
ansible.builtin.include_tasks: nodejs.yml
|
||||||
|
|
||||||
- name: install yarn
|
- name: Install yarn
|
||||||
include_tasks: yarn.yml
|
ansible.builtin.include_tasks: yarn.yml
|
||||||
|
|
||||||
- name: install redis
|
- name: Install redis
|
||||||
include_tasks: redis.yml
|
ansible.builtin.include_tasks: redis.yml
|
||||||
|
|
||||||
- name: mastodon user
|
- name: Mastodon user
|
||||||
user:
|
ansible.builtin.user:
|
||||||
name: mastodon
|
name: mastodon
|
||||||
comment: "John Mastodon"
|
comment: "John Mastodon"
|
||||||
password: '!'
|
password: '!'
|
||||||
shell: /bin/bash
|
shell: /bin/bash
|
||||||
home: "{{ mastodon_home }}"
|
home: "{{ mastodon_home }}"
|
||||||
|
|
||||||
- name: mastodon .ssh dir
|
- name: Mastodon .ssh dir
|
||||||
file:
|
ansible.builtin.file:
|
||||||
state: directory
|
state: directory
|
||||||
path: "{{ mastodon_home }}/.ssh"
|
path: "{{ mastodon_home }}/.ssh"
|
||||||
|
mode: 0755
|
||||||
owner: mastodon
|
owner: mastodon
|
||||||
group: mastodon
|
group: mastodon
|
||||||
|
|
||||||
- name: ssh for mastodon user
|
- name: Ssh for mastodon user
|
||||||
copy:
|
ansible.builtin.copy:
|
||||||
remote_src: true
|
remote_src: true
|
||||||
src: /root/.ssh/authorized_keys
|
src: /root/.ssh/authorized_keys
|
||||||
dest: "{{ mastodon_home }}/.ssh/authorized_keys"
|
dest: "{{ mastodon_home }}/.ssh/authorized_keys"
|
||||||
|
mode: 0644
|
||||||
owner: mastodon
|
owner: mastodon
|
||||||
group: mastodon
|
group: mastodon
|
||||||
|
|
||||||
- name: install prereq
|
- name: Install prereq
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
state: present
|
state: present
|
||||||
loop:
|
loop:
|
||||||
@@ -64,8 +66,8 @@
|
|||||||
- libicu-dev
|
- libicu-dev
|
||||||
- libjemalloc-dev
|
- libjemalloc-dev
|
||||||
|
|
||||||
- name: install rbenv
|
- name: Install rbenv
|
||||||
include_tasks: rbenv.yml
|
ansible.builtin.include_tasks: rbenv.yml
|
||||||
|
|
||||||
- name: install mastodon
|
- name: Install mastodon
|
||||||
include_tasks: mastodon.yml
|
ansible.builtin.include_tasks: mastodon.yml
|
||||||
|
@@ -1,44 +1,46 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- name: git mastodon
|
- name: Git mastodon
|
||||||
remote_user: mastodon
|
remote_user: mastodon
|
||||||
git:
|
ansible.builtin.git:
|
||||||
repo: "https://github.com/mastodon/mastodon.git"
|
repo: "https://github.com/mastodon/mastodon.git"
|
||||||
dest: "{{ mastodon_home }}/live"
|
dest: "{{ mastodon_home }}/live"
|
||||||
version: "v{{ mastodon_version }}"
|
version: "v{{ mastodon_version }}"
|
||||||
|
|
||||||
- name: bundle config command
|
- name: Bundle config command
|
||||||
remote_user: mastodon
|
remote_user: mastodon
|
||||||
shell: |
|
ansible.builtin.command:
|
||||||
bash -lic "bundle config deployment 'true' && bundle config without 'development test'"
|
cmd: |
|
||||||
args:
|
bash -lic "bundle config deployment 'true' && bundle config without 'development test'"
|
||||||
creates: "{{ mastodon_home }}/.bundle/config"
|
creates: "{{ mastodon_home }}/.bundle/config"
|
||||||
chdir: "{{ mastodon_home }}/live"
|
chdir: "{{ mastodon_home }}/live"
|
||||||
|
|
||||||
- name: bundle install
|
- name: Bundle install
|
||||||
remote_user: mastodon
|
remote_user: mastodon
|
||||||
shell: |
|
ansible.builtin.command:
|
||||||
bash -lic "bundle install -j$(getconf _NPROCESSORS_ONLN)"
|
cmd: |
|
||||||
args:
|
bash -lic "bundle install -j$(getconf _NPROCESSORS_ONLN)"
|
||||||
chdir: "{{ mastodon_home }}/live"
|
chdir: "{{ mastodon_home }}/live"
|
||||||
|
changed_when: true
|
||||||
|
|
||||||
- name: yarn install
|
- name: Yarn install
|
||||||
remote_user: mastodon
|
remote_user: mastodon
|
||||||
shell: |
|
ansible.builtin.command:
|
||||||
bash -lic "yarn install --pure-lockfile"
|
cmd: |
|
||||||
args:
|
bash -lic "yarn install --pure-lockfile"
|
||||||
chdir: "{{ mastodon_home }}/live"
|
chdir: "{{ mastodon_home }}/live"
|
||||||
|
changed_when: true
|
||||||
|
|
||||||
- name: create bin dir
|
- name: Create bin dir
|
||||||
remote_user: mastodon
|
remote_user: mastodon
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "{{ mastodon_home }}/bin"
|
path: "{{ mastodon_home }}/bin"
|
||||||
state: directory
|
state: directory
|
||||||
mode: '0750'
|
mode: '0750'
|
||||||
|
|
||||||
- name: template scripts
|
- name: Template scripts
|
||||||
remote_user: mastodon
|
remote_user: mastodon
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: "{{ item }}.j2"
|
src: "{{ item }}.j2"
|
||||||
dest: "{{ mastodon_home }}/bin/{{ item }}"
|
dest: "{{ mastodon_home }}/bin/{{ item }}"
|
||||||
mode: '0750'
|
mode: '0750'
|
||||||
@@ -46,17 +48,18 @@
|
|||||||
- remove_media.sh
|
- remove_media.sh
|
||||||
- remove_preview_cards.sh
|
- remove_preview_cards.sh
|
||||||
|
|
||||||
- name: install services
|
- name: Install services
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: "{{ item }}.j2"
|
src: "{{ item }}.j2"
|
||||||
dest: "/etc/systemd/system/{{ item }}"
|
dest: "/etc/systemd/system/{{ item }}"
|
||||||
|
mode: 0644
|
||||||
loop: &mastodon_services
|
loop: &mastodon_services
|
||||||
- "mastodon-sidekiq.service"
|
- "mastodon-sidekiq.service"
|
||||||
- "mastodon-streaming.service"
|
- "mastodon-streaming.service"
|
||||||
- "mastodon-web.service"
|
- "mastodon-web.service"
|
||||||
|
|
||||||
- name: run services
|
- name: Run services
|
||||||
systemd:
|
ansible.builtin.systemd:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
daemon_reload: true
|
daemon_reload: true
|
||||||
state: started
|
state: started
|
||||||
|
@@ -1,21 +1,25 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- name: get node source gpg url
|
- name: Get node source gpg url
|
||||||
get_url:
|
ansible.builtin.get_url:
|
||||||
url: "{{ mastodon_nodejs_key_url }}"
|
url: "{{ mastodon_nodejs_key_url }}"
|
||||||
dest: /tmp/nodesource.gpg.key
|
dest: /tmp/nodesource.gpg.key
|
||||||
force: true
|
force: true
|
||||||
|
mode: 0644
|
||||||
|
|
||||||
- name: gpg dearmor key
|
- name: Gpg dearmor key
|
||||||
shell: "gpg --dearmor --yes -o {{ mastodon_nodejs_key_path }} /tmp/nodesource.gpg.key"
|
ansible.builtin.command:
|
||||||
|
cmd: "gpg --dearmor --yes -o {{ mastodon_nodejs_key_path }} /tmp/nodesource.gpg.key"
|
||||||
|
changed_when: true
|
||||||
|
|
||||||
- name: node source repo
|
- name: Node source repo
|
||||||
copy:
|
ansible.builtin.copy:
|
||||||
content: "deb [signed-by={{ mastodon_nodejs_key_path }}] https://deb.nodesource.com/node_16.x {{ ansible_facts['distribution_release'] }} main"
|
content: "deb [signed-by={{ mastodon_nodejs_key_path }}] https://deb.nodesource.com/node_16.x {{ ansible_facts['distribution_release'] }} main"
|
||||||
dest: /etc/apt/sources.list.d/nodesource.list
|
dest: /etc/apt/sources.list.d/nodesource.list
|
||||||
|
mode: 0644
|
||||||
|
|
||||||
- name: install nodejs
|
- name: Install nodejs
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
name: nodejs
|
name: nodejs
|
||||||
state: present
|
state: present
|
||||||
update_cache: true
|
update_cache: true
|
||||||
|
@@ -1,38 +1,39 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- name: git rbenv
|
- name: Git rbenv
|
||||||
remote_user: mastodon
|
remote_user: mastodon
|
||||||
git:
|
ansible.builtin.git:
|
||||||
repo: "https://github.com/rbenv/rbenv.git"
|
repo: "https://github.com/rbenv/rbenv.git"
|
||||||
dest: "{{ mastodon_home }}/.rbenv"
|
dest: "{{ mastodon_home }}/.rbenv"
|
||||||
single_branch: true
|
single_branch: true
|
||||||
version: master
|
version: master
|
||||||
|
|
||||||
- name: git ruby-build
|
- name: Git ruby-build
|
||||||
remote_user: mastodon
|
remote_user: mastodon
|
||||||
git:
|
ansible.builtin.git:
|
||||||
repo: https://github.com/rbenv/ruby-build.git
|
repo: https://github.com/rbenv/ruby-build.git
|
||||||
dest: "{{ mastodon_home }}/.rbenv/plugins/ruby-build"
|
dest: "{{ mastodon_home }}/.rbenv/plugins/ruby-build"
|
||||||
single_branch: true
|
single_branch: true
|
||||||
version: master
|
version: master
|
||||||
|
|
||||||
- name: append env to mastodon bashrc
|
- name: Append env to mastodon bashrc
|
||||||
remote_user: mastodon
|
remote_user: mastodon
|
||||||
lineinfile:
|
ansible.builtin.lineinfile:
|
||||||
path: "{{ mastodon_home }}/.bashrc"
|
path: "{{ mastodon_home }}/.bashrc"
|
||||||
line: "eval \"$({{ mastodon_home }}/.rbenv/bin/rbenv init - bash)\""
|
line: "eval \"$({{ mastodon_home }}/.rbenv/bin/rbenv init - bash)\""
|
||||||
|
|
||||||
- name: install ruby version
|
- name: Install ruby version
|
||||||
remote_user: mastodon
|
remote_user: mastodon
|
||||||
shell: "bash -lic 'rbenv install {{ mastodon_ruby_version }}'"
|
ansible.builtin.shell: "bash -lic 'rbenv install {{ mastodon_ruby_version }}'"
|
||||||
args:
|
args:
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
creates: "~/.rbenv/versions/{{ mastodon_ruby_version }}/bin/ruby"
|
creates: "~/.rbenv/versions/{{ mastodon_ruby_version }}/bin/ruby"
|
||||||
environment:
|
environment:
|
||||||
RUBY_CONFIGURE_OPTS: "--with-jemalloc"
|
RUBY_CONFIGURE_OPTS: "--with-jemalloc"
|
||||||
|
|
||||||
- name: install bundler for ruby
|
- name: Install bundler for ruby
|
||||||
remote_user: mastodon
|
remote_user: mastodon
|
||||||
shell: "bash -lic 'rbenv global {{ mastodon_ruby_version }} && ruby --version && gem install bundler --no-document'"
|
ansible.builtin.shell: "bash -lic 'rbenv global {{ mastodon_ruby_version }} && ruby --version && gem install bundler --no-document'"
|
||||||
|
changed_when: true
|
||||||
args:
|
args:
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
|
@@ -1,12 +1,12 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- name: install redis
|
- name: Install redis
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
name: redis
|
name: redis
|
||||||
state: present
|
state: present
|
||||||
update_cache: true
|
update_cache: true
|
||||||
|
|
||||||
- name: start redis service
|
- name: Start redis service
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name: redis
|
name: redis
|
||||||
state: started
|
state: started
|
||||||
|
@@ -1,21 +1,25 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- name: get yarn gpg url
|
- name: Get yarn gpg url
|
||||||
get_url:
|
ansible.builtin.get_url:
|
||||||
url: "{{ mastodon_yarn_key_url }}"
|
url: "{{ mastodon_yarn_key_url }}"
|
||||||
dest: /tmp/yarn.gpg.key
|
dest: /tmp/yarn.gpg.key
|
||||||
|
mode: 0644
|
||||||
force: true
|
force: true
|
||||||
|
|
||||||
- name: gpg dearmor key
|
- name: Gpg dearmor key
|
||||||
shell: "gpg --dearmor --yes -o {{ mastodon_yarn_key_path }} /tmp/yarn.gpg.key"
|
ansible.builtin.command:
|
||||||
|
cmd: "gpg --dearmor --yes -o {{ mastodon_yarn_key_path }} /tmp/yarn.gpg.key"
|
||||||
|
changed_when: true
|
||||||
|
|
||||||
- name: yarn source repo
|
- name: Yarn source repo
|
||||||
copy:
|
ansible.builtin.copy:
|
||||||
content: "deb [signed-by={{ mastodon_yarn_key_path }}] https://dl.yarnpkg.com/debian stable main"
|
content: "deb [signed-by={{ mastodon_yarn_key_path }}] https://dl.yarnpkg.com/debian stable main"
|
||||||
dest: /etc/apt/sources.list.d/yarn.list
|
dest: /etc/apt/sources.list.d/yarn.list
|
||||||
|
mode: 0644
|
||||||
|
|
||||||
- name: install yarn
|
- name: Install yarn
|
||||||
apt:
|
ansible.builtin.apt:
|
||||||
name: yarn
|
name: yarn
|
||||||
state: present
|
state: present
|
||||||
update_cache: true
|
update_cache: true
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- name: restart mumble
|
- name: Restart mumble
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name: mumble-server
|
name: mumble-server
|
||||||
state: restarted
|
state: restarted
|
||||||
|
@@ -1,13 +1,14 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- name: install mumble
|
- name: Install mumble
|
||||||
package:
|
ansible.builtin.package:
|
||||||
name: mumble-server
|
name: mumble-server
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: configuration files
|
- name: Configuration files
|
||||||
copy:
|
ansible.builtin.copy:
|
||||||
src: ./files/mumble-server.ini
|
src: ./files/mumble-server.ini
|
||||||
dest: /etc/mumble-server.ini
|
dest: /etc/mumble-server.ini
|
||||||
|
mode: 0644
|
||||||
notify:
|
notify:
|
||||||
- restart mumble
|
- Restart mumble
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- name: restart munin-node
|
- name: Restart munin-node
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name: munin-node
|
name: munin-node
|
||||||
state: restarted
|
state: restarted
|
||||||
|
@@ -1,11 +1,15 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- name: delete squid plugins
|
- name: Delete squid plugins
|
||||||
shell: "rm -f /etc/munin/plugins/squid_*"
|
ansible.builtin.command:
|
||||||
|
cmd: "rm -f /etc/munin/plugins/squid_*"
|
||||||
|
changed_when: true
|
||||||
notify:
|
notify:
|
||||||
- restart munin-node
|
- Restart munin-node
|
||||||
|
|
||||||
- name: delete lxc interfaces plugins
|
- name: Delete lxc interfaces plugins
|
||||||
shell: "rm -f /etc/munin/plugins/if_*veth* /etc/munin/plugins/if_*fw* /etc/munin/plugins/if_*vmbr*"
|
ansible.builtin.command:
|
||||||
|
cmd: "rm -f /etc/munin/plugins/if_*veth* /etc/munin/plugins/if_*fw* /etc/munin/plugins/if_*vmbr*"
|
||||||
|
changed_when: true
|
||||||
notify:
|
notify:
|
||||||
- restart munin-node
|
- Restart munin-node
|
||||||
|
@@ -1,12 +1,14 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- set_fact:
|
- name: Set package fact
|
||||||
|
ansible.builtin.set_fact:
|
||||||
muninpkgs:
|
muninpkgs:
|
||||||
- muninlite
|
- muninlite
|
||||||
munin_need_reconfigure: false
|
munin_need_reconfigure: false
|
||||||
when: ansible_facts['distribution'] == "LEDE" or ansible_facts['distribution'] == "OpenWRT" or ansible_facts['distribution'] == "OpenWrt"
|
when: ansible_facts['distribution'] == "LEDE" or ansible_facts['distribution'] == "OpenWRT" or ansible_facts['distribution'] == "OpenWrt"
|
||||||
|
|
||||||
- set_fact:
|
- name: Set other packages fact
|
||||||
|
ansible.builtin.set_fact:
|
||||||
muninpkgs:
|
muninpkgs:
|
||||||
- munin-node
|
- munin-node
|
||||||
- munin-plugins-core
|
- munin-plugins-core
|
||||||
@@ -14,91 +16,93 @@
|
|||||||
munin_need_reconfigure: true
|
munin_need_reconfigure: true
|
||||||
when: ansible_facts['distribution'] == "Debian"
|
when: ansible_facts['distribution'] == "Debian"
|
||||||
|
|
||||||
- name: install munin node packages
|
- name: Install munin node packages
|
||||||
package:
|
ansible.builtin.package:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
state: present
|
state: present
|
||||||
loop: "{{ muninpkgs }}"
|
loop: "{{ muninpkgs }}"
|
||||||
|
|
||||||
- name: munin-node conf file
|
- name: Munin-node conf file
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: munin-node.conf.j2
|
src: munin-node.conf.j2
|
||||||
dest: /etc/munin/munin-node.conf
|
dest: /etc/munin/munin-node.conf
|
||||||
|
mode: 0644
|
||||||
notify:
|
notify:
|
||||||
- restart munin-node
|
- Restart munin-node
|
||||||
when: munin_need_reconfigure
|
when: munin_need_reconfigure
|
||||||
|
|
||||||
## Adding modules for specific functions
|
## Adding modules for specific functions
|
||||||
# for NginX webservers
|
# for NginX webservers
|
||||||
- name: install LWP::UserAgent
|
- name: Install LWP::UserAgent
|
||||||
package:
|
ansible.builtin.package:
|
||||||
name: libwww-perl
|
name: libwww-perl
|
||||||
state: present
|
state: present
|
||||||
notify:
|
notify:
|
||||||
- restart munin-node
|
- Restart munin-node
|
||||||
when: "'webservers' in group_names or 'loadbalancers' in group_names"
|
when: "'webservers' in group_names or 'loadbalancers' in group_names"
|
||||||
|
|
||||||
# for HAProxy servers
|
# for HAProxy servers
|
||||||
- name: add HAProxy backend module
|
- name: Add HAProxy backend module
|
||||||
file:
|
ansible.builtin.file:
|
||||||
src: /usr/share/munin/plugins/haproxy_
|
src: /usr/share/munin/plugins/haproxy_
|
||||||
dest: /etc/munin/plugins/haproxy_current
|
dest: /etc/munin/plugins/haproxy_current
|
||||||
state: link
|
state: link
|
||||||
notify:
|
notify:
|
||||||
- restart munin-node
|
- Restart munin-node
|
||||||
when: "'loadbalancers' in group_names"
|
when: "'loadbalancers' in group_names"
|
||||||
|
|
||||||
# For MariaDB servers
|
# For MariaDB servers
|
||||||
- name: install Cache::Cache
|
- name: Install Cache::Cache
|
||||||
package:
|
ansible.builtin.package:
|
||||||
name: libcache-cache-perl
|
name: libcache-cache-perl
|
||||||
state: present
|
state: present
|
||||||
notify:
|
notify:
|
||||||
- restart munin-node
|
- Restart munin-node
|
||||||
when: "'mariadbservers' in group_names"
|
when: "'mariadbservers' in group_names"
|
||||||
|
|
||||||
# For PGSQL servers
|
# For PGSQL servers
|
||||||
- name: install DBD::Pg
|
- name: Install DBD::Pg
|
||||||
package:
|
ansible.builtin.package:
|
||||||
name: libdbd-pg-perl
|
name: libdbd-pg-perl
|
||||||
state: present
|
state: present
|
||||||
notify:
|
notify:
|
||||||
- restart munin-node
|
- Restart munin-node
|
||||||
when: "'pgsqlservers' in group_names"
|
when: "'pgsqlservers' in group_names"
|
||||||
|
|
||||||
# For Munin servers
|
# For Munin servers
|
||||||
- name: execute specific tasks for munin servers
|
- name: Execute specific tasks for munin servers
|
||||||
include_tasks: mikrotik.yml
|
ansible.builtin.include_tasks: mikrotik.yml
|
||||||
when: "'muninservers' in group_names"
|
when: "'muninservers' in group_names"
|
||||||
|
|
||||||
# for NUT (UPS) servers
|
# for NUT (UPS) servers
|
||||||
- name: "add specific nut value for UPS"
|
- name: Add specific nut value for UPS
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "/etc/munin/plugins/nutups_eaton3s_{{ item }}"
|
path: "/etc/munin/plugins/nutups_eaton3s_{{ item }}"
|
||||||
src: /usr/share/munin/plugins/nutups_
|
src: /usr/share/munin/plugins/nutups_
|
||||||
state: link
|
state: link
|
||||||
notify:
|
notify:
|
||||||
- restart munin-node
|
- Restart munin-node
|
||||||
when: "'nut_server' in group_names"
|
when: "'nut_server' in group_names"
|
||||||
loop:
|
loop:
|
||||||
- charge
|
- charge
|
||||||
- voltages
|
- voltages
|
||||||
|
|
||||||
# for physical servers
|
# for physical servers
|
||||||
- name: execute specific tasks for physical servers
|
- name: Execute specific tasks for physical servers
|
||||||
include_tasks: physical_servers.yml
|
ansible.builtin.include_tasks: physical_servers.yml
|
||||||
when: "'hypervisors' in group_names"
|
when: "'hypervisors' in group_names"
|
||||||
|
|
||||||
- name: reconfigure munin-node
|
- name: Reconfigure munin-node
|
||||||
shell:
|
ansible.builtin.command:
|
||||||
cmd: munin-node-configure --shell | sh
|
cmd: munin-node-configure --shell | sh
|
||||||
|
changed_when: true
|
||||||
notify:
|
notify:
|
||||||
- restart munin-node
|
- Restart munin-node
|
||||||
when: munin_need_reconfigure
|
when: munin_need_reconfigure
|
||||||
|
|
||||||
## Useless junks for everyone
|
## Useless junks for everyone
|
||||||
- name: delete useless junks for everyone
|
- name: Delete useless junks for everyone
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "/etc/munin/plugins/{{ item }}"
|
path: "/etc/munin/plugins/{{ item }}"
|
||||||
state: absent
|
state: absent
|
||||||
when: munin_need_reconfigure
|
when: munin_need_reconfigure
|
||||||
@@ -106,12 +110,12 @@
|
|||||||
- users
|
- users
|
||||||
|
|
||||||
## Useless junks for LXC
|
## Useless junks for LXC
|
||||||
- name: "delete junks from LXC machines"
|
- name: "Delete junks from LXC machines"
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "/etc/munin/plugins/{{ item }}"
|
path: "/etc/munin/plugins/{{ item }}"
|
||||||
state: absent
|
state: absent
|
||||||
notify:
|
notify:
|
||||||
- restart munin-node
|
- Restart munin-node
|
||||||
when: ansible_facts['virtualization_type'] == "lxc"
|
when: ansible_facts['virtualization_type'] == "lxc"
|
||||||
loop:
|
loop:
|
||||||
- acpi
|
- acpi
|
||||||
@@ -121,6 +125,6 @@
|
|||||||
- irqstats
|
- irqstats
|
||||||
|
|
||||||
## Useless junks for hypervisors
|
## Useless junks for hypervisors
|
||||||
- name: execute delete states for hypervisors
|
- name: Execute delete states for hypervisors
|
||||||
include_tasks: hypervisors.yml
|
ansible.builtin.include_tasks: hypervisors.yml
|
||||||
when: "'hypervisors' in group_names"
|
when: "'hypervisors' in group_names"
|
||||||
|
@@ -1,21 +1,21 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- name: deploy mikrotik unitary scripts
|
- name: Deploy mikrotik unitary scripts
|
||||||
copy:
|
ansible.builtin.copy:
|
||||||
src: "./files/{{ item.0 }}"
|
src: "./files/{{ item.0 }}"
|
||||||
dest: "/etc/munin/plugins/{{ item.0 }}{{ item.1.name }}"
|
dest: "/etc/munin/plugins/{{ item.0 }}{{ item.1.name }}"
|
||||||
mode: 0755
|
mode: 0755
|
||||||
loop: "{{ mikrotik_unitary_scripts|product(mikrotik_hosts)|list }}"
|
loop: "{{ mikrotik_unitary_scripts | product(mikrotik_hosts) | list }}"
|
||||||
notify:
|
notify:
|
||||||
- restart munin-node
|
- Restart munin-node
|
||||||
|
|
||||||
- name: deploy mikrotik per iface scripts
|
- name: Deploy mikrotik per iface scripts
|
||||||
copy:
|
ansible.builtin.copy:
|
||||||
src: "./files/{{ item.1 }}"
|
src: "./files/{{ item.1 }}"
|
||||||
dest: "/etc/munin/plugins/{{ item.1 }}{{ item.0.0.name }}_{{ item.0.1 }}"
|
dest: "/etc/munin/plugins/{{ item.1 }}{{ item.0.0.name }}_{{ item.0.1 }}"
|
||||||
mode: 0755
|
mode: 0755
|
||||||
loop: "{{ mikrotik_hosts|subelements('ifaces')|product(mikrotik_periface_scripts) }}"
|
loop: "{{ mikrotik_hosts | subelements('ifaces') | product(mikrotik_periface_scripts) }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.0.1 }}"
|
label: "{{ item.0.1 }}"
|
||||||
notify:
|
notify:
|
||||||
- restart munin-node
|
- Restart munin-node
|
||||||
|
@@ -1,16 +1,16 @@
|
|||||||
---
|
---
|
||||||
# for physical servers
|
# for physical servers
|
||||||
- name: install necessary packages for hypervisors
|
- name: Install necessary packages for hypervisors
|
||||||
package:
|
ansible.builtin.package:
|
||||||
name: lm-sensors
|
name: lm-sensors
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: configure specific munin plugin
|
- name: Configure specific munin plugin
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: "/etc/munin/plugins/sensors_{{ item }}"
|
path: "/etc/munin/plugins/sensors_{{ item }}"
|
||||||
src: /usr/share/munin/plugins/sensors_
|
src: /usr/share/munin/plugins/sensors_
|
||||||
state: link
|
state: link
|
||||||
notify:
|
notify:
|
||||||
- restart munin-node
|
- Restart munin-node
|
||||||
loop:
|
loop:
|
||||||
- temp
|
- temp
|
||||||
|
@@ -1,11 +1,12 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- name: install munin packages
|
- name: Install munin packages
|
||||||
package:
|
ansible.builtin.package:
|
||||||
name: munin
|
name: munin
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: munin conf file
|
- name: Munin conf file
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: munin.conf.j2
|
src: munin.conf.j2
|
||||||
dest: /etc/munin/munin.conf
|
dest: /etc/munin/munin.conf
|
||||||
|
mode: 0644
|
||||||
|
Reference in New Issue
Block a user