From 6f5455f6c525d5e5acedc8f5fcace1c2a9279423 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Wed, 28 Apr 2021 16:28:39 +0200 Subject: Adds unattended upgrades as role --- composer.json | 20 +- composer.lock | 371 ++++++++++------------- src/BaseServerSetup.php | 30 +- src/unattended-upgrades/auto-upgrades.twig | 25 -- src/unattended-upgrades/unattended-upgrades.php | 140 --------- src/unattended-upgrades/unattended-upgrades.twig | 117 ------- 6 files changed, 163 insertions(+), 540 deletions(-) delete mode 100644 src/unattended-upgrades/auto-upgrades.twig delete mode 100644 src/unattended-upgrades/unattended-upgrades.php delete mode 100644 src/unattended-upgrades/unattended-upgrades.twig diff --git a/composer.json b/composer.json index b7eadb6..6385f29 100644 --- a/composer.json +++ b/composer.json @@ -8,11 +8,12 @@ ], "require": { "php": "^8.0", - "php-iac/role": "*" + "dweipert/unattended-upgrades": "^1.0", + "php-iac/role": "^1.0" }, "require-dev": { - "php-iac/modules": "*", - "php-iac/php-iac": "*" + "php-iac/modules": "^1.0", + "php-iac/php-iac": "^1.0" }, "autoload": { "psr-4": { @@ -21,19 +22,10 @@ }, "repositories": [ { - "type": "path", - "url": "../role" - }, - { - "type": "path", - "url": "../php-iac-cli" - }, - { - "type": "path", - "url": "../modules" + "type": "git", + "url": "https://gitlab.com/dweipert.de/devops/php-iac/unattended-upgrades" } ], - "minimum-stability": "dev", "scripts": { "test": "phpiac --config=./test/config.php" } diff --git a/composer.lock b/composer.lock index b52935a..5f4f31e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,22 +4,61 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "31ceed36455e6519a1b2322dace22686", + "content-hash": "6959692dcd0a78e1fc6cacf2d38d1a52", "packages": [ + { + "name": "dweipert/unattended-upgrades", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://gitlab.com/dweipert.de/devops/php-iac/unattended-upgrades", + "reference": "50c2fbafe6bf15909b893ddf0c862af3f7e848cb" + }, + "require": { + "php-iac/role": "^1.0" + }, + "require-dev": { + "php-iac/php-iac": "^1.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Dweipert\\DevOps\\UnattendedUpgrades\\": "src" + } + }, + "scripts": { + "test": [ + "phpiac --config=./test/config.php" + ] + }, + "authors": [ + { + "name": "Daniel Weipert", + "email": "code@drogueronin.de" + } + ], + "time": "2021-04-28T12:49:16+00:00" + }, { "name": "php-iac/role", - "version": "dev-main", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://gitlab.com/php-iac/role.git", + "reference": "3b2ebc616568f60919bd25aa4f3d31ceca201617" + }, "dist": { - "type": "path", - "url": "../role", - "reference": "a8ddac7859f7139ce13d244c7dd39fae6ed07db0" + "type": "zip", + "url": "https://gitlab.com/api/v4/projects/php-iac%2Frole/repository/archive.zip?sha=3b2ebc616568f60919bd25aa4f3d31ceca201617", + "reference": "3b2ebc616568f60919bd25aa4f3d31ceca201617", + "shasum": "" }, "require": { "php": "^8.0" }, "require-dev": { - "php-iac/modules": "*", - "php-iac/php-iac": "*" + "php-iac/modules": "^1.0", + "php-iac/php-iac": "^1.0" }, "type": "library", "autoload": { @@ -27,15 +66,20 @@ "PHPIAC\\Role\\": "src" } }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "AGPL-3.0-only" + ], "authors": [ { "name": "Daniel Weipert", "email": "code@drogueronin.de" } ], - "transport-options": { - "relative": true - } + "support": { + "issues": "https://gitlab.com/api/v4/projects/25988498/issues" + }, + "time": "2021-04-28T14:12:03+00:00" } ], "packages-dev": [ @@ -157,64 +201,25 @@ "time": "2020-10-15T08:29:30+00:00" }, { - "name": "petrknap/php-singleton", - "version": "v1.0.0", + "name": "php-iac/modules", + "version": "v1.0.1", "source": { "type": "git", - "url": "https://github.com/petrknap/php-singleton.git", - "reference": "dec131d0d6c72dd76b5a5c7940f04f14f5df7a20" + "url": "https://gitlab.com/php-iac/modules.git", + "reference": "b5aab3b2428889a9ba27bf41af68249c0a0c7199" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/petrknap/php-singleton/zipball/dec131d0d6c72dd76b5a5c7940f04f14f5df7a20", - "reference": "dec131d0d6c72dd76b5a5c7940f04f14f5df7a20", + "url": "https://gitlab.com/api/v4/projects/php-iac%2Fmodules/repository/archive.zip?sha=b5aab3b2428889a9ba27bf41af68249c0a0c7199", + "reference": "b5aab3b2428889a9ba27bf41af68249c0a0c7199", "shasum": "" }, - "require": { - "php": ">=5.4" - }, - "require-dev": { - "phpunit/phpunit": "4.*" - }, - "type": "library", - "autoload": { - "psr-4": { - "PetrKnap\\Php\\Singleton\\": "src/Singleton" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Petr Knap", - "email": "dev@petrknap.cz", - "homepage": "http://petrknap.cz" - } - ], - "description": "Singleton pattern for PHP", - "homepage": "https://github.com/petrknap/php-singleton", - "support": { - "issues": "https://github.com/petrknap/php-singleton/issues", - "source": "https://github.com/petrknap/php-singleton/tree/master" - }, - "time": "2016-09-22T07:59:18+00:00" - }, - { - "name": "php-iac/modules", - "version": "dev-main", - "dist": { - "type": "path", - "url": "../modules", - "reference": "d4d5ae3bb6566311b2d42cf888e463b62f6cf0dc" - }, "require": { "php": "^8.0", "twig/twig": "^3.0" }, "require-dev": { - "php-iac/php-iac": "*" + "php-iac/php-iac": "^1.0" }, "type": "library", "autoload": { @@ -222,29 +227,39 @@ "PHPIAC\\Modules\\": "src" } }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "AGPL-3.0-only" + ], "authors": [ { "name": "Daniel Weipert", "email": "code@drogueronin.de" } ], - "transport-options": { - "relative": true - } + "support": { + "issues": "https://gitlab.com/api/v4/projects/25988482/issues" + }, + "time": "2021-04-28T14:11:42+00:00" }, { "name": "php-iac/php-iac", - "version": "dev-main", + "version": "v1.0.2", + "source": { + "type": "git", + "url": "https://gitlab.com/php-iac/php-iac.git", + "reference": "b3160d7bfd29288fcbfe528e4fd1fcd80864807f" + }, "dist": { - "type": "path", - "url": "../php-iac-cli", - "reference": "3983548e7c0f107fa7b7cc3c4c36aa009590b481" + "type": "zip", + "url": "https://gitlab.com/api/v4/projects/php-iac%2Fphp-iac/repository/archive.zip?sha=b3160d7bfd29288fcbfe528e4fd1fcd80864807f", + "reference": "b3160d7bfd29288fcbfe528e4fd1fcd80864807f", + "shasum": "" }, "require": { - "petrknap/php-singleton": "^1.0", "php": "^8.0", - "php-iac/modules": "*", - "php-iac/role": "*", + "php-iac/modules": "^1.0", + "php-iac/role": "^1.0", "phpseclib/phpseclib": "^3.0", "symfony/console": "^5.2" }, @@ -257,11 +272,7 @@ "PHPIAC\\": "src" } }, - "scripts": { - "compile": [ - "@php -dphar.readonly=0 bin/compile" - ] - }, + "notification-url": "https://packagist.org/downloads/", "license": [ "AGPL-3.0-only" ], @@ -271,13 +282,14 @@ "email": "code@drogueronin.de" } ], - "transport-options": { - "relative": true - } + "support": { + "issues": "https://gitlab.com/api/v4/projects/25973629/issues" + }, + "time": "2021-04-28T14:48:48+00:00" }, { "name": "phpseclib/phpseclib", - "version": "3.0.x-dev", + "version": "3.0.8", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", @@ -368,7 +380,7 @@ ], "support": { "issues": "https://github.com/phpseclib/phpseclib/issues", - "source": "https://github.com/phpseclib/phpseclib/tree/3.0" + "source": "https://github.com/phpseclib/phpseclib/tree/3.0.8" }, "funding": [ { @@ -388,7 +400,7 @@ }, { "name": "psr/container", - "version": "1.1.x-dev", + "version": "1.1.1", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", @@ -430,27 +442,26 @@ ], "support": { "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/1.1.x" + "source": "https://github.com/php-fig/container/tree/1.1.1" }, "time": "2021-03-05T17:36:06+00:00" }, { "name": "symfony/console", - "version": "5.x-dev", + "version": "v5.2.6", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "1d077bd682f7c0794d5f5b794b16e2b30febec6b" + "reference": "35f039df40a3b335ebf310f244cb242b3a83ac8d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/1d077bd682f7c0794d5f5b794b16e2b30febec6b", - "reference": "1d077bd682f7c0794d5f5b794b16e2b30febec6b", + "url": "https://api.github.com/repos/symfony/console/zipball/35f039df40a3b335ebf310f244cb242b3a83ac8d", + "reference": "35f039df40a3b335ebf310f244cb242b3a83ac8d", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", "symfony/polyfill-mbstring": "~1.0", "symfony/polyfill-php73": "^1.8", "symfony/polyfill-php80": "^1.15", @@ -482,7 +493,6 @@ "symfony/lock": "", "symfony/process": "" }, - "default-branch": true, "type": "library", "autoload": { "psr-4": { @@ -515,75 +525,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.3.0-BETA1" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-04-16T17:36:28+00:00" - }, - { - "name": "symfony/deprecation-contracts", - "version": "dev-main", - "source": { - "type": "git", - "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/5f38c8804a9e97d23e0c8d63341088cd8a22d627", - "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "default-branch": true, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "2.4-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "autoload": { - "files": [ - "function.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "A generic function and convention to trigger deprecation notices", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.4.0" + "source": "https://github.com/symfony/console/tree/v5.2.6" }, "funding": [ { @@ -599,20 +541,20 @@ "type": "tidelift" } ], - "time": "2021-03-23T23:28:01+00:00" + "time": "2021-03-28T09:42:18+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "dev-main", + "version": "v1.22.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" + "reference": "c6c942b1ac76c82448322025e084cadc56048b4e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/c6c942b1ac76c82448322025e084cadc56048b4e", + "reference": "c6c942b1ac76c82448322025e084cadc56048b4e", "shasum": "" }, "require": { @@ -621,11 +563,10 @@ "suggest": { "ext-ctype": "For best performance" }, - "default-branch": true, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill", @@ -663,7 +604,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/main" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.22.1" }, "funding": [ { @@ -679,20 +620,20 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2021-01-07T16:49:33+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "dev-main", + "version": "v1.22.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "053f7184175d5417c933817341c5cc0053ddacd5" + "reference": "5601e09b69f26c1828b13b6bb87cb07cddba3170" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/053f7184175d5417c933817341c5cc0053ddacd5", - "reference": "053f7184175d5417c933817341c5cc0053ddacd5", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/5601e09b69f26c1828b13b6bb87cb07cddba3170", + "reference": "5601e09b69f26c1828b13b6bb87cb07cddba3170", "shasum": "" }, "require": { @@ -701,11 +642,10 @@ "suggest": { "ext-intl": "For best performance" }, - "default-branch": true, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill", @@ -745,7 +685,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/main" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.22.1" }, "funding": [ { @@ -761,20 +701,20 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2021-01-22T09:19:47+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "dev-main", + "version": "v1.22.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8" + "reference": "43a0283138253ed1d48d352ab6d0bdb3f809f248" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8590a5f561694770bdcd3f9b5c69dde6945028e8", - "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/43a0283138253ed1d48d352ab6d0bdb3f809f248", + "reference": "43a0283138253ed1d48d352ab6d0bdb3f809f248", "shasum": "" }, "require": { @@ -783,11 +723,10 @@ "suggest": { "ext-intl": "For best performance" }, - "default-branch": true, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill", @@ -830,7 +769,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/main" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.22.1" }, "funding": [ { @@ -846,20 +785,20 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2021-01-22T09:19:47+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "dev-main", + "version": "v1.22.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "298b87cbbe99cb2c9f88fb1d1de78833b64b483e" + "reference": "5232de97ee3b75b0360528dae24e73db49566ab1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/298b87cbbe99cb2c9f88fb1d1de78833b64b483e", - "reference": "298b87cbbe99cb2c9f88fb1d1de78833b64b483e", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/5232de97ee3b75b0360528dae24e73db49566ab1", + "reference": "5232de97ee3b75b0360528dae24e73db49566ab1", "shasum": "" }, "require": { @@ -868,11 +807,10 @@ "suggest": { "ext-mbstring": "For best performance" }, - "default-branch": true, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill", @@ -911,7 +849,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/main" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.22.1" }, "funding": [ { @@ -927,30 +865,29 @@ "type": "tidelift" } ], - "time": "2021-04-19T09:32:22+00:00" + "time": "2021-01-22T09:19:47+00:00" }, { "name": "symfony/polyfill-php73", - "version": "dev-main", + "version": "v1.22.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010" + "reference": "a678b42e92f86eca04b7fa4c0f6f19d097fb69e2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fba8933c384d6476ab14fb7b8526e5287ca7e010", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/a678b42e92f86eca04b7fa4c0f6f19d097fb69e2", + "reference": "a678b42e92f86eca04b7fa4c0f6f19d097fb69e2", "shasum": "" }, "require": { "php": ">=7.1" }, - "default-branch": true, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill", @@ -991,7 +928,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/main" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.22.1" }, "funding": [ { @@ -1007,30 +944,29 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2021-01-07T16:49:33+00:00" }, { "name": "symfony/polyfill-php80", - "version": "dev-main", + "version": "v1.22.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "eca0bf41ed421bed1b57c4958bab16aa86b757d0" + "reference": "dc3063ba22c2a1fd2f45ed856374d79114998f91" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/eca0bf41ed421bed1b57c4958bab16aa86b757d0", - "reference": "eca0bf41ed421bed1b57c4958bab16aa86b757d0", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/dc3063ba22c2a1fd2f45ed856374d79114998f91", + "reference": "dc3063ba22c2a1fd2f45ed856374d79114998f91", "shasum": "" }, "require": { "php": ">=7.1" }, - "default-branch": true, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill", @@ -1075,7 +1011,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/main" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.22.1" }, "funding": [ { @@ -1091,11 +1027,11 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2021-01-07T16:49:33+00:00" }, { "name": "symfony/service-contracts", - "version": "dev-main", + "version": "v2.4.0", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", @@ -1114,7 +1050,6 @@ "suggest": { "symfony/service-implementation": "" }, - "default-branch": true, "type": "library", "extra": { "branch-alias": { @@ -1175,16 +1110,16 @@ }, { "name": "symfony/string", - "version": "5.x-dev", + "version": "v5.2.6", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "01454c66c88a6bb4449dcdeb913e463e075f331b" + "reference": "ad0bd91bce2054103f5eaa18ebeba8d3bc2a0572" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/01454c66c88a6bb4449dcdeb913e463e075f331b", - "reference": "01454c66c88a6bb4449dcdeb913e463e075f331b", + "url": "https://api.github.com/repos/symfony/string/zipball/ad0bd91bce2054103f5eaa18ebeba8d3bc2a0572", + "reference": "ad0bd91bce2054103f5eaa18ebeba8d3bc2a0572", "shasum": "" }, "require": { @@ -1201,7 +1136,6 @@ "symfony/translation-contracts": "^1.1|^2", "symfony/var-exporter": "^4.4|^5.0" }, - "default-branch": true, "type": "library", "autoload": { "psr-4": { @@ -1239,7 +1173,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.3.0-BETA1" + "source": "https://github.com/symfony/string/tree/v5.2.6" }, "funding": [ { @@ -1255,20 +1189,20 @@ "type": "tidelift" } ], - "time": "2021-03-17T17:12:23+00:00" + "time": "2021-03-17T17:12:15+00:00" }, { "name": "twig/twig", - "version": "3.x-dev", + "version": "v3.3.0", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "32d72de1885889452f3d8aa298a90b04d263651b" + "reference": "1f3b7e2c06cc05d42936a8ad508ff1db7975cdc5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/32d72de1885889452f3d8aa298a90b04d263651b", - "reference": "32d72de1885889452f3d8aa298a90b04d263651b", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/1f3b7e2c06cc05d42936a8ad508ff1db7975cdc5", + "reference": "1f3b7e2c06cc05d42936a8ad508ff1db7975cdc5", "shasum": "" }, "require": { @@ -1280,7 +1214,6 @@ "psr/container": "^1.0", "symfony/phpunit-bridge": "^4.4.9|^5.0.9" }, - "default-branch": true, "type": "library", "extra": { "branch-alias": { @@ -1320,7 +1253,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/3.x" + "source": "https://github.com/twigphp/Twig/tree/v3.3.0" }, "funding": [ { @@ -1332,11 +1265,11 @@ "type": "tidelift" } ], - "time": "2021-04-15T10:09:30+00:00" + "time": "2021-02-08T09:54:36+00:00" } ], "aliases": [], - "minimum-stability": "dev", + "minimum-stability": "stable", "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, 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, diff --git a/src/unattended-upgrades/auto-upgrades.twig b/src/unattended-upgrades/auto-upgrades.twig deleted file mode 100644 index 388a028..0000000 --- a/src/unattended-upgrades/auto-upgrades.twig +++ /dev/null @@ -1,25 +0,0 @@ -APT::Periodic::Unattended-Upgrade "1"; - -{% if unattended_update_package_list is defined %} -APT::Periodic::Update-Package-Lists "{{unattended_update_package_list}}"; -{% endif %} - -{% if unattended_download_upgradeable is defined %} -APT::Periodic::Download-Upgradeable-Packages "{{unattended_download_upgradeable}}"; -{% endif %} - -{% if unattended_autoclean_interval is defined %} -APT::Periodic::AutocleanInterval "{{unattended_autoclean_interval}}"; -{% endif %} - -{% if unattended_clean_interval is defined %} -APT::Periodic::CleanInterval "{{unattended_clean_interval}}"; -{% endif %} - -{% if unattended_verbose is defined %} -APT::Periodic::Verbose "{{unattended_verbose}}"; -{% endif %} - -{% if unattended_random_sleep is defined %} -APT::Periodic::RandomSleep "{{unattended_random_sleep}}"; -{% endif %} diff --git a/src/unattended-upgrades/unattended-upgrades.php b/src/unattended-upgrades/unattended-upgrades.php deleted file mode 100644 index 1c3f73c..0000000 --- a/src/unattended-upgrades/unattended-upgrades.php +++ /dev/null @@ -1,140 +0,0 @@ - 3600, - - #Unattended-Upgrade::Origins-Pattern - # Automatically upgrade packages from these origin patterns - # e.g.: 'o=Debian,a=stable', 'o=Debian,a=stable-updates' - # - # Left unset, distribution-specific defaults will be used through - # __unattended_origins_patterns variable only if this variable - # is not provided externally - # REFS https://github.com/ansible/ansible/issues/8121 - #'unattended_origins_patterns' => [], - - #Unattended-Upgrade::Package-Blacklist - # List of packages to not update - 'unattended_package_blacklist' => [], - - #Unattended-Upgrade::AutoFixInterruptedDpkg - # On a unclean dpkg exit unattended-upgrades will run - # dpkg --force-confold --configure -a - # The default is true, to ensure updates keep getting installed - 'unattended_autofix_interrupted_dpkg' => true, - - #Unattended-Upgrade::MinimalSteps - # Split the upgrade into the smallest possible chunks so that - # they can be interrupted with SIGUSR1. This makes the upgrade - # a bit slower but it has the benefit that shutdown while a upgrade - # is running is possible (with a small delay) - 'unattended_minimal_steps' => true, - - #Unattended-Upgrade::InstallOnShutdown - # Install all unattended-upgrades when the machine is shuting down - # instead of doing it in the background while the machine is running - # This will (obviously) make shutdown slower - 'unattended_install_on_shutdown' => false, - - #Unattended-Upgrade::Mail - # Send email to this address for problems or packages upgrades - # If empty or unset then no email is sent, make sure that you - # have a working mail setup on your system. A package that provides - # 'mailx' must be installed. - 'unattended_mail' => false, - - #Unattended-Upgrade::MailOnlyOnError - # Set this value to "true" to get emails only on errors. Default - # is to always send a mail if Unattended-Upgrade::Mail is set - 'unattended_mail_only_on_error' => false, - - #Unattended-Upgrade::Remove-Unused-Dependencies - # Do automatic removal of all unused dependencies after the upgrade - # (equivalent to apt-get autoremove) - 'unattended_remove_unused_dependencies' => false, - - #Unattended-Upgrade::Remove-New-Unused-Dependencies - # Remove any new unused dependencies after the upgrade - 'unattended_remove_new_unused_dependencies' => true, - - #Unattended-Upgrade::Automatic-Reboot - # Automatically reboot *WITHOUT CONFIRMATION* if a - # the file /var/run/reboot-required is found after the upgrade - 'unattended_automatic_reboot' => false, - - #Unattended-Upgrade::Automatic-Reboot-Time - # If automatic reboot is enabled and needed, reboot at the specific - # time instead of immediately - 'unattended_automatic_reboot_time' => false, - - #Unattended-Upgrade::IgnoreAppsRequireRestart - # Do upgrade application even if it requires restart after upgrade - # I.e. "XB-Upgrade-Requires: app-restart" is set in the debian/control file - 'unattended_ignore_apps_require_restart' => false, - - #Unattended-Upgrade::SyslogEnable - # Write events to syslog, which is useful in environments where syslog - # messages are sent to a central store. - 'unattended_syslog_enable' => false, - - #Unattended-Upgrade::SyslogFacility - # Write events to the specified syslog facility, or the daemon facility if - # not specified. Requires the Unattended-Upgrade::SyslogEnable option to be - # set to true. - #'unattended_syslog_facility' => 'daemon', - - ### APT::Periodic configuration - # Snatched from /usr/lib/apt/apt.systemd.daily - - #APT::Periodic::Update-Package-Lists "0"; - # - Do "apt-get update" automatically every n-days (0=disable) - 'unattended_update_package_list' => 1, - - #APT::Periodic::Download-Upgradeable-Packages "0"; - # - Do "apt-get upgrade --download-only" every n-days (0=disable) - #'unattended_download_upgradeable' => 0, - - #APT::Periodic::AutocleanInterval "0"; - # - Do "apt-get autoclean" every n-days (0=disable) - 'unattended_autoclean_interval' => 7, - - #APT::Periodic::CleanInterval "0"; - # - Do "apt-get clean" every n-days (0=disable) - #'unattended_clean_interval' => 0, - - #APT::Periodic::Verbose "0"; - # - Send report mail to root - # 0: no report (or null string) - # 1: progress report (actually any string) - # 2: + command outputs (remove -qq, remove 2>/dev/null, add -d) - # 3: + trace on - #'unattended_verbose' => 0, - - ## Cron systems only - - #APT::Periodic::RandomSleep - # When the apt job starts, it will sleep for a random period between 0 - # and APT::Periodic::RandomSleep seconds - # The default value is "1800" so that the script will stall for up to 30 - # minutes (1800 seconds) so that the mirror servers are not crushed by - # everyone running their updates all at the same time - # Kept undefined to allow default (1800) - #'unattended_random_sleep' => 0, - - #Dpkg::Options - # Provide dpkg options that take effect during unattended upgrades. - # By default no flags are appended. Configuration file changes can - # block installation of certain packages. Passing the flags - # "--force-confdef" and "--force-confold" will ensure updates are applied - # and old configuration files are preserved. - 'unattended_dpkg_options' => [], - - # 'unattended_dpkg_options' => [ - # '--force-confdef', - # '--force-confold', - # ], - - # Use apt bandwidth limit feature, this example limits the download speed to 70kb/sec - #'unattended_dl_limit' => 70, -]; diff --git a/src/unattended-upgrades/unattended-upgrades.twig b/src/unattended-upgrades/unattended-upgrades.twig deleted file mode 100644 index 0796f6b..0000000 --- a/src/unattended-upgrades/unattended-upgrades.twig +++ /dev/null @@ -1,117 +0,0 @@ -// Unattended-Upgrade::Origins-Pattern controls which packages are -// upgraded. -Unattended-Upgrade::Origins-Pattern { -{% if unattended_origins_patterns is defined %} -{% for origin in unattended_origins_patterns %} - "{{ origin }}"; -{% endfor %} -{% endif %} -}; - -// List of packages to not update (regexp are supported) -Unattended-Upgrade::Package-Blacklist { -{% for package in unattended_package_blacklist %} - "{{ package }}"; -{% endfor %} -}; - -{% if not unattended_autofix_interrupted_dpkg %} -// This option allows you to control if on a unclean dpkg exit -// unattended-upgrades will automatically run -// dpkg --force-confold --configure -a -// The default is true, to ensure updates keep getting installed -Unattended-Upgrade::AutoFixInterruptedDpkg "false"; -{% endif %} - -// Split the upgrade into the smallest possible chunks so that -// they can be interrupted with SIGUSR1. This makes the upgrade -// a bit slower but it has the benefit that shutdown while a upgrade -// is running is possible (with a small delay) -Unattended-Upgrade::MinimalSteps "{{ unattended_minimal_steps | lower }}"; - -{% if unattended_install_on_shutdown %} -// Install all unattended-upgrades when the machine is shuting down -// instead of doing it in the background while the machine is running -// This will (obviously) make shutdown slower -Unattended-Upgrade::InstallOnShutdown "true"; -{% endif %} - -{% if unattended_mail %} -// Send email to this address for problems or packages upgrades -// If empty or unset then no email is sent, make sure that you -// have a working mail setup on your system. A package that provides -// 'mailx' must be installed. -Unattended-Upgrade::Mail "{{ unattended_mail }}"; -{% endif %} - -{% if unattended_mail_only_on_error %} -// Set this value to "true" to get emails only on errors. Default -// is to always send a mail if Unattended-Upgrade::Mail is set -Unattended-Upgrade::MailOnlyOnError "true"; -{% endif %} - -{% if unattended_remove_unused_dependencies %} -// Do automatic removal of all unused dependencies after the upgrade -// (equivalent to apt-get autoremove) -Unattended-Upgrade::Remove-Unused-Dependencies "true"; -{% endif %} - -{% if not unattended_remove_new_unused_dependencies %} -// Do automatic removal of new unused dependencies after the upgrade -Unattended-Upgrade::Remove-New-Unused-Dependencies "false"; -{% endif %} - -{% if unattended_automatic_reboot %} -// Automatically reboot *WITHOUT CONFIRMATION* if a -// the file /var/run/reboot-required is found after the upgrade -Unattended-Upgrade::Automatic-Reboot "true"; -{% endif %} - -{% if unattended_automatic_reboot_time %} -// If automatic reboot is enabled and needed, reboot at the specific -// time instead of immediately -// Default: "now" -Unattended-Upgrade::Automatic-Reboot-Time "{{ unattended_automatic_reboot_time }}"; -{% endif %} - -{% if unattended_update_days is defined %} -// Set the days of the week that updates should be applied. The days can be specified -// as localized abbreviated or full names. Or as integers where "0" is Sunday, "1" is -// Monday etc. -// Example - apply updates only on Monday and Friday: -// {"Mon";"Fri"}; -Unattended-Upgrade::Update-Days {{ unattended_update_days }}; -{% endif %} - -{% if unattended_ignore_apps_require_restart %} -// Do upgrade application even if it requires restart after upgrade -// I.e. "XB-Upgrade-Requires: app-restart" is set in the debian/control file -Unattended-Upgrade::IgnoreAppsRequireRestart "true"; -{% endif %} - -{% if unattended_syslog_enable %} -// Write events to syslog, which is useful in environments where syslog -// messages are sent to a central store. -Unattended-Upgrade::SyslogEnable "{{ unattended_syslog_enable }}"; -{% if unattended_syslog_facility is defined %} -// Write events to the specified syslog facility, or the daemon facility -// if not specified. Requires the Unattended-Upgrade::SyslogEnable option -// to be set to true. -Unattended-Upgrade::SyslogFacility "{{ unattended_syslog_facility }}"; -{% endif %} -{% endif %} - -{% if unattended_dpkg_options %} -// Append options for governing dpkg behavior, e.g. --force-confdef. -Dpkg::Options { -{% for dpkg_option in unattended_dpkg_options %} - "{{ dpkg_option }}"; -{% endfor %} -}; -{% endif %} - -{% if unattended_dl_limit is defined %} -// Use apt bandwidth limit feature, this example limits the download -// speed to 70kb/sec -Acquire::http::Dl-Limit "{{ unattended_dl_limit }}"; -{% endif %} -- cgit v1.2.3