From beb490ff9ec57f257a8b5d77604cf9a5c715896d Mon Sep 17 00:00:00 2001 From: Attila van der Velde Date: Mon, 22 Dec 2014 13:23:10 +0100 Subject: [PATCH] Add MariaDB version support --- README.md | 6 ++++++ defaults/main.yml | 2 ++ files/mariadb_centos6.repo | 7 ------- files/mariadb_centos7.repo | 7 ------- files/mariadb_trusty.list | 4 ---- tasks/centos.yml | 2 +- tasks/ubuntu.yml | 8 +------- templates/mariadb_centos.repo.j2 | 7 +++++++ templates/mariadb_ubuntu.list.j2 | 4 ++++ 9 files changed, 21 insertions(+), 26 deletions(-) delete mode 100644 files/mariadb_centos6.repo delete mode 100644 files/mariadb_centos7.repo delete mode 100644 files/mariadb_trusty.list create mode 100644 templates/mariadb_centos.repo.j2 create mode 100644 templates/mariadb_ubuntu.list.j2 diff --git a/README.md b/README.md index 50fd383..53980d0 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,12 @@ None ## Role Variables +MariaDB version: + +``` +mariadb_version: 10.0 +``` + Configuration template: ``` diff --git a/defaults/main.yml b/defaults/main.yml index ca95677..ecc5e97 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,3 +1,5 @@ --- +mariadb_version: 10.0 + mysql_conf_tpl: change_me mysql_conf_file: settings.cnf diff --git a/files/mariadb_centos6.repo b/files/mariadb_centos6.repo deleted file mode 100644 index 4c77132..0000000 --- a/files/mariadb_centos6.repo +++ /dev/null @@ -1,7 +0,0 @@ -# MariaDB 10.0 CentOS repository list -# http://mariadb.org/mariadb/repositories/ -[mariadb] -name = MariaDB -baseurl = http://yum.mariadb.org/10.0/centos6-amd64 -gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB -gpgcheck=1 diff --git a/files/mariadb_centos7.repo b/files/mariadb_centos7.repo deleted file mode 100644 index f6f4b8b..0000000 --- a/files/mariadb_centos7.repo +++ /dev/null @@ -1,7 +0,0 @@ -# MariaDB 10.0 CentOS repository list -# http://mariadb.org/mariadb/repositories/ -[mariadb] -name = MariaDB -baseurl = http://yum.mariadb.org/10.0/centos7-amd64 -gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB -gpgcheck=1 diff --git a/files/mariadb_trusty.list b/files/mariadb_trusty.list deleted file mode 100644 index f3409e8..0000000 --- a/files/mariadb_trusty.list +++ /dev/null @@ -1,4 +0,0 @@ -# MariaDB 10.0 repository list -# http://mariadb.org/mariadb/repositories/ -deb http://ams2.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu trusty main -deb-src http://ams2.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu trusty main diff --git a/tasks/centos.yml b/tasks/centos.yml index 34e9ac7..2b12641 100644 --- a/tasks/centos.yml +++ b/tasks/centos.yml @@ -1,6 +1,6 @@ --- - name: Add repo file - copy: src=mariadb_centos{{ ansible_distribution_major_version|int }}.repo dest=/etc/yum.repos.d/mariadb.repo owner=root group=root mode=0644 + template: src=mariadb_centos.repo.j2 dest=/etc/yum.repos.d/mariadb.repo owner=root group=root mode=0644 - name: Install MariaDB yum: enablerepo=mariadb state=present name={{ item }} diff --git a/tasks/ubuntu.yml b/tasks/ubuntu.yml index 9c85cbd..106b2c7 100644 --- a/tasks/ubuntu.yml +++ b/tasks/ubuntu.yml @@ -1,6 +1,6 @@ --- - name: Add APT repo file - copy: src=mariadb_trusty.list dest=/etc/apt/sources.list.d/mariadb.list owner=root group=root mode=0644 + template: src=mariadb_ubuntu.list.j2 dest=/etc/apt/sources.list.d/mariadb.list owner=root group=root mode=0644 register: mariadb_list - name: Add APT repo key @@ -15,12 +15,6 @@ shell: export DEBIAN_FRONTEND=noninteractive changed_when: false -#- name: Set MySQL root password -# shell: "debconf-set-selections <<< 'mariadb-server mysql-server/root_password password {{ mysql_root_password }}'" - -#- name: Set MySQL root password again -# shell: "debconf-set-selections <<< 'mariadb-server mysql-server/root_password_again password {{ mysql_root_password }}'" - - name: Install MariaDB apt: state=present pkg={{ item }} with_items: diff --git a/templates/mariadb_centos.repo.j2 b/templates/mariadb_centos.repo.j2 new file mode 100644 index 0000000..64738cc --- /dev/null +++ b/templates/mariadb_centos.repo.j2 @@ -0,0 +1,7 @@ +# MariaDB CentOS {{ ansible_distribution_major_version|int }} repository list +# http://mariadb.org/mariadb/repositories/ +[mariadb] +name = MariaDB +baseurl = http://yum.mariadb.org/{{ mariadb_version }}/centos{{ ansible_distribution_major_version|int }}-amd64 +gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB +gpgcheck=1 diff --git a/templates/mariadb_ubuntu.list.j2 b/templates/mariadb_ubuntu.list.j2 new file mode 100644 index 0000000..981b4d6 --- /dev/null +++ b/templates/mariadb_ubuntu.list.j2 @@ -0,0 +1,4 @@ +# MariaDB Ubuntu {{ ansible_distribution_release | title }} repository list +# http://mariadb.org/mariadb/repositories/ +deb http://ams2.mirrors.digitalocean.com/mariadb/repo/{{ mariadb_version }}/ubuntu {{ ansible_distribution_release | lower }} main +deb-src http://ams2.mirrors.digitalocean.com/mariadb/repo/{{ mariadb_version }}/ubuntu {{ ansible_distribution_release | lower }} main