summaryrefslogtreecommitdiff
path: root/src/BaseServerSetup.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/BaseServerSetup.php')
-rw-r--r--src/BaseServerSetup.php30
1 files changed, 5 insertions, 25 deletions
diff --git a/src/BaseServerSetup.php b/src/BaseServerSetup.php
index 7ff1efb..206d773 100644
--- a/src/BaseServerSetup.php
+++ b/src/BaseServerSetup.php
@@ -2,11 +2,11 @@
namespace Dweipert\DevOps\BaseServerSetup;
+use Dweipert\DevOps\UnattendedUpgrades\UnattendedUpgrades;
use PHPIAC\Module\State;
use PHPIAC\Modules\AptModule;
use PHPIAC\Modules\CopyModule;
use PHPIAC\Modules\GitModule;
-use PHPIAC\Modules\TemplateModule;
use PHPIAC\Modules\UfwModule;
use PHPIAC\Modules\UserModule;
use PHPIAC\Role\RoleInterface;
@@ -17,8 +17,7 @@ class BaseServerSetup implements RoleInterface
public function __invoke(array $config = []): array
{
$config = array_replace_recursive(
- include __DIR__ . '/unattended-upgrades/unattended-upgrades.php',
- [
+ ['unattended_upgrades' => [
'unattended_origins_patterns' => [
'o=${distro_id},a=${distro_codename}',
'o=${distro_id},a=${distro_codename}-security',
@@ -26,32 +25,13 @@ class BaseServerSetup implements RoleInterface
'unattended_mail' => $config['mail'],
'unattended_automatic_reboot' => true,
'unattended_syslog_enable' => true,
- ],
+ ]],
$config
);
return [
# setup unattended upgrades
- (new Task())->setModule(new AptModule([
- 'package' => 'unattended-upgrades',
- 'updateCache' => true,
- ])),
- (new Task())->setModule(new TemplateModule([
- 'src' => __DIR__ . '/unattended-upgrades/auto-upgrades.twig',
- 'dest' => '/etc/apt/apt.conf.d/20auto-upgrades',
- 'vars' => $config,
- 'owner' => 'root',
- 'group' => 'root',
- 'mode' => 0644,
- ])),
- (new Task())->setModule(new TemplateModule([
- 'src' => __DIR__ . '/unattended-upgrades/unattended-upgrades.twig',
- 'dest' => '/etc/apt/apt.conf.d/50unattended-upgrades',
- 'vars' => $config,
- 'owner' => 'root',
- 'group' => 'root',
- 'mode' => 0644,
- ])),
+ ...(new UnattendedUpgrades())($config['unattended_upgrades']),
# setup user
(new Task())->setModule(new AptModule([
@@ -66,7 +46,7 @@ class BaseServerSetup implements RoleInterface
])),
(new Task())->setModule(new CopyModule([
'src' => '~/.ssh',
- 'dest' => '/home/' . $config['username'],
+ 'dest' => '/home/' . $config['username'] . '/.ssh',
'owner' => $config['username'],
'group' => $config['username'],
'remoteSrc' => true,