Code Monkey home page Code Monkey logo

Comments (18)

mightydok avatar mightydok commented on June 2, 2024

Hi.
You can use this code for playbook to install latest MySQL version:

- name: Deploy MySQL servers and databases
  hosts: db
  become: yes
  pre_tasks:
  - name: Add MySQL repository key
    apt_key: url=http://repo.mysql.com/RPM-GPG-KEY-mysql state=present

  - name: Add MySQL Server repository
    apt_repository: repo='deb http://repo.mysql.com/apt/debian/ jessie mysql-5.6' state=present

  - name: Add MySQL Python Connector repository
    apt_repository: repo='deb http://repo.mysql.com/apt/debian/ jessie connector-python-2.0' state=present

  roles:
  - geerlingguy.mysql

from ansible-role-mysql.

ArtemProkopenko avatar ArtemProkopenko commented on June 2, 2024

Thank you. I will try.

from ansible-role-mysql.

geerlingguy avatar geerlingguy commented on June 2, 2024

@mightydok - Thanks! I think I'll leave this ticket open for now until I can decide whether we want to put this in docs, or just refer people back here if/when they ask about it.

In general, I use apt/yum for my roles, that way users can either use the default distro-provided version, or add tasks (like @mightydok did) pre-role to add a repo for a later/different version.

from ansible-role-mysql.

mightydok avatar mightydok commented on June 2, 2024

@geerlingguy i think better way - add pre_task as separate include with variable like enable_mysql56. So people can use distro or upstream packages.
http://repo.mysql.com/ have packages for fc, rh, ubuntu, sles and both 5.6, 5.7 versions so it will be easy to add this function to role. I can do that if you agree.

from ansible-role-mysql.

mightydok avatar mightydok commented on June 2, 2024

UP

from ansible-role-mysql.

joshrickert avatar joshrickert commented on June 2, 2024

I had some trouble with the code above, so I ended up getting 5.6 installed using ondrej's ubiquitous ppa, adding a mysql_version variable to my config file.

- name: Add repository for MySQL 5.6
  apt_repository: repo='ppa:ondrej/mysql-5.6'
  when: mysql_version == "5.6"

# Experimental.
- name: Add repository for MySQL 5.7
  apt_repository: repo='ppa:ondrej/mysql-5.7'
  when: mysql_version == "5.7"

MySQL still isn't starting, however, due to the deprecated config variable log_slow_queries. Some other folks noticed this issue with MariaDB too over in #52.

from ansible-role-mysql.

geerlingguy avatar geerlingguy commented on June 2, 2024

#52 is now fixed (sorry about the delay on that). To use a newer version of MySQL, you can do as @joshrickert did and use a different repository.

I'm going to close this particular ticket for now and leave it at that (it would be similar on CentOS/RHEL—use a different repo to get a later version). Moving forward, for 2.0 or beyond, I may restructure the role to install from MySQL if it makes it a little easier/better.

from ansible-role-mysql.

ssachtleben avatar ssachtleben commented on June 2, 2024

Hey we also have to use mysql 5.6 and use this:

- apt_repository: repo='ppa:ondrej/mysql-5.6'

since some days its failing, anyone know why?

