Added cloud-init example for boinc-client, improved the one for docker

This commit is contained in:
Michele Cereda
2023-02-12 03:06:02 +01:00
parent a601c08d06
commit c308044fa2
2 changed files with 51 additions and 9 deletions

View File

@@ -0,0 +1,42 @@
#cloud-config
yum_repos:
epel:
name: Extra Packages for Enterprise Linux 8 - $basearch
baseurl: https://dl.fedoraproject.org/pub/epel/8/Everything/$basearch
gpgcheck: true
gpgkey: https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8
packages:
- boinc-client
- boinc-tui
bootcmd:
# `cloud-init` has issues with `firewall-cmd`.
# Using the offline version.
- firewall-offline-cmd --add-port='31416/tcp' --zone='public'
runcmd:
- grep -q 'boinc' '/etc/group' && sudo usermod -a -G 'boinc' 'opc'
- chown -R 'boinc:boinc' '/var/lib/boinc'
- systemctl enable --now 'boinc-client.service'
- sleep '5s'
- boinccmd --acct_mgr attach 'acct_mgr_url' 'acct_mgr_user' 'acct_mgr_password'
- systemctl reload 'firewalld.service'
write_files:
- path: /var/lib/boinc/gui_rpc_auth.cfg
permissions: '0640'
content: |
gui_rpc_password
- path: /var/lib/boinc/cc_config.xml
content: |
<cc_config>
<options>
<allow_remote_gui_rpc>1</allow_remote_gui_rpc>
</options>
</cc_config>
- path: /var/lib/boinc/remote_hosts.cfg
content: |
192.168.1.10
192.168.1.115

View File

@@ -6,23 +6,19 @@
# Add the official Docker repository.
#
# Got from the official installation guide at
# https://docs.docker.com/engine/install/rhel/#install-using-the-repository :
# yum install -y yum-utils && \
# yum-config-manager --add-repo \
# https://download.docker.com/linux/rhel/docker-ce.repo && \
# cat /etc/yum.repos.d/docker-ce.repo
# https://docs.docker.com/engine/install/
#
# Sources:
# - https://cloudinit.readthedocs.io/en/latest/topics/modules.html#yum-add-repo
# - https://cloudinit.readthedocs.io/en/latest/topics/examples.html#adding-a-yum-repository
yum_repos:
docker-ce:
docker-ce-stable:
name: Docker CE Stable - $basearch
enabled: true
baseurl: https://download.docker.com/linux/rhel/$releasever/$basearch/stable
baseurl: https://download.docker.com/linux/centos/$releasever/$basearch/stable
priority: 1
gpgcheck: true
gpgkey: https://download.docker.com/linux/rhel/gpg
gpgkey: https://download.docker.com/linux/centos/gpg
# Install required packages.
# This will *always* update the list of packages, regardless of the value of the
@@ -35,8 +31,12 @@ yum_repos:
# - https://cloudinit.readthedocs.io/en/latest/topics/examples.html#install-arbitrary-packages
packages:
- docker-ce
- docker-compose-plugin
# Enable and start the service after installation
runcmd:
# Enable and start the service after installation.
- systemctl daemon-reload
- systemctl enable --now docker.service
# Give the default user permission to use docker without privilege escalation.
- grep docker /etc/group -q && sudo usermod -a -G docker user