-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor to support Ansible 2.8 #1549
Conversation
I tried a few tests. Starting with a new Ubuntu Server 19.04 container I ran cloud deployments to Vultr and DigitalOcean. Then I created an Ubuntu Server 19.04 droplet on DigitalOcean and did a local install. All tested fine using WireGuard on iOS. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides adding the api-token to the 2 places described, I had to add a tasks in roles/common/tasks/ubuntu.yaml
to wait for unattended-upgrades to finish, which seemed to start as soon as the hcloud server had been provisioned:
- name: Wait for any possibly running unattended upgrade to finish
raw: systemd-run --property="After=apt-daily.service apt-daily-upgrade.service" --wait /bin/true
- name: Install software updates
After that it worked fine.
Thanks @phaer! Somehow I missed the api tokens. I just sent another solution for the apt lock, works well. |
|
This comment has been minimized.
This comment has been minimized.
An Ubuntu Server 18.04 droplet local install works OK too. |
Also, just for "fun", an Ubuntu Server 19.04 droplet local install works if you replace |
Update docs? |
@TC1977 I would appreciate your help :) I guess, you can commit directly to this branch? |
Working on it now 😄 I can't commit directly, but I can submit a PR to this branch. |
Yes, that's OK |
Ok, I think I'm all set. #1552 |
A cloud deployment from an Ubuntu Server 19.04 container to DigitalOcean using It works if
Edited to add: On Ubuntu Server 18.04 I needed to use |
A cloud deployment from macOS 10.14.6 to DigitalOcean using Since I already had Homebrew installed I set up the dependencies like this:
I think when the time comes to move to Edited to add one more note about Python 3: When running a local or DO deploy on Ubuntu the only prerequisite package I needed to install was |
@davidemyers I think we need to address python3 in a separate issue |
@jackivanov I agree, I was just curious to know what already worked and thought I'd record what I found in case it's useful later. |
Actually, I'd like to switch to python3 in this pr, so still work in progress |
I'm not a Python expert, but I think PEP 538 explains the issue with generating the p12 password in Python 3. This works at the command line on 18.04, 19.04, and macOS:
I haven't tried it this way yet when invoked from Ansible. |
476420e
to
ec1c319
Compare
|
I just installed from this branch on WSL, though I had to patch an Ansible script:
|
It appears that the minimum required version of python should be 3.6, and it seems like ubuntu 16.04 is incompatible now |
You should also remove the sentence that starts with "On Ubuntu 16.04 LTS ..." that I recently added to the README. |
This branch works again without |
else: | ||
items = [] | ||
return_value = {'resources': items} | ||
module.exit_json(**return_value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be simplified to the following?:
module.exit_json(**dict(resources=items.get('items', [])))
return return_if_object(module, response) | ||
|
||
|
||
def query_options(filters): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could make this a little more concise with list comprehensions:
def query_options(filters):
if not filters:
return ''
elif len(filters) == 1:
return filters[0]
else:
return ' '.join(
filter if (filter.startswith('(') and filter.endswith(')'))
else f"({filter})"
for filter in filters
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, the first two cases are implicitly handled if we turn it into a generator:
def query_options(filters):
return ' '.join(
filter if (filter.startswith('(') and filter.endswith(')'))
else f"({filter})"
for filter in filters
)
|
||
def return_if_object(module, response): | ||
# If not found, return nothing. | ||
if response.status_code == 404: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can merge these together:
if response.status_code in (404, 204,):
return None
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution! I have sanity checked this patch and tried to look through it. To the extent that it's possible to review this looks okay, but in the future it would be much easier to do a thorough review job without putting so many distinct changes in a PR.
Ideally each of the changes listed in this PR would have been a separate PR, so instead of one 2000 line diff we'd be looking at ~8 separate PRs, each with manageable diff sizes.
@btonic provided some review feedback that it would be nice to see in a followup PR as well, but for now we'll merge the changes. Thanks again for your work!
* bump ansible to 2.8.3 * DigitalOcean: move to the latest modules * Add Hetzner Cloud * Scaleway and Lightsail fixes * lint missing roles * Update roles/cloud-hetzner/tasks/main.yml Add api_token Co-Authored-By: phaer <[email protected]> * Update roles/cloud-hetzner/tasks/main.yml Add api_token Co-Authored-By: phaer <[email protected]> * Try to run apt until succeeded * Scaleway modules upgrade * GCP: Refactoring, remove deprecated modules * Doc updates (#1552) * Update README.md Adding links and mentions of Exoscale aka CloudStack and Hetzner Cloud. * Update index.md Add the Hetzner Cloud to the docs index * Remove link to Win 10 IPsec instructions * Delete client-windows.md Unnecessary since the deprecation of IPsec for Win10. * Update deploy-from-ansible.md Added sections and required variables for CloudStack and Hetzner Cloud. * Update deploy-from-ansible.md Added sections for CloudStack and Hetzner, added req variables and examples, mentioned environment variables, and added links to the provider role section. * Update deploy-from-ansible.md Cosmetic changes to links, fix typo. * Update GCE variables * Update deploy-from-script-or-cloud-init-to-localhost.md Fix a finer point, and make variables list more readable. * update azure requirements * Python3 draft * set LANG=c to the p12 password generation task * Update README * Install cloud requirements to the existing venv * FreeBSD fix * env->.env fixes * lightsail_region_facts fix * yaml syntax fix * Update README for Python 3 (#1564) * Update README for Python 3 * Remove tabs and tweak instructions * Remove cosmetic command indentation * Update README.md * Update README for Python 3 (#1565) * DO fix for "found unpermitted parameters: id" * Verify Python version * Remove ubuntu 16.04 from readme * Revert back DigitalOcean module * Update deploy-from-script-or-cloud-init-to-localhost.md * env to .env
Upgrades and Fixes
Cloud provider changes
Breaking changes
.env
Types of changes
Checklist: