-
Notifications
You must be signed in to change notification settings - Fork 687
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added Vagrant-managed local apt server
- Loading branch information
1 parent
2a08410
commit 6e276cb
Showing
4 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- | ||
- name: Confirm local debs present | ||
hosts: localhost | ||
gather_facts: no | ||
tasks: | ||
# Before running apt-server logic, confirm we have local | ||
# debs built. | ||
- name: Find local deb files | ||
find: | ||
paths: "../build/focal/" | ||
patterns: "*.deb" | ||
register: _find_debs_result | ||
|
||
- name: Ensure debs were found | ||
assert: | ||
that: | ||
- "_find_debs_result.files|length >= 8" | ||
msg: "No local debs found, run 'make build-debs-focal'" | ||
|
||
- name: Configure apt-server | ||
hosts: apt-local | ||
become: yes | ||
tasks: | ||
- import_tasks: ../molecule/upgrade/local_apt_mirror.yml | ||
- import_tasks: ../molecule/upgrade/local_apt_with_debs.yml | ||
|
||
vars: | ||
QA_APTTEST: False | ||
rep_dist: "focal" | ||
molecule_dir: "../molecule/upgrade" | ||
dpkg_dir: /var/repos/debs | ||
rep_component: main | ||
rep_arch: i386 amd64 | ||
release_file: "/var/repos/base/dists/{{ rep_dist }}/Release" | ||
nginx_sites: | ||
default: | ||
- listen 80 | ||
- root "/var/repos/base" | ||
- location / { autoindex on; } | ||
- location /gpg { alias /var/repos/base/; } | ||
encrypted: | ||
- listen 443 ssl | ||
- server_name apt.freedom.press | ||
- ssl_certificate /etc/ssl/certs/apt_freedom_press.pem | ||
- ssl_certificate_key /etc/ssl/private/apt_freedom_press.priv | ||
- root "/var/repos/base" | ||
- location / { autoindex on; } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
# Playbook to update SecureDrop VMs to install Focal packages from a local repo | ||
# | ||
# Steps to use this playbook: | ||
# | ||
# 1. On host machine, build packages with `make build-debs-focal` | ||
# 2. On host machine, provision local apt repo with `vagrant up apt-local` | ||
# 3. Switch to Admin Workstation | ||
# 3. Continue with prod provisioning as far as `./securedrop-admin sdconfig` | ||
# 5. Run `source admin/.venv3/bin/activate` (so ansible commands work) | ||
# 6. Run `cd install_files/ansible-base` | ||
# 7. Run `ansible-playbook -vv --diff securedrop-apt-local.yml` | ||
# 8. Proceed with `./securedrop-admin install` | ||
|
||
- name: Configure prod host to prioritize local packages. | ||
environment: | ||
LC_ALL: C | ||
max_fail_percentage: 0 | ||
any_errors_fatal: yes | ||
hosts: securedrop | ||
tasks: | ||
- name: Add apt public key for local repo. | ||
apt_key: | ||
data: "{{ lookup('file', '../../molecule/upgrade/files/apt-test.pub') }}" | ||
state: present | ||
|
||
- name: Add local repo | ||
apt_repository: | ||
repo: deb [arch=amd64] http://10.0.1.7 focal main | ||
state: present | ||
update_cache: yes | ||
become: yes | ||
|