Skip to content

Instantly share code, notes, and snippets.

@sbeliakou
Created March 13, 2021 23:54
Show Gist options
  • Save sbeliakou/a6995842246b854924663d67f09f3903 to your computer and use it in GitHub Desktop.
Save sbeliakou/a6995842246b854924663d67f09f3903 to your computer and use it in GitHub Desktop.
Cloning into 'arseni_semeniaka'...
name: arseni_semeniaka, master/01fb2ff @ 2021-03-13 11:45:31 +0000
2021/03/13 23:37:07 config: tests/tomcat.yml
2021/03/13 23:37:07 verbosity: 2
2021/03/13 23:37:07 -----------------------------------------------------------------------------------
2021/03/13 23:37:07 Running '1.1 Tomcat', 1..16 tests
2021/03/13 23:37:07 -----------------------------------------------------------------------------------
2021/03/13 23:37:12 ✓ [1.1 Tomcat] => playbook lint (ansible-lint) (1), 3.868s
2021/03/13 23:37:13 ✓ [1.1 Tomcat] => playbook syntax check (--syntax-check) (1), 702ms
2021/03/13 23:39:34 ✓ [1.1 Tomcat] => apply playbook (3), 2m21.41s
2021/03/13 23:39:35 ✓ [1.1 Tomcat] => service process should run after rollout (2), 266ms
2021/03/13 23:39:41 ✓ [1.1 Tomcat] => responds 200 (2), 2.773s
2021/03/13 23:40:06 ✓ [1.1 Tomcat] => idempotency check (3), 25.986s
2021/03/13 23:40:07 ✓ [1.1 Tomcat] => should run after 2nd apply (2), 294ms
2021/03/13 23:40:07 ✓ [1.1 Tomcat] => shouldn't restart (3), 253ms
2021/03/13 23:40:07 ✓ [1.1 Tomcat] => service is enabled (1), 218ms
2021/03/13 23:40:07 ✓ [1.1 Tomcat] => 'tomcat_user' variable set as required (1), 135ms
2021/03/13 23:40:08 ✓ [1.1 Tomcat] => 'tomcat_group' variable set as required (1), 148ms
2021/03/13 23:42:37 ✓ [1.1 Tomcat] => service is running under non-priviliged user as per tomcat_user/tomcat_group (1), 2m29.502s
2021/03/13 23:42:37 ✓ [1.1 Tomcat] => 'tomcat_url' variable set as required (1), 34ms
2021/03/13 23:42:37 ✓ [1.1 Tomcat] => 'tomcat_home' variable set as required (1), 89ms
2021/03/13 23:44:35 ✓ [1.1 Tomcat] => can install into different home (1), 1m57.92s
2021/03/13 23:46:38 ✓ [1.1 Tomcat] => can apply under non-root user (3), 2m2.767s
2021/03/13 23:46:39 -----------------------------------------------------------------------------------
2021/03/13 23:46:39 Tests Summary:
2021/03/13 23:46:39 16 (of 16) tests passed, 0 tests failed; rated as 100.00%
2021/03/13 23:46:39
2021/03/13 23:46:39 Time Spent: 9m32.427s
2021/03/13 23:46:39 -----------------------------------------------------------------------------------
name: arseni_semeniaka, master/01fb2ff @ 2021-03-13 11:45:31 +0000
2021/03/13 23:46:39 config: tests/webapp.yml
2021/03/13 23:46:39 verbosity: 2
2021/03/13 23:46:39 -----------------------------------------------------------------------------------
2021/03/13 23:46:39 Running '1.2 WebApp', 1..21 tests
2021/03/13 23:46:39 -----------------------------------------------------------------------------------
2021/03/13 23:46:48 ✓ [1.2 WebApp] => playbook lint (ansible-lint) (1), 6.037s
2021/03/13 23:46:49 ✓ [1.2 WebApp] => playbook syntax check (--syntax-check) (1), 1.135s
2021/03/13 23:47:11 ✓ [1.2 WebApp] => apply plybook (2), 22.37s
2021/03/13 23:47:11 ✓ [1.2 WebApp] => 'webapp-server' is running (2), 214ms
2021/03/13 23:47:12 ✓ [1.2 WebApp] => service responds 200 (2), 185ms
2021/03/13 23:47:33 ✓ [1.2 WebApp] => playbook idempotency check (2), 21.602s
2021/03/13 23:47:33 ✓ [1.2 WebApp] => service shouldn't restart (2), 224ms
2021/03/13 23:47:34 ✓ [1.2 WebApp] => service should run after 2nd apply (2), 187ms
2021/03/13 23:47:34 ✓ [1.2 WebApp] => service is enabled (1), 290ms
2021/03/13 23:47:56 ✓ [1.2 WebApp] => can use 'student_first_name/student_last_name' variables (1), 22.572s
2021/03/13 23:47:56 ✗ [1.2 WebApp] -> can set custom port
2021/03/13 23:47:56 Result: exit status 1
2021/03/13 23:47:56 Output:
grep: templates/webapp-server.conf.j2: No such file or directory
Assertion Failed: '' == ''
2021/03/13 23:47:56 ✓ [1.2 WebApp] => use 'checksum' when downloading WebApp binary (get_url) (1), 27ms
2021/03/13 23:47:57 ✓ [1.2 WebApp] => service is running under 'webapp-server:webapp-server' (1), 602ms
2021/03/13 23:47:57 ✓ [1.2 WebApp] => app/service user has no password set (1), 289ms
2021/03/13 23:47:57 ✓ [1.2 WebApp] => playbook has no hardcoded 'webapp_user' (1), 34ms
2021/03/13 23:47:57 ✓ [1.2 WebApp] => playbook has no hardcoded 'webapp_group' (1), 39ms
2021/03/13 23:48:33 ✓ [1.2 WebApp] => can use 'webapp_user/webapp_group' variables (1), 35.541s
2021/03/13 23:54:03 ✗ [1.2 WebApp] -> can install into different home dir
2021/03/13 23:54:03 Result: exit status 1
2021/03/13 23:54:03 Output:
web-server
54d88463a4eb277ac0be19fd483eed557e970cb19ce7160bc2c6228f355d3648
(run, /tmp/students-1/arseni_semeniaka/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-server group] **********************************************
changed: [web-server] => {"ansible_facts": {}, "changed": true, "gid": 1001, "name": "webapp-server", "state": "present", "system": false}
TASK [Add user webapp-server] **************************************************
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 [Create webapp-server bin directory] **************************************
changed: [web-server] => {"ansible_facts": {}, "changed": true, "gid": 0, "group": "root", "mode": "0755", "owner": "webapp-server", "path": "/opt/webapp-test/bin/", "size": 4096, "state": "directory", "uid": 1001}
TASK [Create webapp-server conf directory] *************************************
changed: [web-server] => {"ansible_facts": {}, "changed": true, "gid": 0, "group": "root", "mode": "0755", "owner": "webapp-server", "path": "/opt/webapp-test/conf/", "size": 4096, "state": "directory", "uid": 1001}
TASK [Download webapp-server binary] *******************************************
changed: [web-server] => {"ansible_facts": {}, "changed": true, "checksum_dest": null, "checksum_src": "28f105a4ed1478f27001141888cb86efc7ace7aa", "dest": "/opt/webapp-test/bin/webapp-server", "elapsed": 7, "gid": 1001, "group": "webapp-server", "md5sum": "66e5a7366408e9db471e3e9586e01708", "mode": "0744", "msg": "OK (6213632 bytes)", "owner": "webapp-server", "size": 6213632, "src": "/root/.ansible/tmp/ansible-moduletmp-1615679329.9-Jtzh2t/tmpiAw8g3", "state": "file", "status_code": 200, "uid": 1001, "url": "https://playpit-labs-assets.s3-eu-west-1.amazonaws.com/webapp-server/webapp-server"}
TASK [Copy webapp-server configuration file] ***********************************
changed: [web-server] => {"changed": true, "checksum": "426497f03cda3f57e55b383f560a0480f7026885", "dest": "/opt/webapp-test/conf/webapp-server.conf", "gid": 1001, "group": "webapp-server", "md5sum": "5caef940c1a1d50482755a2a26ac2aa2", "mode": "0644", "owner": "webapp-server", "size": 163, "src": "/root/.ansible/tmp/ansible_mitogen_action_336af2822cb2675d/source", "state": "file", "uid": 1001}
TASK [Copy webapp-server unit file] ********************************************
changed: [web-server] => {"changed": true, "checksum": "3fe7dbd112d2703022d6076c4fed84a1cc1b7c7f", "dest": "/etc/systemd/system/webapp-server.service", "gid": 0, "group": "root", "md5sum": "a1cf9b09328d21dab90315a1e0534a91", "mode": "0644", "owner": "root", "size": 304, "src": "/root/.ansible/tmp/ansible_mitogen_action_ddb60e9cc8d600f1/source", "state": "file", "uid": 0}
TASK [Ensure webapp-server service enabled and running] ************************
changed: [web-server] => {"ansible_facts": {}, "changed": true, "enabled": true, "name": "webapp-server.service", "state": "started", "status": {"ActiveEnterTimestampMonotonic": "0", "ActiveExitTimestampMonotonic": "0", "ActiveState": "inactive", "After": "systemd-journald.socket basic.target system.slice network.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": "0", "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 port 8080 to become open] ***************************************
fatal: [web-server]: FAILED! => {"ansible_facts": {}, "changed": false, "elapsed": 300, "msg": "Timeout when waiting for 127.0.0.1:8080"}
RUNNING HANDLER [webapp-server restart] ****************************************
PLAY RECAP *********************************************************************
web-server : ok=9  changed=8  unreachable=0 failed=1  skipped=0 rescued=0 ignored=0
CMD Failed:
2021/03/13 23:54:03 ✓ [1.2 WebApp] => can use different source url (1), 14ms
2021/03/13 23:54:39 ✓ [1.2 WebApp] => can apply under non-root user (1), 36.052s
2021/03/13 23:54:39 ✓ [1.2 WebApp] => playbook has 'handlers' (1), 10ms
2021/03/13 23:54:39 -----------------------------------------------------------------------------------
2021/03/13 23:54:39 Tests Summary:
2021/03/13 23:54:39 19 (of 21) tests passed, 2 tests failed; rated as 92.59%
2021/03/13 23:54:39
2021/03/13 23:54:39 Time Spent: 8m0.268s
2021/03/13 23:54:39 -----------------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment