Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
homelab
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
shore
homelab
Commits
e9da05ac
Commit
e9da05ac
authored
4 years ago
by
nimrod
Browse files
Options
Downloads
Patches
Plain Diff
Playbook for updating hosts.
parent
f9280622
No related branches found
No related tags found
No related merge requests found
Pipeline
#177
passed
4 years ago
Stage: test
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
.pre-commit-config.yaml
+2
-2
2 additions, 2 deletions
.pre-commit-config.yaml
update.yaml
+127
-0
127 additions, 0 deletions
update.yaml
with
129 additions
and
2 deletions
.pre-commit-config.yaml
+
2
−
2
View file @
e9da05ac
...
@@ -11,10 +11,10 @@ repos:
...
@@ -11,10 +11,10 @@ repos:
-
id
:
detect-private-key
-
id
:
detect-private-key
-
id
:
trailing-whitespace
-
id
:
trailing-whitespace
-
repo
:
https://git.shore.co.il/ansible/ansible-pre-commit.git
-
repo
:
https://git.shore.co.il/ansible/ansible-pre-commit.git
rev
:
v0.
8
.0
rev
:
v0.
10
.0
hooks
:
hooks
:
-
id
:
ansible-syntax-check
-
id
:
ansible-syntax-check
files
:
bootstrap\.yaml|
router
\.yaml
files
:
bootstrap\.yaml|
update\.yaml|renew-certs
\.yaml
types
:
[
yaml
]
types
:
[
yaml
]
-
repo
:
https://github.com/ansible/ansible-lint
-
repo
:
https://github.com/ansible/ansible-lint
rev
:
v4.3.7
rev
:
v4.3.7
...
...
This diff is collapsed.
Click to expand it.
update.yaml
0 → 100644
+
127
−
0
View file @
e9da05ac
---
-
name
:
Group hosts by package manager
hosts
:
-
all
tasks
:
-
name
:
Group hosts by package manager
group_by
:
key
:
pkg_mgr_{{ ansible_pkg_mgr }}
tags
:
-
always
-
name
:
Update Debian hosts
hosts
:
-
pkg_mgr_apt
tasks
:
-
name
:
Update packages
apt
:
autoclean
:
true
purge
:
true
update_cache
:
true
upgrade
:
dist
register
:
apt_upgrade
-
name
:
Remove no-longer needed dependecies
apt
:
autoremove
:
true
purge
:
true
-
name
:
Update firmware
command
:
fwupdmgr --assume-yes update
register
:
fwupdmgr
changed_when
:
fwupdmgr.stdout_lines|length >
0
-
name
:
Set reboot needed fact
set_fact
:
reboot_needed
:
"
{{
apt_upgrade
is
changed
or
fwupdmgr
is
changed
}}"
tags
:
-
debian
-
update
-
name
:
Update OpenWRT hosts
hosts
:
-
pkg_mgr_opkg
tasks
:
-
name
:
Update package list
command
:
opkg update
changed_when
:
false
-
name
:
Update packages
# We run through sort so that we don't run 2 instances fo opkg at once.
shell
:
|-
opkg list-upgradable | awk '{print $1}' | sort | xargs -rn1 opkg upgrade
register
:
opkg_upgrade
changed_when
:
opkg_upgrade.stdout_lines|length >
0
-
name
:
Set reboot needed fact
set_fact
:
reboot_needed
:
"
{{
opkg_upgrade
is
changed
}}"
tags
:
-
openwrt
-
update
-
name
:
Update OpenBSD hosts
hosts
:
-
pkg_mgr_openbsd_pkg
tasks
:
-
name
:
Apply system patches
command
:
syspatch
register
:
syspatch
changed_when
:
syspatch.stdout_lines|length >
0
-
name
:
Update packages
openbsd_pkg
:
name
:
"
*"
state
:
latest
register
:
pkg_upgrade
-
name
:
Update firmware
command
:
fw_update -a
register
:
fw_update
changed_when
:
fw_update.stdout_lines|length >
0
-
name
:
Set reboot needed fact
set_fact
:
reboot_needed
:
>-
{{ syspatch is changed or
pkg_upgrade is changed or
fw_update is changed }}
tags
:
-
openbsd
-
update
-
name
:
Reboot NS1
hosts
:
-
ns1
tasks
:
-
name
:
Reboot
when
:
reboot_needed
reboot
:
tags
:
-
reboot
-
name
:
Reboot EA6350
hosts
:
-
ea6350
tasks
:
-
name
:
Reboot
when
:
reboot_needed
command
:
reboot
-
name
:
Wait to re-establish the connection
wait_for_connection
:
tags
:
-
reboot
-
name
:
Reboot the rest
hosts
:
-
all:!ns1:!ea6350
tasks
:
-
name
:
Wait to re-establish the connection
wait_for_connection
:
-
name
:
Reboot
when
:
reboot_needed
reboot
:
tags
:
-
reboot
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment