Changes

Jump to: navigation, search

OPS435 Online Lab9

177 bytes added, 01:05, 26 March 2021
Part 1: A playbook to update the /etc/motd file
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>
1,760
edits

Navigation menu