Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/defaults/version-large.yml
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ system_default:
reboot_timeout: 300 # wait 5 minutes max when rebooting the system
apt: # The apt sections to use,
sections: [ main ] # contrib and non-free not activated by default
mirror: deb.debian.org # package mirror to use

# Administration settings
# the user below is automatically added to the sudo group
Expand Down
1 change: 1 addition & 0 deletions config/defaults/version-medium.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ system_default:
reboot_timeout: 300 # wait 5 minutes max when rebooting the system
apt: # The apt sections to use,
sections: [ main ] # contrib and non-free not activated by default
mirror: deb.debian.org # package mirror to use

# Administration settings
# the user below is automatically added to the sudo group
Expand Down
1 change: 1 addition & 0 deletions config/defaults/version-mini.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ system_default:
reboot_timeout: 300 # wait 5 minutes max when rebooting the system
apt: # The apt sections to use,
sections: [ main ] # contrib and non-free not activated by default
mirror: deb.debian.org # package mirror to use

# Administration settings
# the user below is automatically added to the sudo group
Expand Down
1 change: 1 addition & 0 deletions config/defaults/version-small.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ system_default:
reboot_timeout: 300 # wait 5 minutes max when rebooting the system
apt: # The apt sections to use,
sections: [ main ] # contrib and non-free not activated by default
mirror: deb.debian.org # package mirror to use

# Administration settings
# the user below is automatically added to the sudo group
Expand Down
3 changes: 2 additions & 1 deletion config/samples/system-minimal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ system:
release: bookworm
devel: false
debug: false

apt:
mirror: deb.debian.org

###############################################################################
# If you are using Gandi, you can enter an API key here
Expand Down
10 changes: 6 additions & 4 deletions docs/30-define-your-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ If you are planning to work with multiple domains, jump to the next section dire
Once you have chosen your flavour, you need to copy the configuration sample, to create yours:

```sh
cp config/samples/minimal.yml config/system.yml
cp config/samples/system-minimal.yml config/system.yml
```

You also need to copy the inventory file for Ansible.
Expand All @@ -79,10 +79,10 @@ cp config/samples/hosts.yml config/hosts.yml

### Working with multiple domains

To work with multiple domains, uses these commands instead, by adjusting `<domain-name>`:
To work with multiple domains, use these commands instead, by adjusting `<domain-name>`:

```sh
cp config/samples/minimal.yml config/system-<domain-name>.yml
cp config/samples/system-minimal.yml config/system-<domain-name>.yml
```

Same for the inventory file for Ansible:
Expand All @@ -91,7 +91,7 @@ Same for the inventory file for Ansible:
cp config/samples/hosts.yml config/hosts-<domain-name>.yml
```

The inventory should contains this:
The inventory should contain this:

```yml
all:
Expand Down Expand Up @@ -265,6 +265,8 @@ system:
release: bookworm
devel: false
debug: false
apt:
mirror: deb.debian.org
```

#### DNS provider
Expand Down
15 changes: 15 additions & 0 deletions roles/bootstrap/tasks/check/apt.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
---

- name: Check apt mirror is valid for us
changed_when: false
failed_when: not system_apt_mirror_release_match.rc == 0
register: system_apt_mirror_release_match
ansible.builtin.shell: >-
wget --no-config -qO - --wait=3 --random-wait \
"http://{{ system.apt.mirror }}/debian/dists/{{ distribution_release }}/Release" \
|egrep -q "^Codename[:][[:blank:]]+{{ distribution_release }}"
loop:
- "{{ system.release }}"
- "{{ system.release }}-updates"
- "{{ system.release }}-backports"
loop_control:
loop_var: distribution_release

- name: Check if we can run apt update without error
ansible.builtin.apt:
update_cache: true
16 changes: 16 additions & 0 deletions roles/bootstrap/tasks/install/apt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,22 @@
ansible.builtin.set_fact:
sections: '{{ system.apt.sections | join(" ") }}'


- name: Check apt mirror is valid for us
changed_when: false
failed_when: not system_apt_mirror_release_match.rc == 0
register: system_apt_mirror_release_match
ansible.builtin.shell: >-
wget --no-config -qO - --wait=3 --random-wait \
"http://{{ system.apt.mirror }}/debian/dists/{{ distribution_release }}/Release" \
|egrep -q "^Codename[:][[:blank:]]+{{ distribution_release }}"
loop:
- "{{ system.release }}"
- "{{ system.release }}-updates"
- "{{ system.release }}-backports"
loop_control:
loop_var: distribution_release

- name: Initialise default repositories
register: repositories
ansible.builtin.template:
Expand Down
12 changes: 6 additions & 6 deletions roles/bootstrap/templates/sources.list
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Main repository
deb https://deb.debian.org/debian/ {{ system.release }} {{ sections }}
deb-src https://deb.debian.org/debian/ {{ system.release }} {{ sections }}
deb https://{{ system.apt.mirror }}/debian/ {{ system.release }} {{ sections }}
deb-src https://{{ system.apt.mirror }}/debian/ {{ system.release }} {{ sections }}

# Security updates
deb https://security.debian.org/debian-security {{ system.release }}-security main contrib non-free
deb-src https://security.debian.org/debian-security {{ system.release }}-security main contrib non-free

# {{ system.release }}-updates, previously known as 'volatile'
deb https://deb.debian.org/debian/ {{ system.release }}-updates {{ sections }}
deb-src https://deb.debian.org/debian/ {{ system.release }}-updates {{ sections }}
deb https://{{ system.apt.mirror }}/debian/ {{ system.release }}-updates {{ sections }}
deb-src https://{{ system.apt.mirror }}/debian/ {{ system.release }}-updates {{ sections }}

# Uncomment to activate backports
# {{ system.release }}-backports, previously on backports.debian.org
# deb https://deb.debian.org/debian/ {{ system.release }}-backports {{ sections }}
# deb-src https://deb.debian.org/debian/ {{ system.release }}-backports {{ sections }}
# deb https://{{ system.apt.mirror }}/debian/ {{ system.release }}-backports {{ sections }}
# deb-src https://{{ system.apt.mirror }}/debian/ {{ system.release }}-backports {{ sections }}
1 change: 1 addition & 0 deletions roles/bootstrap/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ whitelisted_hosts:
- deb.debian.org
- letsencrypt.org
- security.debian.org
- '{{ system.apt.mirror }}'