Skip to content

Commit

Permalink
Add ansible.builtin fqcn to all tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
rwunderer committed Mar 16, 2022
1 parent 65d5a77 commit 6bb075b
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 31 deletions.
2 changes: 1 addition & 1 deletion handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# handlers file
---
- name: restart percona-server
service:
ansible.builtin.service:
name: mysql
state: restarted
when: service_default_state | default('started') == 'started'
2 changes: 1 addition & 1 deletion molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
become: true
pre_tasks:
- name: include vars
include_vars: "{{ playbook_dir }}/../../tests/vars/main.yml"
ansible.builtin.include_vars: "{{ playbook_dir }}/../../tests/vars/main.yml"
roles:
- ../../../
12 changes: 6 additions & 6 deletions tasks/configure.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# tasks file
---
- name: configure | copy certificate files
copy:
ansible.builtin.copy:
src: "{{ item.value.src }}"
dest: "{{ item.value.dest }}"
owner: "{{ item.value.owner | default('root') }}"
Expand All @@ -14,14 +14,14 @@

- block:
- name: configure | service | stop
service:
ansible.builtin.service:
name: mysql
state: stopped
tags:
- percona-server-configure-first-run-service-stop

- name: configure | remove (excessive) configuration files
file:
ansible.builtin.file:
path: "{{ item }}"
state: absent
with_items:
Expand All @@ -34,7 +34,7 @@
- percona-server-configure-first-run

- name: configure | update (global) configuration file
template:
ansible.builtin.template:
src: "{{ percona_server_etc_mysql_my_cnf.lstrip('/') }}.j2"
dest: "{{ percona_server_etc_mysql_my_cnf }}"
owner: root
Expand All @@ -46,7 +46,7 @@

- block:
- name: configure | service | start
service:
ansible.builtin.service:
name: mysql
state: started
tags:
Expand All @@ -56,7 +56,7 @@
- percona-server-configure-first-run

- name: configure | update (root) configuration file
template:
ansible.builtin.template:
src: root/.my.cnf.j2
dest: '~root/.my.cnf'
owner: root
Expand Down
3 changes: 2 additions & 1 deletion tasks/first-run.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# tasks file
---
- name: first-run | check
shell: >
ansible.builtin.shell: >
set -o pipefail
dpkg-query -W -f='${Status}' percona-server-server{{ percona_server_version_deb }} | grep -q 'install ok installed'
args:
executable: /bin/bash
Expand Down
8 changes: 4 additions & 4 deletions tasks/ib-logfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
- percona-server-store-datadir-retrieve

- name: ib logfile | store datadir
set_fact:
ansible.builtin.set_fact:
percona_server_datadir: "{{ _datadir_value.msg }}"
tags:
- percona-server-store-datadir
Expand All @@ -26,14 +26,14 @@
- percona-server-ib-logfile-innodb-fast-shutdown-set

- name: ib logfile | stop service
service:
ansible.builtin.service:
name: mysql
state: stopped
tags:
- percona-server-ib-logfile-stop-service

- name: ib logfile | remove ib_logfile(s)
file:
ansible.builtin.file:
path: "{{ item }}"
state: absent
with_items:
Expand All @@ -43,7 +43,7 @@
- percona-server-ib-logfile-remove

- name: ib logfile | start service
service:
ansible.builtin.service:
name: mysql
state: started
tags:
Expand Down
8 changes: 4 additions & 4 deletions tasks/install.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# tasks file
---
- name: install | configure debconf
debconf:
ansible.builtin.debconf:
name: "{{ item.name }}"
question: "{{ item.question }}"
value: "{{ item.value }}"
Expand All @@ -12,7 +12,7 @@
- percona-server-install-configure-debconf

- name: install | configure debconf for version 8.0 (Use Legacy Authentication Method)
debconf:
ansible.builtin.debconf:
name: 'percona-server-server'
question: 'percona-server-server/default-auth-override'
value: 'Use Legacy Authentication Method (Retain MySQL 5.x Compatibility)'
Expand All @@ -25,14 +25,14 @@
- percona-server-install-configure-debconf

- name: install | dependencies
apt:
ansible.builtin.apt:
name: "{{ percona_server_dependencies }}"
state: "{{ apt_install_state | default('latest') }}"
tags:
- percona-server-install-dependencies

- name: install | additional
apt:
ansible.builtin.apt:
name: "{{ percona_server_install }}"
state: "{{ apt_install_state | default('latest') }}"
tags:
Expand Down
2 changes: 1 addition & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
- percona-server-ib-logfile