`stderr: start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mysql-server-5.6 (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.6; however:
Package mysql-server-5.6 is not configured yet.

dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
mysql-server-5.6
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

stdout: Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
libaio1 libdbd-mysql-perl libdbi-perl libhtml-template-perl
libterm-readkey-perl mysql-client-5.6 mysql-client-core-5.6 mysql-server-5.6
mysql-server-core-5.6
Suggested packages:
libclone-perl libmldbm-perl libnet-daemon-perl libplrpc-perl
libsql-statement-perl libipc-sharedcache-perl mailx tinyca
The following NEW packages will be installed:
libaio1 libdbd-mysql-perl libdbi-perl libhtml-template-perl
libterm-readkey-perl mysql-client-5.6 mysql-client-core-5.6 mysql-server
mysql-server-5.6 mysql-server-core-5.6
Preconfiguring packages ...
0 upgraded, 10 newly installed, 0 to remove and 149 not upgraded.
Need to get 0 B/21.1 MB of archives.
After this operation, 163 MB of additional disk space will be used.
Selecting previously unselected package libaio1:amd64.
(Reading database ... 83300 files and directories currently installed.)
Preparing to unpack .../libaio1_0.3.109-4_amd64.deb ...
Unpacking libaio1:amd64 (0.3.109-4) ...
Selecting previously unselected package libdbi-perl.
Preparing to unpack .../libdbi-perl_1.630-1_amd64.deb ...
Unpacking libdbi-perl (1.630-1) ...
Selecting previously unselected package libdbd-mysql-perl.
Preparing to unpack .../libdbd-mysql-perl_4.025-1_amd64.deb ...
Unpacking libdbd-mysql-perl (4.025-1) ...
Selecting previously unselected package libterm-readkey-perl.
Preparing to unpack .../libterm-readkey-perl_2.31-1_amd64.deb ...
Unpacking libterm-readkey-perl (2.31-1) ...
Selecting previously unselected package mysql-client-core-5.6.
Preparing to unpack .../mysql-client-core-5.6_5.6.33-0ubuntu0.14.04.1_amd64.deb ...
Unpacking mysql-client-core-5.6 (5.6.33-0ubuntu0.14.04.1) ...
Selecting previously unselected package mysql-client-5.6.
Preparing to unpack .../mysql-client-5.6_5.6.33-0ubuntu0.14.04.1_amd64.deb ...
Unpacking mysql-client-5.6 (5.6.33-0ubuntu0.14.04.1) ...
Selecting previously unselected package mysql-server-core-5.6.
Preparing to unpack .../mysql-server-core-5.6_5.6.33-0ubuntu0.14.04.1_amd64.deb ...
Unpacking mysql-server-core-5.6 (5.6.33-0ubuntu0.14.04.1) ...
Selecting previously unselected package mysql-server-5.6.
Preparing to unpack .../mysql-server-5.6_5.6.33-0ubuntu0.14.04.1_amd64.deb ...
Unpacking mysql-server-5.6 (5.6.33-0ubuntu0.14.04.1) ...
Selecting previously unselected package libhtml-template-perl.
Preparing to unpack .../libhtml-template-perl_2.95-1_all.deb ...
Unpacking libhtml-template-perl (2.95-1) ...
Selecting previously unselected package mysql-server.
Preparing to unpack .../mysql-server_5.6.32-1+deb.sury.orgtrusty+0.1_all.deb ...
Unpacking mysql-server (5.6.32-1+deb.sury.org
trusty+0.1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Processing triggers for ureadahead (0.100.0-16) ...
Setting up libaio1:amd64 (0.3.109-4) ...
Setting up libdbi-perl (1.630-1) ...
Setting up libdbd-mysql-perl (4.025-1) ...
Setting up libterm-readkey-perl (2.31-1) ...
Setting up mysql-client-core-5.6 (5.6.33-0ubuntu0.14.04.1) ...
Setting up mysql-client-5.6 (5.6.33-0ubuntu0.14.04.1) ...
Setting up mysql-server-core-5.6 (5.6.33-0ubuntu0.14.04.1) ...
Setting up mysql-server-5.6 (5.6.33-0ubuntu0.14.04.1) ...
Setting up libhtml-template-perl (2.95-1) ...
Processing triggers for libc-bin (2.19-0ubuntu6.6) ...
Processing triggers for ureadahead (0.100.0-16) ...

msg: '/usr/bin/apt-get -y -o "Dpkg::Options::=--force-confdef" -o "Dpkg::Options::=--force-confold" install 'mysql-server'' failed: start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mysql-server-5.6 (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.6; however:
Package mysql-server-5.6 is not configured yet.

dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
mysql-server-5.6
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)`

from ansible-role-mysql.

mightydok avatar mightydok commented on June 2, 2024

@ssachtleben plz check your mysql server logs for errors:

'mysql-server'' failed: start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.

from ansible-role-mysql.

ssachtleben avatar ssachtleben commented on June 2, 2024

@mightydok error log is empty

we changed it now to

apt_repository: repo='ppa:ondrej/mysql-5.7'

which works fine

from ansible-role-mysql.

ElijahLynn avatar ElijahLynn commented on June 2, 2024

We are using this role on Amazon Linux 1 AMI. It has the amzn-updates repo enabled by default and yum install mysql defaults to 5.5 and yum install mysql57 is available. I just need to pass that variable into the role to get it installed. I don't need another repo and in fact external repos sometimes get blocked by the firewall.

So I need to install mysql57 from the current repo. Can we add support for this?

from ansible-role-mysql.

ElijahLynn avatar ElijahLynn commented on June 2, 2024

We are using this role on Amazon Linux 1 AMI. It has the amzn-updates repo enabled by default and yum install mysql defaults to 5.5 and yum install mysql57 is available. I just need to pass that variable into the role to get it installed. I don't need another repo and in fact external repos sometimes get blocked by the firewall.

So I need to install mysql57 from the current repo. Can we add support for this?

Sorry, I mean mysql57-server.

from ansible-role-mysql.

ElijahLynn avatar ElijahLynn commented on June 2, 2024

Seems like the real issue is that yum isn't picking the latest package on the Amazon Linux 1 AMIs. If it did then this would work as expected.

from ansible-role-mysql.

ElijahLynn avatar ElijahLynn commented on June 2, 2024

Asked here https://unix.stackexchange.com/questions/530928/yum-installing-mysql-server-5-5-instead-of-5-7-on-amazon-linux

from ansible-role-mysql.

ElijahLynn avatar ElijahLynn commented on June 2, 2024

K, I see the ability to specify the mysql_packages var now. We had another role that came after that was overriding it. Btw, I like how you are using __mysql_packages format in the /vars/* and then a tasks/variables.yml file to set the var to the __var if var doesn't exist, clever!

from ansible-role-mysql.

llbbl avatar llbbl commented on June 2, 2024

Thread a bit old; but leaving this here in case helpful for others. The ondrej/mysql-5.6 ppa is old + broken and should not be used.

https://launchpad.net/~ondrej/+archive/ubuntu/mysql-5.6

:)

from ansible-role-mysql.

stale avatar stale commented on June 2, 2024

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

from ansible-role-mysql.

stale avatar stale commented on June 2, 2024

This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.

from ansible-role-mysql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.