Skip to content

Commit be7f47e

Browse files
authored
Merge pull request #45 from QuLogic/update
Update to Fedora 41
2 parents 471195e + 7f56982 commit be7f47e

File tree

5 files changed

+48
-16
lines changed

5 files changed

+48
-16
lines changed

README.md

+19-9
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,14 @@ Before you can run our Ansible playbooks, you need to meet the following
3737
prerequisites:
3838

3939
* Create a DigitalOcean API token, and pass it to the inventory generator by
40-
setting the `DO_API_TOKEN` environment variable.
40+
setting the `DO_API_TOKEN` environment variable. The API token must have
41+
access to the following scopes:
42+
- Read: droplet, firewall, monitoring, project, ssh_key
43+
- Create: droplet
44+
- Update: droplet, monitoring, project
4145
* If you are creating a new droplet, and want to configure DNS as well, then
42-
create a CloudFlare API token, and pass it to the Ansible playbook by setting
43-
the `CLOUDFLARE_TOKEN` environment variable.
46+
create a CloudFlare API token with DNS edit permissions, and pass it to the
47+
Ansible playbook by setting the `CLOUDFLARE_TOKEN` environment variable.
4448
* Set the vault decryption password of the Ansible vaulted file with our
4549
secrets. This may be done by setting the `ANSIBLE_VAULT_PASSWORD_FILE`
4650
environment variable to point to a file containing the password.
@@ -117,7 +121,7 @@ Initial setup
117121
The summary of the initial setup is:
118122

119123
1. Create the droplet with monitoring and relevant SSH keys.
120-
2. Assign new droplet to the matplotlib.org project and the Web firewall.
124+
2. Assign new droplet to the matplotlib.org project.
121125
3. Add DNS entries pointing to the server on CloudFlare.
122126
4. Grab the SSH host fingerprints.
123127
5. Reboot.
@@ -144,7 +148,8 @@ ansible-playbook create.yml --extra-vars "host=pluto functional=web99 ssh_keys='
144148

145149
The playbook will create the server, as well as add DNS records on CloudFlare.
146150
Note, you must set `DO_API_TOKEN` and `CLOUDFLARE_TOKEN` in the environment to
147-
access these services.
151+
access these services. The droplet ID and IP address will be printed at the
152+
end of the playbook.
148153

149154
Then, to ensure you are connecting to the expected server, you should grab the
150155
SSH host keys via the DigitalOcean Droplet Console:
@@ -159,16 +164,21 @@ Note down the outputs to verify later, e.g.,
159164

160165
```
161166
# Use these for comparison when connecting yourself.
162-
1024 SHA256:J2sbqvhI/VszBtVvPabgxyz6sRnGLrZUn0kqfv4doAM [email protected] (DSA)
163-
256 SHA256:J0rOMayXhL1+5wbm4WQNpAvmscDjqwJjAtk1SLemRMI [email protected] (ECDSA)
164-
256 SHA256:y8EDRGMpLWOW72x47MVKsAfSAl8JHjsOc/RGaiMTPGs [email protected] (ED25519)
165-
3072 SHA256:AyuNO8FES5k9vobv0Pu9XpvtjVFZ1bTTNxb1lo+AuRA [email protected] (RSA)
167+
256 SHA256:p6MiA8+IO1WcpXHDOQ4rhiVCo+MDxWB7ehfNfxvbDkU [email protected] (ECDSA)
168+
256 SHA256:RfDahJqnQFLeFN+zl9f+hmB+W05OoZK26NfNQkj6KtY [email protected] (ED25519)
169+
3072 SHA256:tYwdULlz5/XP5Ze7PCj9XpO3VIMEZkiOiFuhr9nke34 [email protected] (RSA)
166170
```
167171

168172
Finally, you should reboot the droplet. This is due to a bug in cloud-init on
169173
DigitalOcean, which generates a new machine ID after startup, causing system
170174
logs to be seem invisible.
171175

176+
This can be done from the Console, or via the CLI:
177+
178+
```
179+
doctl compute droplet-action reboot <droplet-id>
180+
```
181+
172182
Running Ansible
173183
---------------
174184

collections/requirements.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
collections:
33
- name: ansible.posix
44
- name: community.general
5-
version: ">=2.0.0"
5+
version: ">=8.0.0"
66
- name: community.digitalocean

create.yml

+18-3
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,7 @@
9191
community.digitalocean.digital_ocean_droplet:
9292
state: present
9393
name: "{{ host }}.matplotlib.org"
94-
firewall:
95-
- Web
96-
image: fedora-39-x64
94+
image: fedora-41-x64
9795
monitoring: true
9896
project: matplotlib.org
9997
region: tor1
@@ -117,6 +115,8 @@
117115
map(attribute='ip_address') |
118116
first
119117
}}
118+
tags:
119+
- website
120120
zone: matplotlib.org
121121

122122
- name: Setup functional DNS for droplet on CloudFlare
@@ -126,8 +126,23 @@
126126
record: "{{ functional }}"
127127
type: CNAME
128128
value: "{{ host }}.matplotlib.org"
129+
tags:
130+
- website
129131
zone: matplotlib.org
130132

133+
- name: Print droplet info
134+
ansible.builtin.debug:
135+
msg:
136+
- "Droplet ID is {{ new_droplet.data.droplet.id }}"
137+
- >-
138+
First Public IPv4 is {{
139+
(new_droplet.data.droplet.networks.v4 | selectattr('type', 'equalto', 'public')).0.ip_address |
140+
default('<none>', true) }}
141+
- >-
142+
First Private IPv4 is {{
143+
(new_droplet.data.droplet.networks.v4 | selectattr('type', 'equalto', 'private')).0.ip_address |
144+
default('<none>', true) }}
145+
131146
vars:
132147
# We currently name servers based on planets in the Solar System.
133148
valid_planets:

files/dnf5-automatic.conf

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[commands]
2+
apply_updates = yes

matplotlib.org.yml

+8-3
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
- name: Install server maintenance
4646
ansible.builtin.dnf:
4747
name:
48-
- dnf-automatic
48+
- dnf5-plugin-automatic
4949
- fail2ban
5050
state: present
5151

@@ -63,8 +63,8 @@
6363
name:
6464
- golang-github-prometheus
6565
- golang-github-prometheus-alertmanager
66-
- golang-github-prometheus-node-exporter
6766
- grafana
67+
- node-exporter
6868
# Remove this when Loki is packaged.
6969
- podman
7070
state: present
@@ -77,9 +77,14 @@
7777

7878
# Automatic updates
7979
# #################
80+
- name: Configure automatic updates
81+
ansible.builtin.copy:
82+
src: dnf5-automatic.conf
83+
dest: /etc/dnf/dnf5-plugins/automatic.conf
84+
8085
- name: Enable automatic updates
8186
ansible.builtin.systemd:
82-
name: dnf-automatic-install.timer
87+
name: dnf5-automatic.timer
8388
enabled: true
8489
state: started
8590

0 commit comments

Comments
 (0)