Difference between revisions of "OPS435 Online Assignment 2S"
(→Sample outputs from running your Fabric task file) |
|||
Line 33: | Line 33: | ||
== Sample outputs from running your Fabric task file == | == Sample outputs from running your Fabric task file == | ||
+ | Name of fabric file: a2s_rchan.py | ||
+ | |||
+ | === list of fabric commands === | ||
+ | <pre> | ||
+ | [raymond.chan@mtrx-node05pd lab8]$ fab -f a2s_rchan.py -l | ||
+ | Available commands: | ||
+ | |||
+ | addUser add a user with given user name to remote system | ||
+ | findUser find user with a given user name | ||
+ | listSysUser return a list of system (non-shell) user | ||
+ | listUser return a list of shell user on a remote system | ||
+ | </pre> | ||
+ | |||
+ | === Test run the addUser task === | ||
+ | <pre> | ||
+ | [raymond.chan@mtrx-node05pd lab8]$ fab -f faba2.py --host=myvmlab.senecacollege.ca --port=7598 addUser:ops435 | ||
+ | [myvmlab.senecacollege.ca] Executing task 'addUser' | ||
+ | [myvmlab.senecacollege.ca] ... | ||
+ | |||
+ | Done. | ||
+ | Disconnecting from myvmlab.senecacollege.ca:7598... done. | ||
+ | </pre> | ||
+ | |||
+ | === Test run the findUser task === | ||
+ | <pre> | ||
+ | [raymond.chan@mtrx-node05pd lab8]$ fab -f faba2.py --host=myvmlab.senecacollege.ca --port=7598 findUser:ops435 | ||
+ | [myvmlab.senecacollege.ca] Executing task 'findUser' | ||
+ | ... | ||
+ | ... | ||
+ | |||
+ | [myvmlab.senecacollege.ca] out: | ||
+ | |||
+ | Found user ops435 on the system. | ||
+ | |||
+ | Done. | ||
+ | Disconnecting from myvmlab.senecacollege.ca:7598... done. | ||
+ | </pre> | ||
+ | Another test run: | ||
+ | <pre> | ||
+ | [raymond.chan@mtrx-node05pd lab8]$ fab -f faba2.py --host=myvmlab.senecacollege.ca --port=7598 findUser:seneca | ||
+ | [myvmlab.senecacollege.ca] Executing task 'findUser' | ||
+ | ... | ||
+ | ... | ||
+ | [myvmlab.senecacollege.ca] out: | ||
+ | |||
+ | User seneca is not on the system. | ||
+ | |||
+ | Done. | ||
+ | Disconnecting from myvmlab.senecacollege.ca:7598... done. | ||
+ | </pre> | ||
+ | === Test run the listUser task === | ||
+ | <pre> | ||
+ | [raymond.chan@mtrx-node05pd lab8]$ fab -f faba2.py --host=myvmlab.senecacollege.ca --port=7598 listUser | ||
+ | [myvmlab.senecacollege.ca] Executing task 'listUser' | ||
+ | ... | ||
+ | ... | ||
+ | |||
+ | ['root', 'raymond', 'chan', 'ops435'] | ||
+ | |||
+ | Done. | ||
+ | Disconnecting from myvmlab.senecacollege.ca:7598... done. | ||
+ | </pre> | ||
+ | === Test run the listSysUser task === | ||
+ | <pre> | ||
+ | [raymond.chan@mtrx-node05pd lab8]$ fab -f faba2.py --host=myvmlab.senecacollege.ca --port=7598 listSysUser | ||
+ | [myvmlab.senecacollege.ca] Executing task 'listSysUser' | ||
+ | ... | ||
+ | ... | ||
+ | [myvmlab.senecacollege.ca] out: | ||
+ | |||
+ | ['bin', 'daemon', ... 'postfix', 'chrony', 'ntp'] | ||
+ | |||
+ | Done. | ||
+ | Disconnecting from myvmlab.senecacollege.ca:7598... done. | ||
+ | </pre> |
Revision as of 07:12, 19 November 2020
Assignment 2 S - Create Fabric tasks for remote User Management
Weight: 15% of the overall grade
What you need
- A github account with a private repository named ops435-a2s
- Complete Lab 8
- A VM assigned to you on myvmlab.senecacollege.ca by Seneca ITS.
- Has access to matrix.senecacollege.ca
Due Date: Please follow the three stages of submission schedule:
- Check point 1: complete the detail algorithm for each task in this assignment by November 25, 2020. Name it as a2s_algorithm.txt and upload it to your github repository
- Check point 2: complete the coding of your fabric commands file from the algorithm for each task by Dec 2, 2020. Name it as a2s_[Seneca_name].py (replace [Seneca_name] with your Seneca email user name) and upload it to your github repo by Dec 2, 2020.
- Check point 3: complete the testing and debugging using your VM in myvmlab by Dec 4, and also submit your algorithm file (a2s_algorithm.txt), test results, and the fabric file (a2s_[Seneca_name].py) to Blackboard.
Late Penalty: 20% per school day, and note that in order to pass this course, this assignment must be completed satisfactorily, i.e. a grade of 50% or more.
Overview
- Study the Fabric API run(), sudo(), local(), and put() and utilize them to create a new Fabric task called userAdmin()
- The userAdmin() task should perform the following activities on a remote machine to:
- create a new user when necessary information is provided
- delete an existing user when it is safe to do so.
Tasks for this assignment
In this assignment, you should perform the following activities:
- Complete a detail algorithm for the following FOUR system administrator operations:
- add a user account to a Linux system (task name addUser)
- determine whether a given user name exist on a Linux system (task name findUser)
- get a list of user account name with a command shell on a Linux system (listUser)
- get a list of system account name without a command shell on a Linux system (listSysUser)
- Create a corresponding fabric task using the fabric API to automate the above four system administrator operations.
- Test and debug your fabric file using your assigned VM in myvmlab.senecacollege.ca
Sample outputs from running your Fabric task file
Name of fabric file: a2s_rchan.py
list of fabric commands
[raymond.chan@mtrx-node05pd lab8]$ fab -f a2s_rchan.py -l Available commands: addUser add a user with given user name to remote system findUser find user with a given user name listSysUser return a list of system (non-shell) user listUser return a list of shell user on a remote system
Test run the addUser task
[raymond.chan@mtrx-node05pd lab8]$ fab -f faba2.py --host=myvmlab.senecacollege.ca --port=7598 addUser:ops435 [myvmlab.senecacollege.ca] Executing task 'addUser' [myvmlab.senecacollege.ca] ... Done. Disconnecting from myvmlab.senecacollege.ca:7598... done.
Test run the findUser task
[raymond.chan@mtrx-node05pd lab8]$ fab -f faba2.py --host=myvmlab.senecacollege.ca --port=7598 findUser:ops435 [myvmlab.senecacollege.ca] Executing task 'findUser' ... ... [myvmlab.senecacollege.ca] out: Found user ops435 on the system. Done. Disconnecting from myvmlab.senecacollege.ca:7598... done.
Another test run:
[raymond.chan@mtrx-node05pd lab8]$ fab -f faba2.py --host=myvmlab.senecacollege.ca --port=7598 findUser:seneca [myvmlab.senecacollege.ca] Executing task 'findUser' ... ... [myvmlab.senecacollege.ca] out: User seneca is not on the system. Done. Disconnecting from myvmlab.senecacollege.ca:7598... done.
Test run the listUser task
[raymond.chan@mtrx-node05pd lab8]$ fab -f faba2.py --host=myvmlab.senecacollege.ca --port=7598 listUser [myvmlab.senecacollege.ca] Executing task 'listUser' ... ... ['root', 'raymond', 'chan', 'ops435'] Done. Disconnecting from myvmlab.senecacollege.ca:7598... done.
Test run the listSysUser task
[raymond.chan@mtrx-node05pd lab8]$ fab -f faba2.py --host=myvmlab.senecacollege.ca --port=7598 listSysUser [myvmlab.senecacollege.ca] Executing task 'listSysUser' ... ... [myvmlab.senecacollege.ca] out: ['bin', 'daemon', ... 'postfix', 'chrony', 'ntp'] Done. Disconnecting from myvmlab.senecacollege.ca:7598... done.