Skip to Content
Mastering Ubuntu Server - Second Edition
book

Mastering Ubuntu Server - Second Edition

by Jay LaCroix
May 2018
Intermediate to advanced
552 pages
14h 55m
English
Packt Publishing
Content preview from Mastering Ubuntu Server - Second Edition

Putting it all together – Automating web server deployment

Speaking of automating the setup of a web server, why don't we go ahead and do exactly that? It'll be another simple example, but it will serve you well if we demonstrate more of what Ansible can do. We will set up a Playbook to perform the following tasks:

  1. Install Apache
  2. Start the apache2 service
  3. Copy an HTML file for the new site

First, let's set up the Playbook to simply install Apache. I called mine apache.yml but the name is arbitrary:

---- hosts: all  become: true  tasks:  - name: Install Apache    apt: name=apache2

No surprises here, we've already installed a package at this point. Let's add an additional instruction to have the apache2 service started:

---- hosts: all become: ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Ubuntu Server - Third Edition

Mastering Ubuntu Server - Third Edition

Jay LaCroix
Linux Server Hacks, Volume Two

Linux Server Hacks, Volume Two

William von Hagen, Brian K. Jones

Publisher Resources

ISBN: 9781788997560Other