From d95b290a59f41bd1f85794233f6d78371e3a56f1 Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Thu, 17 May 2018 14:08:17 +0200 Subject: [PATCH 1/2] Make it possible to upload custom (utility) scripts Fixes #4 --- .travis.yml | 1 + README.md | 9 +++++++++ defaults/main.yml | 3 +++ tasks/main.yml | 7 +++++++ tasks/scripts.yml | 10 ++++++++++ 5 files changed, 30 insertions(+) create mode 100644 tasks/scripts.yml diff --git a/.travis.yml b/.travis.yml index 4548937..bd547de 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ python: "2.7" env: - ANSIBLE_VERSION=latest + - ANSIBLE_VERSION=2.5.2 - ANSIBLE_VERSION=2.5.1 - ANSIBLE_VERSION=2.5.0 - ANSIBLE_VERSION=2.4.4.0 diff --git a/README.md b/README.md index c0a8d19..fc0cba1 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,15 @@ None * `percona_toolkit_table_checksum.ignore_databases`: [optional]: Ignore this list of databases (e.g. `['information_schema', 'common_schema']`) * `percona_toolkit_table_checksum.opts`: [optional, default: `[]`]: Additional options +##### (Custom) scripts + +* `percona_toolkit_script_map`: [default: `[]`]: Script declarations +* `percona_toolkit_script_map.{n}.src`: The local path of the file to copy, can be absolute or relative (e.g. `../../../files/percona-toolkit/usr/local/bin/pt-truncate-database.sh`) +* `percona_toolkit_script_map.{n}.dest`: The remote path of the file to copy (e.g. `/usr/local/bin/pt-truncate-database`) +* `percona_toolkit_script_map.{n}.owner`: The name of the user that should own the file (optional, default `root`) +* `percona_toolkit_script_map.{n}.group`: The name of the group that should own the file (optional, default `root`) +* `percona_toolkit_script_map.{n}.mode`: The mode of the file, such as 0644 (optional, default `0755`) + ## Dependencies None diff --git a/defaults/main.yml b/defaults/main.yml index 2a767b9..3c560d6 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,6 +1,9 @@ # defaults file for percona-toolkit --- percona_toolkit_cron_jobs: [] + percona_toolkit_deadlock_logger: {} percona_toolkit_heartbeat: {} percona_toolkit_table_checksum: {} + +percona_toolkit_script_map: [] diff --git a/tasks/main.yml b/tasks/main.yml index c0b94ff..3ecce78 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -18,6 +18,13 @@ - percona-toolkit - percona-toolkit-configure +- include: scripts.yml + tags: + - configuration + - tools + - percona-toolkit + - percona-toolkit-scripts + - include: jobs.yml tags: - configuration diff --git a/tasks/scripts.yml b/tasks/scripts.yml new file mode 100644 index 0000000..71f091a --- /dev/null +++ b/tasks/scripts.yml @@ -0,0 +1,10 @@ +# tasks file for percona-server-tools +--- +- name: scripts | copy files + copy: + src: "{{ item.src }}" + dest: "{{ item.dest }}" + owner: "{{ item.owner | default('root') }}" + group: "{{ item.group | default('root') }}" + mode: "{{ item.mode | default('0755') }}" + with_items: "{{ percona_toolkit_script_map }}" From 61b4016b1073b6bd52962118b7f5d0009a8c5b9d Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Thu, 17 May 2018 14:44:28 +0200 Subject: [PATCH 2/2] Fix incorrect tag [ci skip] --- tasks/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/tasks/main.yml b/tasks/main.yml index 3ecce78..d55a246 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -21,7 +21,6 @@ - include: scripts.yml tags: - configuration - - tools - percona-toolkit - percona-toolkit-scripts