Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.package
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ivan Tyagov
slapos.package
Commits
107106a0
Commit
107106a0
authored
Sep 27, 2023
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
playbook/ors: split ors playbook into ors and ors-image-backports
parent
ae51c4b8
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
47 additions
and
72 deletions
+47
-72
playbook/ors-image-backports.yml
playbook/ors-image-backports.yml
+9
-0
playbook/ors.yml
playbook/ors.yml
+1
-0
playbook/ors_backport_after
playbook/ors_backport_after
+1
-0
playbook/roles/ors-image-backports/files/configure-grub
playbook/roles/ors-image-backports/files/configure-grub
+16
-0
playbook/roles/ors-image-backports/files/systemd-dhcp-network
...book/roles/ors-image-backports/files/systemd-dhcp-network
+0
-0
playbook/roles/ors-image-backports/files/systemd-wait-online-override
...es/ors-image-backports/files/systemd-wait-online-override
+0
-0
playbook/roles/ors-image-backports/meta/main.yml
playbook/roles/ors-image-backports/meta/main.yml
+3
-0
playbook/roles/ors-image-backports/tasks/main.yml
playbook/roles/ors-image-backports/tasks/main.yml
+2
-0
playbook/roles/ors/tasks/main.yml
playbook/roles/ors/tasks/main.yml
+14
-71
playbook/sha256sum
playbook/sha256sum
+1
-1
No files found.
playbook/ors-image-backports.yml
0 → 100644
View file @
107106a0
-
name
:
a play that runs entirely on the ansible host
hosts
:
127.0.0.1
connection
:
local
vars_files
:
-
settings/ors.yml
roles
:
-
ors-image-backports
playbook/ors.yml
View file @
107106a0
...
@@ -13,4 +13,5 @@
...
@@ -13,4 +13,5 @@
-
settings/ors.yml
-
settings/ors.yml
roles
:
roles
:
-
ors-image-backports
-
ors
-
ors
playbook/ors_backport_after
0 → 100644
View file @
107106a0
1696519344
playbook/roles/ors-image-backports/files/configure-grub
0 → 100755
View file @
107106a0
#!/bin/bash
CONF
=
"/etc/default/grub"
BAK
=
"/tmp/default.grub"
N_CORE
=
"
$((
$(
lscpu |
sed
-n
's/^Core.*: *\([0-9]*\)/\1/gp'
)
*
$(
lscpu |
sed
-n
's/^Socket.*: *\([0-9]*\)/\1/gp'
)
))
"
cp
$CONF
$BAK
;
if
!
(
grep
-q
idle
=
halt /proc/cmdline
&&
grep
-q
"maxcpus=
$N_CORE
"
/proc/cmdline
)
;
then
sed
-i
's/^\(GRUB_CMDLINE_LINUX_DEFAULT.*\)idle=[a-z]* *\(.*\)/\1\2/g'
$CONF
;
sed
-i
's/^\(GRUB_CMDLINE_LINUX_DEFAULT.*\)"/\1 idle=halt"/g'
$CONF
;
sed
-i
's/^\(GRUB_CMDLINE_LINUX_DEFAULT.*\)maxcpus=[0-9]* *\(.*\)/\1\2/g'
$CONF
;
sed
-i
's/^\(GRUB_CMDLINE_LINUX_DEFAULT.*\)"/\1 maxcpus='
"
$N_CORE
"
'"/g'
$CONF
;
if
!
update-grub
;
then
cp
$BAK
$CONF
;
update-grub
;
fi
fi
rm
-f
$BAK
;
playbook/roles/ors/files/systemd-dhcp-network
→
playbook/roles/ors
-image-backports
/files/systemd-dhcp-network
View file @
107106a0
File moved
playbook/roles/ors/files/systemd-wait-online-override
→
playbook/roles/ors
-image-backports
/files/systemd-wait-online-override
View file @
107106a0
File moved
playbook/roles/ors-image-backports/meta/main.yml
0 → 100644
View file @
107106a0
---
dependencies
:
-
{
role
:
package
,
package_name
:
ifupdown
,
package_state
:
absent
}
playbook/roles/ors-image-backports/tasks/main.yml
View file @
107106a0
...
@@ -62,6 +62,8 @@
...
@@ -62,6 +62,8 @@
-
name
:
Enable and stop systemd-networkd
-
name
:
Enable and stop systemd-networkd
systemd
:
name=systemd-networkd.service enabled=yes state=stopped
systemd
:
name=systemd-networkd.service enabled=yes state=stopped
## Don't use role repository because package needs to be removed after installing systemd-networkd
-
name
:
Remove ifupdown
-
name
:
Remove ifupdown
shell
:
'
DEBIAN_FRONTEND="noninteractive"
apt
remove
--purge
-y
ifupdown'
shell
:
'
DEBIAN_FRONTEND="noninteractive"
apt
remove
--purge
-y
ifupdown'
...
...
playbook/roles/ors/tasks/main.yml
View file @
107106a0
...
@@ -3,34 +3,25 @@
...
@@ -3,34 +3,25 @@
-
name
:
Create /opt/upgrader where some logs will be stored
-
name
:
Create /opt/upgrader where some logs will be stored
file
:
path=/opt/upgrader state=directory mode=0755
file
:
path=/opt/upgrader state=directory mode=0755
#
Legacy
#
SSD image backports
-
name
:
Remove obsolete cron
-
stat
:
path=/opt/upgrader/last-backport
cron
:
name="Launch Upgrader with ansible" state=absen
t
register
:
last_backpor
t
-
name
:
Remove obsolete cron
-
stat
:
path=/opt/upgrader/playbook-tmp/ors_backport_after
cron
:
name="Launch Startup with ansible" state=absent
register
:
ors_backport_after
-
name
:
Remove obsolete cron
-
shell
:
echo 1 > /opt/upgrader/last-backport
cron
:
name="Launch ors playbook periodically" state=absent
when
:
last_backport.stat.exists == False
-
name
:
Remove obsolete cron
-
name
:
Do ors backport
cron
:
name="Launch ors playbook at reboot" state=absent
shell
:
ansible-playbook ors-image-backports.yml -i hosts 2>>/opt/upgrader/ors_backport.log >> /opt/upgrader/ors_backport.log
when
:
(ors_backport_after.stat.exists == True) and (lookup('file', '/opt/upgrader/playbook-tmp/ors_backport_after')|int > lookup('file', '/opt/upgrader/last-backport')|int )
args
:
chdir
:
/opt/upgrader/playbook-tmp/
-
name
:
Remove obsolete cron
-
shell
:
echo {{ ansible_date_time.epoch }} > /opt/upgrader/last-backport
cron
:
name="Launch ors playbook every 3 hours" state=absent
when
:
(ors_backport_after.stat.exists == True) and (lookup('file', '/opt/upgrader/playbook-tmp/ors_backport_after')|int > lookup('file', '/opt/upgrader/last-backport')|int )
-
name
:
Check if Service Exists
stat
:
path=/etc/init.d/init-sdr
register
:
init_sdr_service
-
name
:
Reload daemon
systemd
:
daemon_reload=yes
when
:
init_sdr_service.stat.exists
-
name
:
Disable old init-sdr service
systemd
:
name=init-sdr enabled=no
when
:
init_sdr_service.stat.exists
# Radio Hardware
# Radio Hardware
...
@@ -101,60 +92,12 @@
...
@@ -101,60 +92,12 @@
-
name
:
Configure firewall
-
name
:
Configure firewall
script
:
configure-firewall
script
:
configure-firewall
-
name
:
Configure /etc/systemd/network/dhcp.network
copy
:
src=systemd-dhcp-network dest=/etc/systemd/network/dhcp.network owner=root mode=644
-
name
:
Create a directory if it does not exist
file
:
path=/etc/systemd/system/systemd-networkd-wait-online.service.d state=directory mode=0755
-
name
:
Configure /etc/systemd/system/systemd-networkd-wait-online.service.d/override.conf
copy
:
src=systemd-wait-online-override dest=/etc/systemd/system/systemd-networkd-wait-online.service.d/override.conf owner=root mode=644
-
name
:
Enable and stop systemd-networkd
systemd
:
name=systemd-networkd.service enabled=yes state=stopped
-
name
:
Remove ifupdown
shell
:
'
DEBIAN_FRONTEND="noninteractive"
apt
remove
--purge
-y
ifupdown'
-
name
:
Start systemd-networkd
systemd
:
name=systemd-networkd.service enabled=yes state=started
-
name
:
Configure dhcp timeout
lineinfile
:
dest=/etc/dhcp/dhclient.conf regexp="^timeout (.*)" line="timeout 15" state=present
-
name
:
Configure IPv4 forwarding
-
name
:
Configure IPv4 forwarding
lineinfile
:
dest=/etc/sysctl.conf regexp="^net.ipv4.conf.all.forwarding=(.*)" line="net.ipv4.conf.all.forwarding=1" state=present
lineinfile
:
dest=/etc/sysctl.conf regexp="^net.ipv4.conf.all.forwarding=(.*)" line="net.ipv4.conf.all.forwarding=1" state=present
-
name
:
Configure IPv6 forwarding
-
name
:
Configure IPv6 forwarding
lineinfile
:
dest=/etc/sysctl.conf regexp="^net.ipv6.conf.all.forwarding=(.*)" line="net.ipv6.conf.all.forwarding=1" state=present
lineinfile
:
dest=/etc/sysctl.conf regexp="^net.ipv6.conf.all.forwarding=(.*)" line="net.ipv6.conf.all.forwarding=1" state=present
-
name
:
Disable dnsmasq service
systemd
:
name=dnsmasq.service enabled=no state=stopped
ignore_errors
:
yes
-
name
:
Disable DNS stub resolver
lineinfile
:
dest=/etc/systemd/resolved.conf regexp="(.*)DNSStubListener=(.*)" line="DNSStubListener=no" state=present
register
:
disable_dns_stub
-
name
:
Create resolv symbolic link
file
:
src
:
/run/systemd/resolve/resolv.conf
dest
:
/etc/resolv.conf
state
:
link
force
:
true
register
:
create_resolv_link
-
name
:
Configure default nameservers
lineinfile
:
dest=/etc/systemd/resolved.conf regexp="^DNS=(.*)" line="DNS=1.1.1.1 8.8.8.8" state=present
register
:
configure_default_nameservers
-
name
:
Restart systemd-resolved.service if necessary
systemd
:
name=systemd-resolved.service enabled=yes state=restarted
when
:
(disable_dns_stub.changed) or (create_resolv_link.changed) or (configure_default_nameservers.changed)
-
name
:
Enable and start systemd-resolved.service
systemd
:
name=systemd-resolved.service enabled=yes state=started
-
name
:
Redirect 53 to
5353
-
name
:
Redirect 53 to
5353
ansible.builtin.iptables
:
ansible.builtin.iptables
:
chain
:
PREROUTING
chain
:
PREROUTING
...
...
playbook/sha256sum
View file @
107106a0
3
c460573540179069c4f2d86ca1159e0e7c2d18899e971e75613b5ffb65b4f5b
-
3
0ce2169ae3dc5e2c28dc5ac409f53caa62144f209458aa2508339188d7f3510
-
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment