Difference between revisions of "Add webserver and configure"
From MyWiki
(Created page with "<source lang="text"> --- - hosts: all become: true vars: doc_root: /var/www/example tasks: - name: Update apt apt: update_cache=yes - name: Install Ap...") |
|||
Line 1: | Line 1: | ||
+ | Ref : https://www.digitalocean.com/community/tutorials/configuration-management-101-writing-ansible-playbooks | ||
<source lang="text"> | <source lang="text"> | ||
--- | --- |
Latest revision as of 11:23, 27 July 2017
--- - hosts: all become: true vars: doc_root: /var/www/example tasks: - name: Update apt apt: update_cache=yes - name: Install Apache apt: name=apache2 state=latest - name: Create custom document root file: path={{ doc_root }} state=directory owner=www-data group=www-data - name: Set up HTML file copy: src=index.html dest={{ doc_root }}/index.html owner=www-data group=www-data mode=0644 - name: Set up Apache virtual host file template: src=vhost.tpl dest=/etc/apache2/sites-available/000-default.conf notify: restart apache handlers: - name: restart apache service: name=apache2 state=restarted