Skip to content

Instantly share code, notes, and snippets.

@sbeliakou
Created March 13, 2021 23:07
Show Gist options
  • Save sbeliakou/cc09221a21f40c638026609bba84e4cf to your computer and use it in GitHub Desktop.
Save sbeliakou/cc09221a21f40c638026609bba84e4cf to your computer and use it in GitHub Desktop.
Cloning into 'andrei_hryshkin'...
name: andrei_hryshkin, master/8d1d818 @ 2021-03-11 08:35:07 +0000
2021/03/13 22:50:14 config: tests/tomcat.yml
2021/03/13 22:50:14 verbosity: 2
2021/03/13 22:50:14 -----------------------------------------------------------------------------------
2021/03/13 22:50:14 Running '1.1 Tomcat', 1..16 tests
2021/03/13 22:50:14 -----------------------------------------------------------------------------------
2021/03/13 22:50:24 ✓ [1.1 Tomcat] => playbook lint (ansible-lint) (1), 7.474s
2021/03/13 22:50:25 ✓ [1.1 Tomcat] => playbook syntax check (--syntax-check) (1), 1.126s
2021/03/13 22:53:26 ✓ [1.1 Tomcat] => apply playbook (3), 3m1.376s
2021/03/13 22:53:26 ✓ [1.1 Tomcat] => service process should run after rollout (2), 220ms
2021/03/13 22:53:32 ✓ [1.1 Tomcat] => responds 200 (2), 2.083s
2021/03/13 22:53:48 ✓ [1.1 Tomcat] => idempotency check (3), 16.249s
2021/03/13 22:53:48 ✓ [1.1 Tomcat] => should run after 2nd apply (2), 352ms
2021/03/13 22:53:48 ✓ [1.1 Tomcat] => shouldn't restart (3), 288ms
2021/03/13 22:53:49 ✓ [1.1 Tomcat] => service is enabled (1), 204ms
2021/03/13 22:53:49 ✗ [1.1 Tomcat] -> 'tomcat_user' variable set as required
2021/03/13 22:53:49 Result: exit status 1
2021/03/13 22:53:49 Output:
"{{ tomcat_user }}"
"{{ tomcat_user }}"
"{{ tomcat_user }}"
2021/03/13 22:53:49 ✗ [1.1 Tomcat] -> 'tomcat_group' variable set as required
2021/03/13 22:53:49 Result: exit status 1
2021/03/13 22:53:49 Output:
"{{ tomcat_group }}"
"{{ tomcat_group }}"
"{{ tomcat_group }}"
"{{ tomcat_group }}"
2021/03/13 22:56:02 ✓ [1.1 Tomcat] => service is running under non-priviliged user as per tomcat_user/tomcat_group (1), 2m13.346s
2021/03/13 22:56:02 ✓ [1.1 Tomcat] => 'tomcat_url' variable set as required (1), 40ms
2021/03/13 22:56:02 ✓ [1.1 Tomcat] => 'tomcat_home' variable set as required (1), 70ms
2021/03/13 22:58:28 ✓ [1.1 Tomcat] => can install into different home (1), 2m25.379s
2021/03/13 23:00:07 ✓ [1.1 Tomcat] => can apply under non-root user (3), 1m39.774s
2021/03/13 23:00:09 -----------------------------------------------------------------------------------
2021/03/13 23:00:09 Tests Summary:
2021/03/13 23:00:09 14 (of 16) tests passed, 2 tests failed; rated as 92.59%
2021/03/13 23:00:09
2021/03/13 23:00:09 Time Spent: 9m55.04s
2021/03/13 23:00:09 -----------------------------------------------------------------------------------
name: andrei_hryshkin, master/8d1d818 @ 2021-03-11 08:35:07 +0000
2021/03/13 23:00:09 config: tests/webapp.yml
2021/03/13 23:00:09 verbosity: 2
2021/03/13 23:00:09 -----------------------------------------------------------------------------------
2021/03/13 23:00:09 Running '1.2 WebApp', 1..21 tests
2021/03/13 23:00:09 -----------------------------------------------------------------------------------
2021/03/13 23:00:18 ✓ [1.2 WebApp] => playbook lint (ansible-lint) (1), 6.534s
2021/03/13 23:00:19 ✓ [1.2 WebApp] => playbook syntax check (--syntax-check) (1), 1.217s
2021/03/13 23:00:45 ✓ [1.2 WebApp] => apply plybook (2), 26.197s
2021/03/13 23:00:45 ✓ [1.2 WebApp] => 'webapp-server' is running (2), 165ms
2021/03/13 23:00:46 ✓ [1.2 WebApp] => service responds 200 (2), 224ms
2021/03/13 23:00:59 ✓ [1.2 WebApp] => playbook idempotency check (2), 13.712s
2021/03/13 23:01:00 ✓ [1.2 WebApp] => service shouldn't restart (2), 226ms
2021/03/13 23:01:00 ✓ [1.2 WebApp] => service should run after 2nd apply (2), 215ms
2021/03/13 23:01:00 ✓ [1.2 WebApp] => service is enabled (1), 360ms
2021/03/13 23:01:16 ✓ [1.2 WebApp] => can use 'student_first_name/student_last_name' variables (1), 15.588s
2021/03/13 23:06:31 ✗ [1.2 WebApp] -> can set custom port
2021/03/13 23:06:31 Result: exit status 1
2021/03/13 23:06:31 Output:
grep: templates/webapp-server.conf.j2: No such file or directory
(run, /tmp/students-1/andrei_hryshkin/day1/1.2) => ansible-playbook webapp-server.yml -i web-server, -e student_first_name=Vernon -e student_last_name=Robles -e server_port=8081
rc: 2
output: |
PLAY [Installing webapp-server] ************************************************
TASK [Gathering Facts] *********************************************************
ok: [web-server]
TASK [create application group] ************************************************
ok: [web-server]
TASK [create application user] *************************************************
ok: [web-server]
TASK [create application folders] **********************************************
ok: [web-server]
TASK [make sure all resources bin] *********************************************
ok: [web-server]
TASK [make sure all resources conf] ********************************************
ok: [web-server]
TASK [download executable file] ************************************************
ok: [web-server]
TASK [copy configuration file] *************************************************
changed: [web-server]
TASK [copy service file] *******************************************************
ok: [web-server]
TASK [start server] ************************************************************
ok: [web-server]
TASK [wait port] ***************************************************************
fatal: [web-server]: FAILED! => {"ansible_facts": {}, "changed": false, "elapsed": 300, "msg": "Timeout when waiting for 127.0.0.1:8081"}
RUNNING HANDLER [webapp-server restart] ****************************************
PLAY RECAP *********************************************************************
web-server : ok=10  changed=1  unreachable=0 failed=1  skipped=0 rescued=0 ignored=0
CMD Failed:
2021/03/13 23:06:31 ✓ [1.2 WebApp] => use 'checksum' when downloading WebApp binary (get_url) (1), 30ms
2021/03/13 23:06:32 ✓ [1.2 WebApp] => service is running under 'webapp-server:webapp-server' (1), 797ms
2021/03/13 23:06:32 ✓ [1.2 WebApp] => app/service user has no password set (1), 203ms
2021/03/13 23:06:32 ✓ [1.2 WebApp] => playbook has no hardcoded 'webapp_user' (1), 39ms
2021/03/13 23:06:32 ✗ [1.2 WebApp] -> playbook has no hardcoded 'webapp_group'
2021/03/13 23:06:32 Result: exit status 1
2021/03/13 23:06:32 Output:
Assertion Failed: '7' != '6'
2021/03/13 23:06:57 ✓ [1.2 WebApp] => can use 'webapp_user/webapp_group' variables (1), 24.52s
2021/03/13 23:07:15 ✗ [1.2 WebApp] -> can install into different home dir
2021/03/13 23:07:15 Result: exit status 1
2021/03/13 23:07:15 Output:
web-server
54a8f0bada8ba24c1b540415d63fe4038a25c9156fffc04873ddfe309490c616
(run, /tmp/students-1/andrei_hryshkin/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 application group] ************************************************
changed: [web-server] => {"ansible_facts": {}, "changed": true, "gid": 1001, "name": "webapp-server", "state": "present", "system": false}
TASK [create application 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 [create application folders] **********************************************
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 sure all resources bin] *********************************************
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 sure all resources conf] ********************************************
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": 0, "gid": 1001, "group": "webapp-server", "md5sum": "66e5a7366408e9db471e3e9586e01708", "mode": "0750", "msg": "OK (6213632 bytes)", "owner": "webapp-server", "size": 6213632, "src": "/root/.ansible/tmp/ansible-moduletmp-1615676832.84-sPArOe/tmp03EN_n", "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 file] *************************************************
fatal: [web-server]: FAILED! => {"changed": false, "checksum": "933ba57dc913f8a88d5c606e5e4c38090306783b", "msg": "Destination directory /opt/webapp-server/conf does not exist"}
PLAY RECAP *********************************************************************
web-server : ok=7  changed=6  unreachable=0 failed=1  skipped=0 rescued=0 ignored=0
CMD Failed:
2021/03/13 23:07:15 ✓ [1.2 WebApp] => can use different source url (1), 9ms
2021/03/13 23:07:49 ✓ [1.2 WebApp] => can apply under non-root user (1), 34.437s
2021/03/13 23:07:49 ✓ [1.2 WebApp] => playbook has 'handlers' (1), 9ms
2021/03/13 23:07:50 -----------------------------------------------------------------------------------
2021/03/13 23:07:50 Tests Summary:
2021/03/13 23:07:50 18 (of 21) tests passed, 3 tests failed; rated as 88.89%
2021/03/13 23:07:50
2021/03/13 23:07:50 Time Spent: 7m40.722s
2021/03/13 23:07:50 -----------------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment