Install mysql-5.7 with ansible on ubuntu 14.04 trusty - mysql

I'm trying to install Mysql-5.7 on ubuntu 14.04 which by default has no has no 5.7 package in its repositories.
So I try to add it manually with this little role:
---
- name: download the mysql deb package
get_url: url=http://dev.mysql.com/get/{{ deb_filename }} dest=/tmp/{{ deb_filename }} mode=0644
tags: apt
- name: install the package
sudo: true
apt: deb=/tmp/{{ deb_filename }}
tags: apt
- name: update apt cache
sudo: true
apt: update_cache=yes
tags: apt
Where deb_filename is the latest one “mysql-apt-config_0.8.7-1_all.deb”.
When I run a playbook with this role everything seems to run smoothly. No errors.
But then when it comes to a real installation of a package it says that:
msg: No package matching 'mysql-client-5.7' is available
And when I login to the server and run “apt-cache search mysql-client” I see no mysql-5.7.
How can I add this package using ansible to my server?
Thanks everyone!

Related

If statement in Github actions if Zappa already deploy application

How do I specify whether to zappa deploy or zappa update my application in Github actions with some sort of if statement
My Workflow Actions as per below
name: Dev Deploy
on:
push:
branches:
- mybranch
jobs:
dev-deploy:
name: Deploy to Dev
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v1
- name: Set up Python 3.9.10
uses: actions/setup-python#v1
with:
python-version: 3.9.10
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest
pip install python-Levenshtein
pip install virtualenv
- name: Install zappa
run: pip install zappa
- name: Install Serverless
run: npm install -g serverless
- name: Configure Serverless for zappa Services
run: serverless config credentials --provider aws --key myAWSKey --secret myAWSSecret
- name: Deploy to Dev
run: |
python -m virtualenv envsp
source envsp/bin/activate
zappa deploy dev
If application already deployed once, I get the error
Error: This application is already deployed - did you mean to call update?
In which case I would want to run zappa update dev

how to set up github actions for dart and python

I want to set up a github actions container with both dart and python. I have used the dart actions template and installed python. However, I keep getting an error saying
WARNING: The directory '/github/home/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: pip in /__t/Python/3.8.7/x64/lib/python3.8/site-packages (21.0.1)
/__w/_temp/95e6ebc6-5365-42a8-8197-9f5d14c042d3.sh: 2: /__w/_temp/95e6ebc6-5365-42a8-8197-9f5d14c042d3.sh: pip: not found
Here is my yaml file:
name: Dart
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
# Note that this workflow uses the latest stable version of the Dart SDK.
# Docker images for other release channels - like dev and beta - are also
# available. See https://hub.docker.com/r/google/dart/ for the available
# images.
container:
image: google/dart:latest
steps:
- uses: actions/checkout#v2
- name: Set up Python 3.8
uses: actions/setup-python#v2
with:
python-version: 3.8
- name: Print Dart SDK version
run: dart --version
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
cd integ_tests
dart pub get
# Run uvicorn
- name: Run uvicorn
run: |
cd fastapi/
uvicorn app.main:app --reload --port 8000
# run my test
- name: Run dart test
run: |
cd integ_tests
dart lib/main.dart --dry true
Additionally, I'm concerned that running uvicorn inside the container will make the container hang (since it would never exit). If this is the case, how do I go about starting a localhost with uvicorn without letting the container run forever?
EDIT: full log
If I run it with sudo I get an error saying
/__w/_temp/2ffb7222-f1dd-4273-870c-c85ac57b9da3.sh: 1: /__w/_temp/2ffb7222-f1dd-4273-870c-c85ac57b9da3.sh: sudo: not found
I suspect the problem here is still that you are attempting to run pip inside the container. Here's why. The dart version is provided after the setup-python but before pip installation. I would change the order to ensure that dart --version step is before the "Run dart test" step. This will ensure that all python build and configure is done right after setup-python
I looked at a Python build of mine and on the step of upgrading pip, I get this:
> Run python -m pip install --upgrade pip
Requirement already satisfied: pip in /opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages (21.0.1)
Collecting pytest
I believe this will have uvicorn running outside the container (i.e., in the runner VM).

How to install msi package in the github-actions step on windows?

I'd like to create basic github-actions job on windows that installs k6 (https://docs.k6.io/docs/installation#section-windows-msi-installer) as msi package downloaded from https://dl.bintray.com/loadimpact/windows/k6-v0.25.1-amd64.msi.
jobs:
k6_test:
name: k6 on windows
runs-on: windows-latest
steps:
- name: Install k6 from msi package
run: ...
- name: Check that it works
run: k6.exe --help
The windows environment comes with chocolatey package manager. So just do:
run: choco --yes install k6
See: https://chocolatey.org/packages/k6

Ansible not installing latest version of Mysql 5.7

My Ansible script is installing Mysql version 5.4, but I need it to install 5.7.
This is the code:
- name: mysql | Install MySQL Packages
sudo: yes
apt: pkg={{ item }} state=latest
with_items:
- mysql-server
- mysql-client
- python-mysqldb
I have tried this, but it doesn't work:
- name: mysql | Install MySQL Packages
sudo: yes
apt: pkg={{ item }} state=latest
with_items:
- mysql-server-5.7
- mysql-client-5.7
- python-mysqldb
Anyone know how to get Ansible to install Mysql 5.7?
I would expect 5.4 is the latest version available per apt. Unless you're saying you can install MySQL 5.7 with apt manually on the command line, this is not an Ansible issue.
You can try to activate the update_cache option.
- name: mysql | Install MySQL Packages
sudo: yes
apt:
pkg: "{{ item }}"
state: latest
update_cache: yes
with_items:
- mysql-server
- mysql-client
- python-mysqldb
Also you could try to add the MySQL apt repository with the apt_repository module before installing MySQL. Something like this:
- apt_repository:
repo: 'deb http://repo.mysql.com/apt/debian/ precise mysql-5.7'
state: present

how to deal with unverified apt install in ansible

when installing an apt package from our own repo, I get the the following on the CLI:
Install these packages without verification? [y/N]
The question is, how does one install these packages successfully using ansible?
Even with the force option, ansible fails to install the package.
The command I'm using is:
- apt: name=coupons-graphite dpkg_options='force' state=present
According to the documentation for the apt module you should be using force=yes in this case:
- apt: name=coupons-graphite
state=present
force=yes