Changes

Jump to: navigation, search

OPS435 Online Lab9

547 bytes added, 07:53, 1 April 2021
Lab 9 Sign-off (Show Instructor)
[[Category:OPS435]][[Category:rchan]][[Category:OPS435 Lab]]
 
= Under Review and update, will be released on March 29, 2021 =
= Objective =
:# Confirm and review the Ansible package installed on matrix.senecacollege.ca
== Part 4: Gather software and hardware information available on remote machine ==
: One of the main core ansible module is called "setup", it is automatically called by ansible playbook to gather useful "facts" about remote hosts that can be used in ansible playbooks. It can also be executed directly by the ansible command (/usr/bin/ansible) to check out what "facts" are available to on a remote host.
<pre>
[rchanraymond.chan@centos7 ansiblemtrx-node02pd lab9]$ ansible 192.168.99.153 jkwok -i hosts --private-key id_rsa -u instructor -m setup192.168.99.153 jkwok | SUCCESS => {
"ansible_facts": {
"ansible_all_ipv4_addresses": [
"19210.168102.122114.99", "192.168.99.153140"
],
"ansible_all_ipv6_addresses": [
"fe80::505421d:ffd8ff:fe11feb7:6767", "fe80::5054:ff:fe8c:b67c20cc"
],
"ansible_apparmor": {
"status": "disabled"
},
"ansible_architecture": "x86_64",
"ansible_bios_date": "0411/0126/20142012", "ansible_bios_version": "1.9.1-5.el7_3.2", "ansible_cmdline": { "BOOT_IMAGE": "/vmlinuz-3.10.0-862.14.4.el7.x86_64", "LANG": "en_CA.UTF-8", "console": "ttyS0",
...
 
"ansible_userspace_bits": "64",
"ansible_virtualization_role": "guest",
"ansible_virtualization_type": "kvmVirtualPC", "discovered_interpreter_python": "/usr/bin/python", "gather_subset": [ "all" ],
"module_setup": true
},
"changed": false
}
 
</pre>
[[OPS435_Ansible_setup|Click here for complete sample contents of the above]]
= Investigation II: Ansible Playbook =
Name: motd-play.yml
<pre>
[raymond.chan@mtrx-node02pd lab9]$ cat motd-play.yml
---
- name: update motd file hosts: 192.168.99.153jkwok user: rootinstructor become: yes
vars:
apache_version: 2.6
motd_warning: 'WARNING: use user by ICT faculty/students only.'
testserver: yes
tasks:
- name: setup a MOTD
copy:
dest: /etc/motd
content: "{{ motd_warning }}"
 
</pre>
Sample Run:
<pre>
[rchanraymond.chan@centos7 playbooksmtrx-node02pd lab9]$ ansible-playbook -i hosts --private-key id_rsa -b motd-play.yml
PLAY [192.168.99.153update motd file] *******************************************************************
TASK [Gathering Facts] ********************************************************************ok: [192.168.99.153jkwok]
TASK [setup a MOTD] ***********************************************************************changed: [192.168.99.153jkwok]
PLAY RECAP ********************************************************************************192.168.99.153 : jkwok ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
</pre>
Try to run it the 2nd time and pay attention to the result. What conclusion can you draw?
== Part 2: A playbook to install and start Apache Server ==
</pre>
= Investigation III: Using Playbook to configure an OPS435 Linux VM machine =
: Assume you have just installed the latest version of CentOS 7.x on a VM with GNOME Desktop. You need to configure it so that you can use it for doing the Labs for OPS435. The : Study the documentation and examples of following ansible modules::* copy:* file :* hostname:* template:* user:* yum Create an ansible playbook using the appropriate modules to perform the following configuration tasks need to be done on that your assigned VM:
:* update all the packages installed on the VM
:* install extra packages repository for enterprise Linux
= Lab 9 Sign-off (Show Instructor) =
For the Winter 2021 Semeter, this lab is optional and if you complete and submit this lab by April 7, 2021, you could get a maximum bonus of 2%. Please confirm this with your instructor.
== Have the following items ready to show your instructor: ==
: * The Ansible playbook called "config_ops435.yaml" for configuring the VM mentioned in Lab 1.
1,760
edits

Navigation menu