From b9f096bd3e873a1614d8bfe622afed3cf519371a Mon Sep 17 00:00:00 2001 From: Saurabh Date: Tue, 5 Sep 2017 19:35:28 +0530 Subject: [PATCH] Support for mariadb debian 9 and above --- playbooks/develop/install.yml | 2 ++ playbooks/develop/macosx.yml | 2 +- playbooks/prerequisites/debian.yml | 3 +++ .../files/debian_mariadb_config.cnf} | 0 .../prerequisites/roles/mariadb/tasks/debian.yml | 5 ++++- playbooks/prerequisites/roles/mariadb/tasks/main.yml | 11 +++++++++-- 6 files changed, 19 insertions(+), 4 deletions(-) rename playbooks/{develop/templates/simple_mariadb_config.cnf => prerequisites/files/debian_mariadb_config.cnf} (100%) diff --git a/playbooks/develop/install.yml b/playbooks/develop/install.yml index c24a361a..835decec 100644 --- a/playbooks/develop/install.yml +++ b/playbooks/develop/install.yml @@ -2,8 +2,10 @@ - hosts: localhost - include: ../prerequisites/install_prerequisites.yml + when: ansible_distribution != 'MacOSX' - include: ../prerequisites/install_roles.yml + when: ansible_distribution != 'MacOSX' - include: macosx.yml when: ansible_distribution == 'MacOSX' diff --git a/playbooks/develop/macosx.yml b/playbooks/develop/macosx.yml index 704096dd..b9175b7e 100644 --- a/playbooks/develop/macosx.yml +++ b/playbooks/develop/macosx.yml @@ -22,7 +22,7 @@ - wkhtmltopdf - name: configure mariadb - include: ../prerequisites/roles/mariadb/main.yml + include: ../prerequisites/roles/mariadb/task/main.yml vars: mysql_conf_tpl: ../prerequisites/files/mariadb_config.cnf diff --git a/playbooks/prerequisites/debian.yml b/playbooks/prerequisites/debian.yml index 6c0fb8f9..b7e3259b 100644 --- a/playbooks/prerequisites/debian.yml +++ b/playbooks/prerequisites/debian.yml @@ -1,4 +1,7 @@ --- +- name: Setup OpenSSL dependancy + pip: name=pyOpenSSL version=16.2.0 + - name: install pillow prerequisites for Debian < 8 apt: pkg={{ item }} state=present with_items: diff --git a/playbooks/develop/templates/simple_mariadb_config.cnf b/playbooks/prerequisites/files/debian_mariadb_config.cnf similarity index 100% rename from playbooks/develop/templates/simple_mariadb_config.cnf rename to playbooks/prerequisites/files/debian_mariadb_config.cnf diff --git a/playbooks/prerequisites/roles/mariadb/tasks/debian.yml b/playbooks/prerequisites/roles/mariadb/tasks/debian.yml index ed188c3b..526e3fa4 100644 --- a/playbooks/prerequisites/roles/mariadb/tasks/debian.yml +++ b/playbooks/prerequisites/roles/mariadb/tasks/debian.yml @@ -1,9 +1,12 @@ --- - - name: Add apt key for mariadb for Debian <= 8 apt_key: keyserver=hkp://keyserver.ubuntu.com:80 id=0xcbcb082a1bb943db state=present when: ansible_distribution_major_version | version_compare('8', 'le') +- name: Add apt key for mariadb for Debian > 8 + apt_key: keyserver=hkp://keyserver.ubuntu.com:80 id=0xF1656F24C74CD1D8 state=present + when: ansible_distribution_major_version | version_compare('8', 'gt') + - name: Add apt repository apt_repository: repo: 'deb [arch=amd64,i386] http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.1/debian {{ ansible_distribution_release }} main' diff --git a/playbooks/prerequisites/roles/mariadb/tasks/main.yml b/playbooks/prerequisites/roles/mariadb/tasks/main.yml index 878e5894..b731d39e 100644 --- a/playbooks/prerequisites/roles/mariadb/tasks/main.yml +++ b/playbooks/prerequisites/roles/mariadb/tasks/main.yml @@ -5,17 +5,24 @@ - include: ubuntu.yml when: ansible_distribution == 'Ubuntu' +- name: Add configuration + template: src={{ mysql_conf_tpl }} dest={{ mysql_conf_dir[ansible_distribution] }}/{{ mysql_conf_file }} owner=root group=root mode=0644 + when: mysql_conf_tpl != 'change_me' and ansible_distribution != 'Debian' + notify: restart mysql + - include: debian.yml when: ansible_distribution == 'Debian' - name: Add configuration - template: src={{ mysql_conf_tpl }} dest={{ mysql_conf_dir[ansible_distribution] }}/{{ mysql_conf_file }} owner=root group=root mode=0644 - when: mysql_conf_tpl != 'change_me' + template: src=files/debian_mariadb_config.cnf dest={{ mysql_conf_dir[ansible_distribution] }}/{{ mysql_conf_file }} owner=root group=root mode=0644 + when: mysql_conf_tpl != 'change_me' and ansible_distribution == 'Debian' notify: restart mysql - name: Start and enable service service: name=mysql state=started enabled=yes - include: mysql_secure_installation.yml + when: mysql_root_password is defined + - debug: var=mysql_secure_installation when: mysql_secure_installation and mysql_root_password is defined