SSH Stops Working After Ubuntu Upgrade

I recently upgraded from 14.04 to 16.04. It went pretty smoothly, except some of my SSH connections stopped working. It turns out the the upgrade, automatically upgraded OpenSSL from version 6 to version 7 and version 7 no longer allows keys that it thinks are insecure.

To see what version you are running:

ssh -V

The big problem is the server I need to connect to is managed by a “Windows” guy who hates Linux. Getting him to update the key is going to take a while and I need to connect NOW.

The solution is at:

I put this in my  ~/.ssh/config file:

    HostKeyAlgorithms +ssh-dss

It’s ugly, but it works.


Using the Ansible Find Command

The “find” command was added to Ansible in version 2. Here is how I used it to change the permissions on some log files:

- name: Get all log files in django dir
    paths: "{{ django_manage_path }}"
    patterns: "*.log"
    recurse: yes
  register: files_to_change

- name: Make sure Django log files in dir are owned by vagrant
  become: yes
  file: path={{ item.path }} owner=vagrant group=admin mode=0660
  with_items: "{{ files_to_change.files }}"

Ansible Could Not Find Templates After Migration from 1.9 to 2.5

I had a playbook that included a task from another role like this:

  - include: roles/django/tasks/create_server_settings.yml

This include stopped working when I migrated from Ansible 1.9 to 2.5. The task used the “template” command and Ansible could not find the template. It looked in:

  • roles/django/tasks/templates/
  • roles/django/tasks/

I am using the recommended directory structure with the tasks and templates directories both at the same level in the directory tree, in this case:

  • roles/django/templates/

Switching to the command:

  - include_tasks: roles/django/tasks/create_server_settings.yml

did NOT help.

The solution was to use this command:

  - include_role:
      name: django
      tasks_from: create_server_settings

Fixing Hg Mistakes

Removing Pushes from Other Branches

I often create a branch by cloning. I do more involved or experimental things in the clone. While the parent branch is available to make small minor updates. As code in the branch progresses, I do commits. And every once in a while, by accident, I do a commit and push. This puts the experimental code in the main branch before its ready. To remove the pushed change set, cd into main and do:

hg strip -r REV


Django HTTP 404 Not Found Error

So you’ve got everything working on the Django dev server. Almost everything is working on the staging server… except one URL that sometimes fails with an HTTP 404 Not Found error. What is going on here?

More details; it happens to be a Django form page. The page loads with a problem. The problem occurs after you submit the form. The URL that causes the 404 error is the URL of the form. What is going on here?

In my case, the form_valid() was doing a lot of processing of the form data and the server was timing out. Maybe part of the reason I did not catch this earlier is my dev server is much faster than the Digital Ocean droplet I was using.