Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3961a35
commit 4db62f5
Showing
17 changed files
with
472 additions
and
315 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,5 @@ _book/ | |
node_modules/ | ||
|
||
|
||
*.retry | ||
package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
- hosts: web | ||
tasks: | ||
- name: Installs apache web server | ||
apt: pkg=apache2 state=installed update_cache=true | ||
--- | ||
- hosts: web | ||
tasks: | ||
- name: Installs apache web server | ||
apt: | ||
pkg: apache2 | ||
state: installed | ||
update_cache: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,42 @@ | ||
- hosts: web | ||
tasks: | ||
- name: Installs apache web server | ||
apt: pkg=apache2 state=installed update_cache=true | ||
--- | ||
- hosts: web | ||
tasks: | ||
- name: Installs apache web server | ||
apt: | ||
pkg: apache2 | ||
state: installed | ||
update_cache: true | ||
|
||
- name: Push default virtual host configuration | ||
copy: src=files/awesome-app dest=/etc/apache2/sites-available/awesome-app.conf mode=0640 | ||
- name: Push default virtual host configuration | ||
copy: | ||
src: files/awesome-app | ||
dest: /etc/apache2/sites-available/awesome-app.conf | ||
mode: 0640 | ||
|
||
- name: Disable the default virtualhost | ||
file: dest=/etc/apache2/sites-enabled/000-default.conf state=absent | ||
notify: | ||
- restart apache | ||
- name: Disable the default virtualhost | ||
file: | ||
dest: /etc/apache2/sites-enabled/000-default.conf | ||
state: absent | ||
notify: | ||
- restart apache | ||
|
||
- name: Disable the default ssl virtualhost | ||
file: dest=/etc/apache2/sites-enabled/default-ssl.conf state=absent | ||
notify: | ||
- restart apache | ||
- name: Disable the default ssl virtualhost | ||
file: | ||
dest: /etc/apache2/sites-enabled/default-ssl.conf | ||
state: absent | ||
notify: | ||
- restart apache | ||
|
||
- name: Activates our virtualhost | ||
file: src=/etc/apache2/sites-available/awesome-app.conf dest=/etc/apache2/sites-enabled/awesome-app.conf state=link | ||
notify: | ||
- restart apache | ||
|
||
handlers: | ||
- name: restart apache | ||
service: name=apache2 state=restarted | ||
- name: Activates our virtualhost | ||
file: | ||
src: /etc/apache2/sites-available/awesome-app.conf | ||
dest: /etc/apache2/sites-enabled/awesome-app.conf | ||
state: link | ||
notify: | ||
- restart apache | ||
|
||
handlers: | ||
- name: restart apache | ||
service: | ||
name: apache2 | ||
state: restarted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,34 @@ | ||
- hosts: web | ||
tasks: | ||
- name: Installs apache web server | ||
apt: pkg=apache2 state=installed update_cache=true | ||
--- | ||
- hosts: web | ||
tasks: | ||
- name: Installs apache web server | ||
apt: | ||
pkg: apache2 | ||
state: installed | ||
update_cache: true | ||
|
||
- name: Push future default virtual host configuration | ||
copy: src=files/awesome-app dest=/etc/apache2/sites-available/awesome-app.conf mode=0640 | ||
- name: Push future default virtual host configuration | ||
copy: | ||
src: files/awesome-app | ||
dest: /etc/apache2/sites-available/awesome-app.conf | ||
mode: 0640 | ||
|
||
- name: Activates our virtualhost | ||
command: a2ensite awesome-app | ||
- name: Activates our virtualhost | ||
command: a2ensite awesome-app | ||
|
||
- name: Check that our config is valid | ||
command: apache2ctl configtest | ||
|
||
- name: Deactivates the default virtualhost | ||
command: a2dissite 000-default | ||
- name: Check that our config is valid | ||
command: apache2ctl configtest | ||
|
||
- name: Deactivates the default ssl virtualhost | ||
command: a2dissite default-ssl | ||
notify: | ||
- restart apache | ||
- name: Deactivates the default virtualhost | ||
command: a2dissite 000-default | ||
|
||
handlers: | ||
- name: restart apache | ||
service: name=apache2 state=restarted | ||
- name: Deactivates the default ssl virtualhost | ||
command: a2dissite default-ssl | ||
notify: | ||
- restart apache | ||
|
||
handlers: | ||
- name: restart apache | ||
service: | ||
name: apache2 | ||
state: restarted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,49 @@ | ||
- hosts: web | ||
tasks: | ||
- name: Installs apache web server | ||
apt: pkg=apache2 state=installed update_cache=true | ||
|
||
- name: Push future default virtual host configuration | ||
copy: src=files/awesome-app dest=/etc/apache2/sites-available/awesome-app.conf mode=0640 | ||
|
||
- name: Deactivates the default virtualhost | ||
command: a2dissite 000-default | ||
|
||
- name: Activates our virtualhost | ||
command: a2ensite awesome-app | ||
|
||
- name: Check that our config is valid | ||
command: apache2ctl configtest | ||
register: result | ||
ignore_errors: True | ||
|
||
- name: Rolling back - Restoring old default virtualhost | ||
command: a2ensite 000-default | ||
when: result|failed | ||
|
||
- name: Rolling back - Removing out virtualhost | ||
command: a2dissite awesome-app | ||
when: result|failed | ||
|
||
- name: Rolling back - Ending playbook | ||
fail: msg="Configuration file is not valid. Please check that before re-running the playbook." | ||
when: result|failed | ||
|
||
- name: Deactivates the default ssl virtualhost | ||
command: a2dissite default-ssl | ||
|
||
notify: | ||
- restart apache | ||
|
||
handlers: | ||
- name: restart apache | ||
service: name=apache2 state=restarted | ||
--- | ||
- hosts: web | ||
tasks: | ||
- name: Installs apache web server | ||
apt: | ||
pkg: apache2 | ||
state: installed | ||
update_cache: true | ||
|
||
- name: Push future default virtual host configuration | ||
copy: | ||
src: files/awesome-app | ||
dest: /etc/apache2/sites-available/awesome-app.conf | ||
mode: 0640 | ||
|
||
- name: Deactivates the default virtualhost | ||
command: a2dissite 000-default | ||
|
||
- name: Activates our virtualhost | ||
command: a2ensite awesome-app | ||
|
||
- name: Check that our config is valid | ||
command: apache2ctl configtest | ||
register: result | ||
ignore_errors: True | ||
|
||
- name: Rolling back - Restoring old default virtualhost | ||
command: a2ensite 000-default | ||
when: result|failed | ||
|
||
- name: Rolling back - Removing out virtualhost | ||
command: a2dissite awesome-app | ||
when: result|failed | ||
|
||
- name: Rolling back - Ending playbook | ||
fail: msg="Configuration file is not valid. Please check that before re-running the playbook." | ||
when: result|failed | ||
|
||
- name: Deactivates the default ssl virtualhost | ||
command: a2dissite default-ssl | ||
|
||
notify: | ||
- restart apache | ||
|
||
handlers: | ||
- name: restart apache | ||
service: | ||
name: apache2 | ||
state: restarted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,62 @@ | ||
- hosts: web | ||
tasks: | ||
- name: Updates apt cache | ||
apt: update_cache=true | ||
|
||
- name: Installs necessary packages | ||
apt: pkg={{ item }} state=latest | ||
with_items: | ||
- apache2 | ||
- libapache2-mod-php5 | ||
- git | ||
|
||
- name: Push future default virtual host configuration | ||
copy: src=files/awesome-app dest=/etc/apache2/sites-available/awesome-app.conf mode=0640 | ||
|
||
- name: Activates our virtualhost | ||
command: a2ensite awesome-app | ||
|
||
- name: Check that our config is valid | ||
command: apache2ctl configtest | ||
register: result | ||
ignore_errors: True | ||
|
||
- name: Rolling back - Restoring old default virtualhost | ||
command: a2ensite 000-default | ||
when: result|failed | ||
|
||
- name: Rolling back - Removing out virtualhost | ||
command: a2dissite awesome-app | ||
when: result|failed | ||
|
||
- name: Rolling back - Ending playbook | ||
fail: msg="Configuration file is not valid. Please check that before re-running the playbook." | ||
when: result|failed | ||
|
||
- name: Deploy our awesome application | ||
git: repo=https://github.com/leucos/ansible-tuto-demosite.git dest=/var/www/awesome-app | ||
tags: deploy | ||
|
||
- name: Deactivates the default virtualhost | ||
command: a2dissite 000-default | ||
|
||
- name: Deactivates the default ssl virtualhost | ||
command: a2dissite default-ssl | ||
notify: | ||
- restart apache | ||
|
||
handlers: | ||
- name: restart apache | ||
service: name=apache2 state=restarted | ||
--- | ||
- hosts: web | ||
tasks: | ||
- name: Updates apt cache | ||
apt: | ||
update_cache: true | ||
|
||
- name: Installs necessary packages | ||
apt: | ||
pkg: "{{ item }}" | ||
state: latest | ||
with_items: | ||
- apache2 | ||
- libapache2-mod-php5 | ||
- git | ||
|
||
- name: Push future default virtual host configuration | ||
copy: | ||
src: files/awesome-app | ||
dest: /etc/apache2/sites-available/awesome-app.conf | ||
mode: 0640 | ||
|
||
- name: Activates our virtualhost | ||
command: a2ensite awesome-app | ||
|
||
- name: Check that our config is valid | ||
command: apache2ctl configtest | ||
register: result | ||
ignore_errors: True | ||
|
||
- name: Rolling back - Restoring old default virtualhost | ||
command: a2ensite 000-default | ||
when: result|failed | ||
|
||
- name: Rolling back - Removing out virtualhost | ||
command: a2dissite awesome-app | ||
when: result|failed | ||
|
||
- name: Rolling back - Ending playbook | ||
fail: | ||
msg: "Configuration file is not valid. Please check that before re-running the playbook." | ||
when: result|failed | ||
|
||
- name: Deploy our awesome application | ||
git: | ||
repo: https://github.com/leucos/ansible-tuto-demosite.git | ||
dest: /var/www/awesome-app | ||
tags: deploy | ||
|
||
- name: Deactivates the default virtualhost | ||
command: a2dissite 000-default | ||
|
||
- name: Deactivates the default ssl virtualhost | ||
command: a2dissite default-ssl | ||
notify: | ||
- restart apache | ||
|
||
handlers: | ||
- name: restart apache | ||
service: | ||
name: apache2 | ||
state: restarted |
Oops, something went wrong.