- name: start and enable service
service:
ansible.builtin.service:
name: mysql
state: "{{ service_default_state | default('started') }}"
enabled: "{{ service_default_enabled | default(true) | bool }}"
Expand Down
6 changes: 3 additions & 3 deletions tasks/plugins.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# tasks file
---
- name: plugins | create (lock) directory
file:
ansible.builtin.file:
path: "{{ percona_server_lock_path }}"
state: directory
owner: root
Expand All @@ -11,7 +11,7 @@
- percona-server-plugins-lock-directory

- name: plugins | uninstall
shell: >
ansible.builtin.shell: >
mysql -e "UNINSTALL PLUGIN {{ item.name }};" && rm {{ percona_server_lock_path }}/{{ item.name | lower }}
args:
removes: "{{ percona_server_lock_path }}/{{ item.name | lower }}"
Expand All @@ -20,7 +20,7 @@
- percona-server-plugins-uninstall

- name: plugins | install
shell: >
ansible.builtin.shell: >
mysql -e "INSTALL PLUGIN {{ item.name }} SONAME '{{ item.soname }}';" && touch {{ percona_server_lock_path }}/{{ item.name | lower }}
args:
creates: "{{ percona_server_lock_path }}/{{ item.name | lower }}"
Expand Down
2 changes: 1 addition & 1 deletion tasks/queries.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# tasks file
---
- name: queries | execute sql
command: >
ansible.builtin.command: >
mysql --database="{{ item.0.database }}" -e "{{ item.1 }}; SELECT ROW_COUNT();" --skip-column-names
register: _rows_affected
changed_when: "_rows_affected.stdout | int > 0"
Expand Down
8 changes: 4 additions & 4 deletions tasks/repository.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# tasks file
---
- name: repository | install | dependencies (pre)
apt:
ansible.builtin.apt:
name: "{{ percona_server_dependencies_pre }}"
state: "{{ apt_install_state | default('latest') }}"
update_cache: true
Expand All @@ -11,15 +11,15 @@
- percona-server-repository-install-dependencies

- name: repository | add public key
apt_key:
ansible.builtin.apt_key:
id: 9334A25F8507EFA5
keyserver: keyserver.ubuntu.com
state: present
tags:
- percona-server-repository-public-key

- name: repository | add
apt_repository:
ansible.builtin.apt_repository:
repo: "{{ item.type }} {{ item.url }} {{ item.component }}"
state: present
update_cache: true
Expand All @@ -28,7 +28,7 @@
- percona-server-repository-add

- name: repository | apt-pin packages
copy:
ansible.builtin.copy:
src: etc/apt/preferences.d/00percona.pref
dest: /etc/apt/preferences.d/00percona.pref
owner: root
Expand Down
4 changes: 2 additions & 2 deletions tasks/toolkit-udfs.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# tasks file
---
- name: toolkit udfs | create (lock) directory
file:
ansible.builtin.file:
path: "{{ percona_server_lock_path }}"
state: directory
owner: root
Expand All @@ -11,7 +11,7 @@
- percona-server-toolkit-udfs-lock-directory

- name: toolkit udfs | install
shell: >
ansible.builtin.shell: >
mysql -e "DROP FUNCTION IF EXISTS {{ item.function }}; CREATE FUNCTION {{ item.function }} RETURNS INTEGER SONAME '{{ item.soname }}'" && touch {{ percona_server_lock_path }}/{{ item.soname }}
args:
creates: "{{ percona_server_lock_path }}/{{ item.soname }}"
Expand Down
2 changes: 1 addition & 1 deletion tasks/version-support.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# tasks file
---
- name: version support | check
fail:
ansible.builtin.fail:
msg: "Percona Server version {{ percona_server_version }} is not supported"
when: percona_server_version | string not in percona_server_versions_supported
tags:
Expand Down
5 changes: 3 additions & 2 deletions tasks/zoneinfo.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# tasks file
---
- name: timezone info | create (lock) directory
file:
ansible.builtin.file:
path: "{{ percona_server_lock_path }}"
state: directory
owner: root
Expand All @@ -11,7 +11,8 @@
- percona-server-zoneinfo-lock-directory

- name: timezone info | install
shell: >
ansible.builtin.shell: >
set -o pipefail
{{ percona_server_zoneinfo_command }} | tee {{ percona_server_lock_path }}/zoneinfo.sql | mysql --database=mysql
args:
executable: /bin/bash
Expand Down

0 comments on commit 6bb075b

Please sign in to comment.