Get Entire AWS S3 Bucket Contents with Ansible

I ran into this issue the other day while putting together a simple deploy playbook.  For this particular project, we store artifacts in S3 and I needed to grab several jar files from the same bucket. Unfortunately, the Ansible S3 Module Get operation does not support recursive copy. While I could have accomplished this with a shell command and the awscli, I preferred to have Ansible perform the get.

The solution I ended up implementing was using list mode to create registered variables of the artifacts list, then loop through and get the artifacts. Simple and it works great. The working tasks are below.

tasks:
  - name: List s3 objects
    aws_s3:
      bucket: "bucketname"
      prefix: "path/to/artifact/"
      mode: list
    register: s3objects

  - name: Download s3objects
    aws_s3:
      bucket: "bucketname"
      object: "{{ item }}"
      mode: get
      dest: "destinationfolder/{{ item|basename }}"
    with_items: "{{ s3objects.s3_keys }}"

MAMP MySQL Server Won’t Start

This was a common problem with past versions of MAMP and it continues to happen for some users in version 4.x. Fortunately, the fix is easy. The problem is that when exiting MAMP the MySQL processes continue to run and are not stopped. This post has two solutions. The first solution of killing running processes has worked for me pretty much all the time. The second solution is from one of the comments below.

  1. Quit MAMP. You may have to force quit when this happens as it does not shut down correctly.
  2. To show any MySQL processes currently running, open Terminal and from the command prompt run the command below.
    pgrep mysql
  3. Next, kill the MySQL processes by running the command below.
    pgrep mysql | xargs kill -9
  4. To verify they no longer exist, pgrep for mysql again and you should not have any processes returned.
    pgrep mysql
  5. Now Launch MAMP again and MySQL Server should start normally.

Alternative Solution

If the above solution does not work, this method should.

  1. Stop Mamp and kill the mysql processes as above.
  2. Rename the ib_logfileN (N is the log numbers) files to something else. Don’t delete these as you may need to return to them. The path to these files may be different on your system. On my system, I would do the following:
    mv /Library/Application\ Support/appsolute/MAMP\ PRO/db/mysql56/ib_logfile0 /Library/Application\ Support/appsolute/MAMP\ PRO/db/mysql56/ib_logfile_0
    
    mv /Library/Application\ Support/appsolute/MAMP\ PRO/db/mysql56/ib_logfile1 /Library/Application\ Support/appsolute/MAMP\ PRO/db/mysql56/ib_logfile_1
  3. Restart MAMP and MySQL should start correctly.
    (Thanks to Daniel Erkalo for this alternative fix!)

Ship USPS via PayPal without an Ebay transaction

You may have noticed the discounted USPS postage rates on PayPal after selling an item on eBay. Wouldn’t it be nice to get that same discount for all of your shipping?

Using the link below, you can ship anything via USPS, including 1st class mail (with the PayPal Discount!). Note, you will need to be logged into PayPal before clicking the link.

https://www.paypal.com/us/cgi-bin/webscr?cmd=_ship-now