Skip to content

Instantly share code, notes, and snippets.

@sbeliakou
Created March 13, 2021 22:50
Show Gist options
  • Save sbeliakou/1847bc95b93b310a30c270e5e6b1169b to your computer and use it in GitHub Desktop.
Save sbeliakou/1847bc95b93b310a30c270e5e6b1169b to your computer and use it in GitHub Desktop.
Cloning into 'aliaksei_kakhavets'...
name: aliaksei_kakhavets, master/9c25642 @ 2021-03-11 08:32:46 +0000
2021/03/13 22:33:25 config: tests/tomcat.yml
2021/03/13 22:33:25 verbosity: 2
2021/03/13 22:33:25 -----------------------------------------------------------------------------------
2021/03/13 22:33:25 Running '1.1 Tomcat', 1..16 tests
2021/03/13 22:33:25 -----------------------------------------------------------------------------------
2021/03/13 22:33:34 ✓ [1.1 Tomcat] => playbook lint (ansible-lint) (1), 6.485s
2021/03/13 22:33:35 ✓ [1.1 Tomcat] => playbook syntax check (--syntax-check) (1), 1.206s
2021/03/13 22:35:37 ✓ [1.1 Tomcat] => apply playbook (3), 2m2.329s
2021/03/13 22:35:38 ✓ [1.1 Tomcat] => service process should run after rollout (2), 306ms
2021/03/13 22:35:42 ✓ [1.1 Tomcat] => responds 200 (2), 1.392s
2021/03/13 22:35:57 ✓ [1.1 Tomcat] => idempotency check (3), 14.515s
2021/03/13 22:35:57 ✓ [1.1 Tomcat] => should run after 2nd apply (2), 195ms
2021/03/13 22:35:57 ✓ [1.1 Tomcat] => shouldn't restart (3), 186ms
2021/03/13 22:35:57 ✓ [1.1 Tomcat] => service is enabled (1), 165ms
2021/03/13 22:35:57 ✗ [1.1 Tomcat] -> 'tomcat_user' variable set as required
2021/03/13 22:35:57 Result: exit status 1
2021/03/13 22:35:57 Output:
"{{ tomcat_user }}"
"{{ tomcat_user }}"
"{{ tomcat_user }}"
2021/03/13 22:35:57 ✗ [1.1 Tomcat] -> 'tomcat_group' variable set as required
2021/03/13 22:35:57 Result: exit status 1
2021/03/13 22:35:57 Output:
"{{ tomcat_group }}"
"{{ tomcat_group }}"
"{{ tomcat_group }}"
"{{ tomcat_group }}"
2021/03/13 22:37:53 ✓ [1.1 Tomcat] => service is running under non-priviliged user as per tomcat_user/tomcat_group (1), 1m55.315s
2021/03/13 22:37:53 ✓ [1.1 Tomcat] => 'tomcat_url' variable set as required (1), 41ms
2021/03/13 22:37:53 ✓ [1.1 Tomcat] => 'tomcat_home' variable set as required (1), 120ms
2021/03/13 22:40:28 ✓ [1.1 Tomcat] => can install into different home (1), 2m35.676s
2021/03/13 22:42:11 ✓ [1.1 Tomcat] => can apply under non-root user (3), 1m42.313s
2021/03/13 22:42:12 -----------------------------------------------------------------------------------
2021/03/13 22:42:12 Tests Summary:
2021/03/13 22:42:12 14 (of 16) tests passed, 2 tests failed; rated as 92.59%
2021/03/13 22:42:12
2021/03/13 22:42:12 Time Spent: 8m46.371s
2021/03/13 22:42:12 -----------------------------------------------------------------------------------
name: aliaksei_kakhavets, master/9c25642 @ 2021-03-11 08:32:46 +0000
2021/03/13 22:42:12 config: tests/webapp.yml
2021/03/13 22:42:12 verbosity: 2
2021/03/13 22:42:12 -----------------------------------------------------------------------------------
2021/03/13 22:42:12 Running '1.2 WebApp', 1..21 tests
2021/03/13 22:42:12 -----------------------------------------------------------------------------------
2021/03/13 22:42:21 ✓ [1.2 WebApp] => playbook lint (ansible-lint) (1), 6.793s
2021/03/13 22:42:23 ✓ [1.2 WebApp] => playbook syntax check (--syntax-check) (1), 1.401s
2021/03/13 22:42:50 ✓ [1.2 WebApp] => apply plybook (2), 27.585s
2021/03/13 22:42:50 ✓ [1.2 WebApp] => 'webapp-server' is running (2), 193ms
2021/03/13 22:42:51 ✓ [1.2 WebApp] => service responds 200 (2), 307ms
2021/03/13 22:43:06 ✓ [1.2 WebApp] => playbook idempotency check (2), 15.061s
2021/03/13 22:43:06 ✓ [1.2 WebApp] => service shouldn't restart (2), 284ms
2021/03/13 22:43:06 ✓ [1.2 WebApp] => service should run after 2nd apply (2), 278ms
2021/03/13 22:43:07 ✓ [1.2 WebApp] => service is enabled (1), 273ms
2021/03/13 22:43:21 ✓ [1.2 WebApp] => can use 'student_first_name/student_last_name' variables (1), 14.619s
2021/03/13 22:43:21 ✗ [1.2 WebApp] -> can set custom port
2021/03/13 22:43:21 Result: exit status 1
2021/03/13 22:43:21 Output:
grep: templates/webapp-server.conf.j2: No such file or directory
Assertion Failed: '' == ''
2021/03/13 22:43:21 ✗ [1.2 WebApp] -> use 'checksum' when downloading WebApp binary (get_url)
2021/03/13 22:43:21 Result: exit status 1
2021/03/13 22:43:21 Output:
2021/03/13 22:43:22 ✓ [1.2 WebApp] => service is running under 'webapp-server:webapp-server' (1), 635ms
2021/03/13 22:43:22 ✓ [1.2 WebApp] => app/service user has no password set (1), 253ms
2021/03/13 22:43:22 ✓ [1.2 WebApp] => playbook has no hardcoded 'webapp_user' (1), 30ms
2021/03/13 22:43:22 ✗ [1.2 WebApp] -> playbook has no hardcoded 'webapp_group'
2021/03/13 22:43:22 Result: exit status 1
2021/03/13 22:43:22 Output:
Assertion Failed: '8' != '7'
2021/03/13 22:43:45 ✓ [1.2 WebApp] => can use 'webapp_user/webapp_group' variables (1), 22.856s
2021/03/13 22:49:13 ✗ [1.2 WebApp] -> can install into different home dir
2021/03/13 22:49:13 Result: exit status 1
2021/03/13 22:49:13 Output:
web-server
a9557ca3bb2b833e046c67a8a5fa1300313f33821df847b03bfafaa98094b05b
(run, /tmp/students-1/aliaksei_kakhavets/day1/1.2) => ansible-playbook webapp-server.yml -i web-server, -v -e webapp_home=/opt/webapp-test
rc: 2
output: |
No config file found; using defaults
PLAY [Installing webapp-server] ************************************************
TASK [Gathering Facts] *********************************************************
ok: [web-server]
TASK [Create webapp group] *****************************************************
changed: [web-server] => {"ansible_facts": {}, "changed": true, "gid": 1001, "name": "webapp-server", "state": "present", "system": false}
TASK [Create webapp user] ******************************************************
changed: [web-server] => {"ansible_facts": {}, "changed": true, "comment": "", "create_home": false, "group": 1001, "home": "/opt/webapp-test", "name": "webapp-server", "shell": "/bin/bash", "state": "present", "system": false, "uid": 1001}
TASK [Make user's folder] ******************************************************
changed: [web-server] => {"ansible_facts": {}, "changed": true, "gid": 1001, "group": "webapp-server", "mode": "0755", "owner": "webapp-server", "path": "/opt/webapp-test", "size": 4096, "state": "directory", "uid": 1001}
TASK [Make bin folder] *********************************************************
changed: [web-server] => {"ansible_facts": {}, "changed": true, "gid": 1001, "group": "webapp-server", "mode": "0755", "owner": "webapp-server", "path": "/opt/webapp-test/bin", "size": 4096, "state": "directory", "uid": 1001}
TASK [Make conf folder] ********************************************************
changed: [web-server] => {"ansible_facts": {}, "changed": true, "gid": 1001, "group": "webapp-server", "mode": "0755", "owner": "webapp-server", "path": "/opt/webapp-test/conf", "size": 4096, "state": "directory", "uid": 1001}
TASK [Download executable file] ************************************************
changed: [web-server] => {"ansible_facts": {}, "changed": true, "checksum_dest": null, "checksum_src": "28f105a4ed1478f27001141888cb86efc7ace7aa", "dest": "/opt/webapp-test/bin/webapp-server", "elapsed": 6, "gid": 1001, "group": "webapp-server", "md5sum": "66e5a7366408e9db471e3e9586e01708", "mode": "0750", "msg": "OK (6213632 bytes)", "owner": "webapp-server", "size": 6213632, "src": "/root/.ansible/tmp/ansible-moduletmp-1615675441.04-CbwDy4/tmp6R9vQr", "state": "file", "status_code": 200, "uid": 1001, "url": "https://playpit-labs-assets.s3-eu-west-1.amazonaws.com/webapp-server/webapp-server"}
TASK [Copy configuration files] ************************************************
changed: [web-server] => {"changed": true, "checksum": "b5481b87469c8a69b3274cc057c1d4dc342676e7", "dest": "/opt/webapp-test/conf/webapp-server.conf", "gid": 1001, "group": "webapp-server", "md5sum": "0bcb14646eacf86c572e263a0473be0c", "mode": "0644", "owner": "webapp-server", "size": 164, "src": "/root/.ansible/tmp/ansible_mitogen_action_8b5cf31a29a81928/source", "state": "file", "uid": 1001}
TASK [Copy service file] *******************************************************
changed: [web-server] => {"changed": true, "checksum": "ec527940d472be5870679c5bbbd283f2b47dec53", "dest": "/etc/systemd/system/webapp-server.service", "gid": 1001, "group": "webapp-server", "md5sum": "48064a11d279529fa70043927cd1a082", "mode": "0644", "owner": "webapp-server", "size": 306, "src": "/root/.ansible/tmp/ansible_mitogen_action_c69951d401292fc7/source", "state": "file", "uid": 1001}
TASK [Make sure a service is running] ******************************************
changed: [web-server] => {"ansible_facts": {}, "changed": true, "enabled": true, "name": "webapp-server", "state": "started", "status": {"ActiveEnterTimestampMonotonic": "0", "ActiveExitTimestampMonotonic": "0", "ActiveState": "inactive", "After": "network.target system.slice systemd-journald.socket basic.target", "AllowIsolate": "no", "AmbientCapabilities": "0", "AssertResult": "no", "AssertTimestampMonotonic": "0", "Before": "shutdown.target", "BlockIOAccounting": "no", "BlockIOWeight": "18446744073709551615", "CPUAccounting": "no", "CPUQuotaPerSecUSec": "infinity", "CPUSchedulingPolicy": "0", "CPUSchedulingPriority": "0", "CPUSchedulingResetOnFork": "no", "CPUShares": "18446744073709551615", "CanIsolate": "no", "CanReload": "no", "CanStart": "yes", "CanStop": "yes", "CapabilityBoundingSet": "18446744073709551615", "ConditionResult": "no", "ConditionTimestampMonotonic": "0", "Conflicts": "shutdown.target", "ControlPID": "0", "DefaultDependencies": "yes", "Delegate": "no", "Description": "Simple WebApp Server", "DevicePolicy": "auto", "EnvironmentFile": "/opt/webapp-server/conf/webapp-server.conf (ignore_errors=yes)", "ExecMainCode": "0", "ExecMainExitTimestampMonotonic": "0", "ExecMainPID": "0", "ExecMainStartTimestampMonotonic": "0", "ExecMainStatus": "0", "ExecStart": "{ path=/opt/webapp-server/bin/webapp-server ; argv[]=/opt/webapp-server/bin/webapp-server ; ignore_errors=no ; start_time=[n/a] ; stop_time=[n/a] ; pid=0 ; code=(null) ; status=0/0 }", "ExecStop": "{ path=/bin/kill ; argv[]=/bin/kill -s QUIT $MAINPID ; ignore_errors=no ; start_time=[n/a] ; stop_time=[n/a] ; pid=0 ; code=(null) ; status=0/0 }", "FailureAction": "none", "FileDescriptorStoreMax": "0", "FragmentPath": "/etc/systemd/system/webapp-server.service", "Group": "webapp-server", "GuessMainPID": "yes", "IOScheduling": "4", "Id": "webapp-server.service", "IgnoreOnIsolate": "no", "IgnoreOnSnapshot": "no", "IgnoreSIGPIPE": "yes", "InactiveEnterTimestampMonotonic": "0", "InactiveExitTimestampMonotonic": "0", "JobTimeoutAction": "none", "JobTimeoutUSec": "0", "KillMode": "control-group", "KillSignal": "15", "LimitAS": "18446744073709551615", "LimitCORE": "18446744073709551615", "LimitCPU": "18446744073709551615", "LimitDATA": "18446744073709551615", "LimitFSIZE": "18446744073709551615", "LimitLOCKS": "18446744073709551615", "LimitMEMLOCK": "67108864", "LimitMSGQUEUE": "819200", "LimitNICE": "0", "LimitNOFILE": "1048576", "LimitNPROC": "18446744073709551615", "LimitRSS": "18446744073709551615", "LimitRTPRIO": "0", "LimitRTTIME": "18446744073709551615", "LimitSIGPENDING": "29790", "LimitSTACK": "18446744073709551615", "LoadState": "loaded", "MainPID": "0", "MemoryAccounting": "no", "MemoryCurrent": "18446744073709551615", "MemoryLimit": "18446744073709551615", "MountFlags": "0", "Names": "webapp-server.service", "NeedDaemonReload": "no", "Nice": "0", "NoNewPrivileges": "no", "NonBlocking": "no", "NotifyAccess": "none", "OOMScoreAdjust": "0", "OnFailureJobMode": "replace", "PermissionsStartOnly": "no", "PrivateDevices": "no", "PrivateNetwork": "no", "PrivateTmp": "no", "ProtectHome": "no", "ProtectSystem": "no", "RefuseManualStart": "no", "RefuseManualStop": "no", "RemainAfterExit": "no", "Requires": "basic.target", "Restart": "no", "RestartUSec": "100ms", "Result": "success", "RootDirectoryStartOnly": "no", "RuntimeDirectoryMode": "0755", "SameProcessGroup": "no", "SecureBits": "0", "SendSIGHUP": "no", "SendSIGKILL": "yes", "Slice": "system.slice", "StandardError": "inherit", "StandardInput": "null", "StandardOutput": "journal", "StartLimitAction": "none", "StartLimitBurst": "5", "StartLimitInterval": "10000000", "StartupBlockIOWeight": "18446744073709551615", "StartupCPUShares": "18446744073709551615", "StatusErrno": "0", "StopWhenUnneeded": "no", "SubState": "dead", "SyslogLevelPrefix": "yes", "SyslogPriority": "30", "SystemCallErrorNumber": "0", "TTYReset": "no", "TTYVHangup": "no", "TTYVTDisallocate": "no", "TasksAccounting": "no", "TasksCurrent": "18446744073709551615", "TasksMax": "18446744073709551615", "TimeoutStartUSec": "1min 30s", "TimeoutStopUSec": "1min 30s", "TimerSlackNSec": "50000", "Transient": "no", "Type": "simple", "UMask": "0022", "UnitFilePreset": "disabled", "UnitFileState": "disabled", "User": "webapp-server", "Wants": "system.slice", "WatchdogTimestampMonotonic": "0", "WatchdogUSec": "0"}}
TASK [Wait for webserver] ******************************************************
fatal: [web-server]: FAILED! => {"ansible_facts": {}, "changed": false, "elapsed": 300, "msg": "Timeout when waiting for 127.0.0.1:8080"}
RUNNING HANDLER [restart webserver] ********************************************
PLAY RECAP *********************************************************************
web-server : ok=10  changed=9  unreachable=0 failed=1  skipped=0 rescued=0 ignored=0
CMD Failed:
2021/03/13 22:49:13 ✓ [1.2 WebApp] => can use different source url (1), 29ms
2021/03/13 22:50:11 ✓ [1.2 WebApp] => can apply under non-root user (1), 57.745s
2021/03/13 22:50:11 ✓ [1.2 WebApp] => playbook has 'handlers' (1), 27ms
2021/03/13 22:50:11 -----------------------------------------------------------------------------------
2021/03/13 22:50:11 Tests Summary:
2021/03/13 22:50:11 17 (of 21) tests passed, 4 tests failed; rated as 85.19%
2021/03/13 22:50:11
2021/03/13 22:50:11 Time Spent: 7m59.394s
2021/03/13 22:50:11 -----------------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment