Exercice: commit initial
This commit is contained in:
9
0README
Normal file
9
0README
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
Prérequis: lancer ssh
|
||||||
|
ouvrire parefeu
|
||||||
|
Chaque sous répertoire peut être récupéré via git:
|
||||||
|
|
||||||
|
Compte: formation
|
||||||
|
Mot de passe: F1234
|
||||||
|
|
||||||
|
echo "Host {{ ip_formateur }}\nPort 2222\nUser formation" >> ~/.ssh/config
|
||||||
|
git clone ip_formateur:/home/tom/Current/Corrections/N
|
||||||
43
10_premier_playbook/apache.yml
Normal file
43
10_premier_playbook/apache.yml
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
---
|
||||||
|
- name: install apache via ansible playbook
|
||||||
|
hosts: test
|
||||||
|
become: false
|
||||||
|
user: root
|
||||||
|
tasks:
|
||||||
|
- name: install apache
|
||||||
|
yum:
|
||||||
|
name: httpd
|
||||||
|
state: latest
|
||||||
|
|
||||||
|
- name: conf httpd
|
||||||
|
template:
|
||||||
|
src: vhost.conf
|
||||||
|
dest: /etc/httpd/conf.d/vhost.conf
|
||||||
|
mode: 0640
|
||||||
|
owner: root
|
||||||
|
group: apache
|
||||||
|
|
||||||
|
- name: activate apache
|
||||||
|
service:
|
||||||
|
name: httpd
|
||||||
|
enabled: yes
|
||||||
|
state: restarted
|
||||||
|
|
||||||
|
- name: open firewall port
|
||||||
|
tags: dev
|
||||||
|
firewalld:
|
||||||
|
service: http
|
||||||
|
permanent: yes
|
||||||
|
immediate: yes
|
||||||
|
state: enabled
|
||||||
|
|
||||||
|
- name: create documentroot
|
||||||
|
file:
|
||||||
|
name: /var/www/html/orsys.fr
|
||||||
|
state: directory
|
||||||
|
|
||||||
|
- name: copy index file
|
||||||
|
copy:
|
||||||
|
src: index.html
|
||||||
|
dest: /var/www/html/orsys.fr/index.html
|
||||||
|
mode: 0644
|
||||||
1
10_premier_playbook/index.html
Normal file
1
10_premier_playbook/index.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
test
|
||||||
17
10_premier_playbook/vhost.conf
Normal file
17
10_premier_playbook/vhost.conf
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<VirtualHost *:80>
|
||||||
|
ServerName orsys.fr
|
||||||
|
ServerAlias www.orsys.fr
|
||||||
|
ServerAlias 100.0.0.100
|
||||||
|
DocumentRoot /var/www/html/orsys.fr/
|
||||||
|
CustomLog /var/log/httpd/orsys.fr_access.log combined
|
||||||
|
ErrorLog /var/log/httpd/orsys.fr_error.log
|
||||||
|
<Directory />
|
||||||
|
Options none
|
||||||
|
Allowoverride none
|
||||||
|
Require all denied
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
<Directory /var/www/html/orsys.fr>
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
|
</VirtualHost>
|
||||||
38
11_gestion_erreurs/apache.yml
Normal file
38
11_gestion_erreurs/apache.yml
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
---
|
||||||
|
- name: install apache via ansible playbook
|
||||||
|
hosts: test
|
||||||
|
user: formation
|
||||||
|
become: true
|
||||||
|
tasks:
|
||||||
|
- name: install apache
|
||||||
|
yum:
|
||||||
|
name: httpd
|
||||||
|
state: latest
|
||||||
|
- name: conf httpd
|
||||||
|
template:
|
||||||
|
src: vhost.conf
|
||||||
|
dest: /etc/httpd/conf.d/vhost.conf
|
||||||
|
mode: 0640
|
||||||
|
owner: root
|
||||||
|
group: apache
|
||||||
|
- name: activate apache
|
||||||
|
service:
|
||||||
|
name: httpd
|
||||||
|
enabled: yes
|
||||||
|
state: restarted
|
||||||
|
- name: open firewall port
|
||||||
|
firewalld:
|
||||||
|
service: http
|
||||||
|
permanent: yes
|
||||||
|
immediate: yes
|
||||||
|
state: enabled
|
||||||
|
ignore_errors: yes
|
||||||
|
- name: create documentroot
|
||||||
|
file:
|
||||||
|
name: /var/www/html/orsys.fr
|
||||||
|
state: directory
|
||||||
|
- name: create index file
|
||||||
|
copy:
|
||||||
|
src: index.html
|
||||||
|
dest: /var/www/html/orsys.fr/index.html
|
||||||
|
mode: 0644
|
||||||
54
12_handlers/apache.yml
Normal file
54
12_handlers/apache.yml
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
---
|
||||||
|
- name: install apache via ansible playbook
|
||||||
|
hosts: test
|
||||||
|
user: formation
|
||||||
|
become: true
|
||||||
|
handlers:
|
||||||
|
- name: reload httpd
|
||||||
|
service:
|
||||||
|
name: httpd
|
||||||
|
state: restarted
|
||||||
|
|
||||||
|
- name: reload firewalld
|
||||||
|
service:
|
||||||
|
name: firewalld
|
||||||
|
state: reloaded
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: install apache
|
||||||
|
yum:
|
||||||
|
name: httpd
|
||||||
|
state: latest
|
||||||
|
- name: conf httpd
|
||||||
|
notify: reload httpd
|
||||||
|
template:
|
||||||
|
src: vhost.conf
|
||||||
|
dest: /etc/httpd/conf.d/vhost.conf
|
||||||
|
mode: 0640
|
||||||
|
owner: root
|
||||||
|
group: apache
|
||||||
|
|
||||||
|
- name: activate apache
|
||||||
|
service:
|
||||||
|
name: httpd
|
||||||
|
enabled: yes
|
||||||
|
|
||||||
|
- name: open firewall port
|
||||||
|
firewalld:
|
||||||
|
service: http
|
||||||
|
permanent: yes
|
||||||
|
immediate: yes
|
||||||
|
state: enabled
|
||||||
|
ignore_errors: yes
|
||||||
|
notify: reload firewalld
|
||||||
|
|
||||||
|
- name: create documentroot
|
||||||
|
file:
|
||||||
|
name: /var/www/html/orsys.fr
|
||||||
|
state: directory
|
||||||
|
|
||||||
|
- name: create index file
|
||||||
|
copy:
|
||||||
|
src: index.html
|
||||||
|
dest: /var/www/html/orsys.fr/index.html
|
||||||
|
mode: 0644
|
||||||
1
12_handlers/index.html
Normal file
1
12_handlers/index.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
test
|
||||||
17
12_handlers/vhost.conf
Normal file
17
12_handlers/vhost.conf
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<VirtualHost *:80>
|
||||||
|
ServerName orsys.fr
|
||||||
|
ServerAlias www.orsys.fr
|
||||||
|
ServerAlias 100.0.0.100
|
||||||
|
DocumentRoot /var/www/html/orsys.fr/
|
||||||
|
CustomLog /var/log/httpd/orsys.fr_access.log combined
|
||||||
|
ErrorLog /var/log/httpd/orsys.fr_error.log
|
||||||
|
<Directory />
|
||||||
|
Options none
|
||||||
|
Allowoverride none
|
||||||
|
Require all denied
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
<Directory /var/www/html/orsys.fr>
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
|
</VirtualHost>
|
||||||
61
14_tags/apache.yml
Normal file
61
14_tags/apache.yml
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
---
|
||||||
|
- name: install apache via ansible playbook
|
||||||
|
hosts: test
|
||||||
|
user: formation
|
||||||
|
become: true
|
||||||
|
handlers:
|
||||||
|
- name: reload httpd
|
||||||
|
service:
|
||||||
|
name: httpd
|
||||||
|
state: reloaded
|
||||||
|
|
||||||
|
- name: reload firewalld
|
||||||
|
service:
|
||||||
|
name: firewalld
|
||||||
|
state: reloaded
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: install apache
|
||||||
|
tags: httpd
|
||||||
|
yum:
|
||||||
|
name: httpd
|
||||||
|
state: latest
|
||||||
|
- name: conf httpd
|
||||||
|
tags: httpd
|
||||||
|
notify: reload httpd
|
||||||
|
template:
|
||||||
|
src: vhost.conf
|
||||||
|
dest: /etc/httpd/conf.d/vhost.conf
|
||||||
|
mode: 0640
|
||||||
|
owner: root
|
||||||
|
group: apache
|
||||||
|
|
||||||
|
- name: activate apache
|
||||||
|
tags: httpd
|
||||||
|
service:
|
||||||
|
name: httpd
|
||||||
|
enabled: yes
|
||||||
|
state: restarted
|
||||||
|
|
||||||
|
- name: open firewall port
|
||||||
|
tags: httpd
|
||||||
|
firewalld:
|
||||||
|
service: http
|
||||||
|
permanent: yes
|
||||||
|
immediate: yes
|
||||||
|
state: enabled
|
||||||
|
ignore_errors: yes
|
||||||
|
notify: reload firewalld
|
||||||
|
|
||||||
|
- name: create documentroot
|
||||||
|
tags: httpd
|
||||||
|
file:
|
||||||
|
name: /var/www/html/orsys.fr
|
||||||
|
state: directory
|
||||||
|
|
||||||
|
- name: create index file
|
||||||
|
tags: httpd
|
||||||
|
copy:
|
||||||
|
src: index.html
|
||||||
|
dest: /var/www/html/orsys.fr/index.html
|
||||||
|
mode: 0644
|
||||||
6
15_roles/apache.yml
Normal file
6
15_roles/apache.yml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
- hosts: test
|
||||||
|
become: true
|
||||||
|
user: formation
|
||||||
|
roles:
|
||||||
|
- myapache
|
||||||
38
15_roles/myapache/README.md
Normal file
38
15_roles/myapache/README.md
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
Role Name
|
||||||
|
=========
|
||||||
|
|
||||||
|
A brief description of the role goes here.
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
|
||||||
|
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
|
||||||
|
|
||||||
|
Role Variables
|
||||||
|
--------------
|
||||||
|
|
||||||
|
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
|
||||||
|
|
||||||
|
Dependencies
|
||||||
|
------------
|
||||||
|
|
||||||
|
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
|
||||||
|
|
||||||
|
Example Playbook
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||||
|
|
||||||
|
- hosts: servers
|
||||||
|
roles:
|
||||||
|
- { role: username.rolename, x: 42 }
|
||||||
|
|
||||||
|
License
|
||||||
|
-------
|
||||||
|
|
||||||
|
BSD
|
||||||
|
|
||||||
|
Author Information
|
||||||
|
------------------
|
||||||
|
|
||||||
|
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
|
||||||
2
15_roles/myapache/defaults/main.yml
Normal file
2
15_roles/myapache/defaults/main.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# defaults file for 15_apache
|
||||||
1
15_roles/myapache/files/index.html
Normal file
1
15_roles/myapache/files/index.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<h1>hello World</h1>
|
||||||
17
15_roles/myapache/files/vhost.conf
Normal file
17
15_roles/myapache/files/vhost.conf
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<VirtualHost *:80>
|
||||||
|
ServerName orsys.fr
|
||||||
|
ServerAlias www.orsys.fr
|
||||||
|
ServerAlias 100.0.0.100
|
||||||
|
DocumentRoot /var/www/html/orsys.fr/
|
||||||
|
CustomLog /var/log/httpd/orsys.fr_access.log combined
|
||||||
|
ErrorLog /var/log/httpd/orsys.fr_error.log
|
||||||
|
<Directory />
|
||||||
|
Options none
|
||||||
|
Allowoverride none
|
||||||
|
Require all denied
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
<Directory /var/www/html/orsys.fr>
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
|
</VirtualHost>
|
||||||
11
15_roles/myapache/handlers/main.yml
Normal file
11
15_roles/myapache/handlers/main.yml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
# handlers file for 15_apache
|
||||||
|
- name: reload httpd
|
||||||
|
service:
|
||||||
|
name: httpd
|
||||||
|
state: reloaded
|
||||||
|
|
||||||
|
- name: reload firewalld
|
||||||
|
service:
|
||||||
|
name: firewalld
|
||||||
|
state: reloaded
|
||||||
57
15_roles/myapache/meta/main.yml
Normal file
57
15_roles/myapache/meta/main.yml
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
galaxy_info:
|
||||||
|
author: your name
|
||||||
|
description: your description
|
||||||
|
company: your company (optional)
|
||||||
|
|
||||||
|
# If the issue tracker for your role is not on github, uncomment the
|
||||||
|
# next line and provide a value
|
||||||
|
# issue_tracker_url: http://example.com/issue/tracker
|
||||||
|
|
||||||
|
# Some suggested licenses:
|
||||||
|
# - BSD (default)
|
||||||
|
# - MIT
|
||||||
|
# - GPLv2
|
||||||
|
# - GPLv3
|
||||||
|
# - Apache
|
||||||
|
# - CC-BY
|
||||||
|
license: license (GPLv2, CC-BY, etc)
|
||||||
|
|
||||||
|
min_ansible_version: 1.2
|
||||||
|
|
||||||
|
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||||
|
# min_ansible_container_version:
|
||||||
|
|
||||||
|
# Optionally specify the branch Galaxy will use when accessing the GitHub
|
||||||
|
# repo for this role. During role install, if no tags are available,
|
||||||
|
# Galaxy will use this branch. During import Galaxy will access files on
|
||||||
|
# this branch. If Travis integration is configured, only notifications for this
|
||||||
|
# branch will be accepted. Otherwise, in all cases, the repo's default branch
|
||||||
|
# (usually master) will be used.
|
||||||
|
#github_branch:
|
||||||
|
|
||||||
|
#
|
||||||
|
# platforms is a list of platforms, and each platform has a name and a list of versions.
|
||||||
|
#
|
||||||
|
# platforms:
|
||||||
|
# - name: Fedora
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 25
|
||||||
|
# - name: SomePlatform
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 1.0
|
||||||
|
# - 7
|
||||||
|
# - 99.99
|
||||||
|
|
||||||
|
galaxy_tags: []
|
||||||
|
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||||
|
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||||
|
# remove the '[]' above, if you add tags to this list.
|
||||||
|
#
|
||||||
|
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||||
|
# Maximum 20 tags per role.
|
||||||
|
|
||||||
|
dependencies: []
|
||||||
|
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||||
|
# if you add dependencies to this list.
|
||||||
47
15_roles/myapache/tasks/main.yml
Normal file
47
15_roles/myapache/tasks/main.yml
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
---
|
||||||
|
# tasks file for 15_apache
|
||||||
|
- name: install apache
|
||||||
|
tags: httpd
|
||||||
|
yum:
|
||||||
|
name: httpd
|
||||||
|
state: latest
|
||||||
|
|
||||||
|
- name: conf httpd
|
||||||
|
tags: httpd
|
||||||
|
notify: reload httpd
|
||||||
|
template:
|
||||||
|
src: vhost.conf
|
||||||
|
dest: /etc/httpd/conf.d/vhost.conf
|
||||||
|
mode: 0640
|
||||||
|
owner: root
|
||||||
|
group: apache
|
||||||
|
|
||||||
|
- name: activate apache
|
||||||
|
tags: httpd
|
||||||
|
service:
|
||||||
|
name: httpd
|
||||||
|
enabled: yes
|
||||||
|
state: restarted
|
||||||
|
|
||||||
|
- name: open firewall port
|
||||||
|
tags: httpd
|
||||||
|
firewalld:
|
||||||
|
service: http
|
||||||
|
permanent: yes
|
||||||
|
immediate: yes
|
||||||
|
state: enabled
|
||||||
|
ignore_errors: yes
|
||||||
|
notify: reload firewalld
|
||||||
|
|
||||||
|
- name: create documentroot
|
||||||
|
tags: httpd
|
||||||
|
file:
|
||||||
|
name: /var/www/html/orsys.fr
|
||||||
|
state: directory
|
||||||
|
|
||||||
|
- name: create index file
|
||||||
|
tags: httpd
|
||||||
|
copy:
|
||||||
|
src: index.html
|
||||||
|
dest: /var/www/html/orsys.fr/index.html
|
||||||
|
mode: 0644
|
||||||
2
15_roles/myapache/tests/inventory
Normal file
2
15_roles/myapache/tests/inventory
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
localhost
|
||||||
|
|
||||||
5
15_roles/myapache/tests/test.yml
Normal file
5
15_roles/myapache/tests/test.yml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
remote_user: root
|
||||||
|
roles:
|
||||||
|
- 15_apache
|
||||||
2
15_roles/myapache/vars/main.yml
Normal file
2
15_roles/myapache/vars/main.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# vars file for 15_apache
|
||||||
12
16_galaxy/apache_geerlingguy.yml
Normal file
12
16_galaxy/apache_geerlingguy.yml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
- hosts: test
|
||||||
|
become: true
|
||||||
|
user: formation
|
||||||
|
vars:
|
||||||
|
- apache_vhosts:
|
||||||
|
- servername: vhost1
|
||||||
|
documentroot: /var/www/html/vhost1
|
||||||
|
- servername: vhost2
|
||||||
|
documentroot: /var/www/html/vhost2
|
||||||
|
roles:
|
||||||
|
- geerlingguy.apach
|
||||||
8
17.1_variable/apache.yml
Normal file
8
17.1_variable/apache.yml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
- name: install apache via ansible playbook
|
||||||
|
hosts: test
|
||||||
|
user: formation
|
||||||
|
become: true
|
||||||
|
roles:
|
||||||
|
- { role: myapache, servername: 'thomas.fr' }
|
||||||
|
- { role: myapache, servername: 'sophie.fr' }
|
||||||
45
17.1_variable/myapache/README.md
Normal file
45
17.1_variable/myapache/README.md
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
Role Name
|
||||||
|
=========
|
||||||
|
|
||||||
|
Rôle de deploiement apache sur une centos.
|
||||||
|
|
||||||
|
1 seul vhost
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
|
||||||
|
None
|
||||||
|
|
||||||
|
Role Variables
|
||||||
|
--------------
|
||||||
|
|
||||||
|
http_port: 80
|
||||||
|
servername: orsys.fr
|
||||||
|
serveralias: "www.{{ servername }}"
|
||||||
|
documentroot: /var/www/html/orsys.fr
|
||||||
|
accesslog: /var/log/httpd/access_orsys.fr_log
|
||||||
|
errorlog: /var/log/httpd/error_orsys.fr_log
|
||||||
|
|
||||||
|
Dependencies
|
||||||
|
------------
|
||||||
|
|
||||||
|
None
|
||||||
|
|
||||||
|
Example Playbook
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||||
|
|
||||||
|
- hosts: servers
|
||||||
|
roles:
|
||||||
|
- { myapache }
|
||||||
|
|
||||||
|
License
|
||||||
|
-------
|
||||||
|
|
||||||
|
BSD
|
||||||
|
|
||||||
|
Author Information
|
||||||
|
------------------
|
||||||
|
|
||||||
|
Thomas Constans <thomas@opendoor.fr>
|
||||||
2
17.1_variable/myapache/defaults/main.yml
Normal file
2
17.1_variable/myapache/defaults/main.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# defaults file for myapache
|
||||||
1
17.1_variable/myapache/files/index.html
Normal file
1
17.1_variable/myapache/files/index.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<h1>hello World</h1>
|
||||||
11
17.1_variable/myapache/handlers/main.yml
Normal file
11
17.1_variable/myapache/handlers/main.yml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
# handlers file for myapache
|
||||||
|
- name: reload httpd
|
||||||
|
service:
|
||||||
|
name: httpd
|
||||||
|
state: reloaded
|
||||||
|
|
||||||
|
- name: reload firewalld
|
||||||
|
service:
|
||||||
|
name: firewalld
|
||||||
|
state: reloaded
|
||||||
57
17.1_variable/myapache/meta/main.yml
Normal file
57
17.1_variable/myapache/meta/main.yml
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
galaxy_info:
|
||||||
|
author: your name
|
||||||
|
description: your description
|
||||||
|
company: your company (optional)
|
||||||
|
|
||||||
|
# If the issue tracker for your role is not on github, uncomment the
|
||||||
|
# next line and provide a value
|
||||||
|
# issue_tracker_url: http://example.com/issue/tracker
|
||||||
|
|
||||||
|
# Some suggested licenses:
|
||||||
|
# - BSD (default)
|
||||||
|
# - MIT
|
||||||
|
# - GPLv2
|
||||||
|
# - GPLv3
|
||||||
|
# - Apache
|
||||||
|
# - CC-BY
|
||||||
|
license: license (GPLv2, CC-BY, etc)
|
||||||
|
|
||||||
|
min_ansible_version: 1.2
|
||||||
|
|
||||||
|
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||||
|
# min_ansible_container_version:
|
||||||
|
|
||||||
|
# Optionally specify the branch Galaxy will use when accessing the GitHub
|
||||||
|
# repo for this role. During role install, if no tags are available,
|
||||||
|
# Galaxy will use this branch. During import Galaxy will access files on
|
||||||
|
# this branch. If Travis integration is configured, only notifications for this
|
||||||
|
# branch will be accepted. Otherwise, in all cases, the repo's default branch
|
||||||
|
# (usually master) will be used.
|
||||||
|
#github_branch:
|
||||||
|
|
||||||
|
#
|
||||||
|
# platforms is a list of platforms, and each platform has a name and a list of versions.
|
||||||
|
#
|
||||||
|
# platforms:
|
||||||
|
# - name: Fedora
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 25
|
||||||
|
# - name: SomePlatform
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 1.0
|
||||||
|
# - 7
|
||||||
|
# - 99.99
|
||||||
|
|
||||||
|
galaxy_tags: []
|
||||||
|
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||||
|
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||||
|
# remove the '[]' above, if you add tags to this list.
|
||||||
|
#
|
||||||
|
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||||
|
# Maximum 20 tags per role.
|
||||||
|
|
||||||
|
dependencies: []
|
||||||
|
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||||
|
# if you add dependencies to this list.
|
||||||
46
17.1_variable/myapache/tasks/main.yml
Normal file
46
17.1_variable/myapache/tasks/main.yml
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
---
|
||||||
|
# tasks file for myapache
|
||||||
|
- name: install apache
|
||||||
|
tags: httpd
|
||||||
|
yum:
|
||||||
|
name: httpd
|
||||||
|
state: latest
|
||||||
|
- name: conf httpd
|
||||||
|
tags: httpd
|
||||||
|
notify: reload httpd
|
||||||
|
template:
|
||||||
|
src: vhost.conf.jj
|
||||||
|
dest: /etc/httpd/conf.d/vhost_{{servername}}.conf
|
||||||
|
mode: 0640
|
||||||
|
owner: root
|
||||||
|
group: apache
|
||||||
|
|
||||||
|
- name: activate apache
|
||||||
|
tags: httpd
|
||||||
|
service:
|
||||||
|
name: httpd
|
||||||
|
enabled: yes
|
||||||
|
state: restarted
|
||||||
|
|
||||||
|
- name: open firewall port
|
||||||
|
tags: httpd
|
||||||
|
firewalld:
|
||||||
|
service: http
|
||||||
|
permanent: yes
|
||||||
|
immediate: yes
|
||||||
|
state: enabled
|
||||||
|
ignore_errors: yes
|
||||||
|
notify: reload firewalld
|
||||||
|
|
||||||
|
- name: create documentroot
|
||||||
|
tags: httpd
|
||||||
|
file:
|
||||||
|
name: "/var/www/html/{{ servername }}"
|
||||||
|
state: directory
|
||||||
|
|
||||||
|
- name: create index file
|
||||||
|
tags: httpd
|
||||||
|
copy:
|
||||||
|
src: index.html
|
||||||
|
dest: "/var/www/html/{{ servername }}/index.html"
|
||||||
|
mode: 0644
|
||||||
16
17.1_variable/myapache/templates/vhost.conf.jj
Normal file
16
17.1_variable/myapache/templates/vhost.conf.jj
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<VirtualHost *:{{ http_port }}>
|
||||||
|
ServerName {{ servername }}
|
||||||
|
ServerAlias {{ serveralias }}
|
||||||
|
DocumentRoot {{ documentroot }}
|
||||||
|
CustomLog {{ accesslog }} combined
|
||||||
|
ErrorLog {{ errorlog }}
|
||||||
|
<Directory />
|
||||||
|
Options none
|
||||||
|
Allowoverride none
|
||||||
|
Require all denied
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
<Directory {{ documentroot }}>
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
|
</VirtualHost>
|
||||||
2
17.1_variable/myapache/tests/inventory
Normal file
2
17.1_variable/myapache/tests/inventory
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
localhost
|
||||||
|
|
||||||
5
17.1_variable/myapache/tests/test.yml
Normal file
5
17.1_variable/myapache/tests/test.yml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
remote_user: root
|
||||||
|
roles:
|
||||||
|
- myapache
|
||||||
8
17.1_variable/myapache/vars/main.yml
Normal file
8
17.1_variable/myapache/vars/main.yml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
# vars file for myapache
|
||||||
|
http_port: 80
|
||||||
|
servername: orsys.fr
|
||||||
|
serveralias: "www.{{ servername }}"
|
||||||
|
documentroot: /var/www/html/orsys.fr
|
||||||
|
accesslog: /var/log/httpd/access_orsys.fr_log
|
||||||
|
errorlog: /var/log/httpd/error_orsys.fr_log
|
||||||
7
17.2_variable/apache.yml
Normal file
7
17.2_variable/apache.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
- name: install apache via ansible playbook
|
||||||
|
hosts: test
|
||||||
|
user: formation
|
||||||
|
become: true
|
||||||
|
roles:
|
||||||
|
- myapache2
|
||||||
45
17.2_variable/myapache2/README.md
Normal file
45
17.2_variable/myapache2/README.md
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
Role Name
|
||||||
|
=========
|
||||||
|
|
||||||
|
Rôle de deploiement apache sur une centos.
|
||||||
|
|
||||||
|
1 seul vhost
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
|
||||||
|
None
|
||||||
|
|
||||||
|
Role Variables
|
||||||
|
--------------
|
||||||
|
|
||||||
|
http_port: 80
|
||||||
|
servername: orsys.fr
|
||||||
|
serveralias: "www.{{ servername }}"
|
||||||
|
documentroot: /var/www/html/orsys.fr
|
||||||
|
accesslog: /var/log/httpd/access_orsys.fr_log
|
||||||
|
errorlog: /var/log/httpd/error_orsys.fr_log
|
||||||
|
|
||||||
|
Dependencies
|
||||||
|
------------
|
||||||
|
|
||||||
|
None
|
||||||
|
|
||||||
|
Example Playbook
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||||
|
|
||||||
|
- hosts: servers
|
||||||
|
roles:
|
||||||
|
- { myapache }
|
||||||
|
|
||||||
|
License
|
||||||
|
-------
|
||||||
|
|
||||||
|
BSD
|
||||||
|
|
||||||
|
Author Information
|
||||||
|
------------------
|
||||||
|
|
||||||
|
Thomas Constans <thomas@opendoor.fr>
|
||||||
2
17.2_variable/myapache2/defaults/main.yml
Normal file
2
17.2_variable/myapache2/defaults/main.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# defaults file for myapache
|
||||||
1
17.2_variable/myapache2/files/index.html
Normal file
1
17.2_variable/myapache2/files/index.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<h1>hello World</h1>
|
||||||
11
17.2_variable/myapache2/handlers/main.yml
Normal file
11
17.2_variable/myapache2/handlers/main.yml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
# handlers file for myapache
|
||||||
|
- name: reload httpd
|
||||||
|
service:
|
||||||
|
name: httpd
|
||||||
|
state: reloaded
|
||||||
|
|
||||||
|
- name: reload firewalld
|
||||||
|
service:
|
||||||
|
name: firewalld
|
||||||
|
state: reloaded
|
||||||
57
17.2_variable/myapache2/meta/main.yml
Normal file
57
17.2_variable/myapache2/meta/main.yml
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
galaxy_info:
|
||||||
|
author: your name
|
||||||
|
description: your description
|
||||||
|
company: your company (optional)
|
||||||
|
|
||||||
|
# If the issue tracker for your role is not on github, uncomment the
|
||||||
|
# next line and provide a value
|
||||||
|
# issue_tracker_url: http://example.com/issue/tracker
|
||||||
|
|
||||||
|
# Some suggested licenses:
|
||||||
|
# - BSD (default)
|
||||||
|
# - MIT
|
||||||
|
# - GPLv2
|
||||||
|
# - GPLv3
|
||||||
|
# - Apache
|
||||||
|
# - CC-BY
|
||||||
|
license: license (GPLv2, CC-BY, etc)
|
||||||
|
|
||||||
|
min_ansible_version: 1.2
|
||||||
|
|
||||||
|
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||||
|
# min_ansible_container_version:
|
||||||
|
|
||||||
|
# Optionally specify the branch Galaxy will use when accessing the GitHub
|
||||||
|
# repo for this role. During role install, if no tags are available,
|
||||||
|
# Galaxy will use this branch. During import Galaxy will access files on
|
||||||
|
# this branch. If Travis integration is configured, only notifications for this
|
||||||
|
# branch will be accepted. Otherwise, in all cases, the repo's default branch
|
||||||
|
# (usually master) will be used.
|
||||||
|
#github_branch:
|
||||||
|
|
||||||
|
#
|
||||||
|
# platforms is a list of platforms, and each platform has a name and a list of versions.
|
||||||
|
#
|
||||||
|
# platforms:
|
||||||
|
# - name: Fedora
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 25
|
||||||
|
# - name: SomePlatform
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 1.0
|
||||||
|
# - 7
|
||||||
|
# - 99.99
|
||||||
|
|
||||||
|
galaxy_tags: []
|
||||||
|
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||||
|
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||||
|
# remove the '[]' above, if you add tags to this list.
|
||||||
|
#
|
||||||
|
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||||
|
# Maximum 20 tags per role.
|
||||||
|
|
||||||
|
dependencies: []
|
||||||
|
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||||
|
# if you add dependencies to this list.
|
||||||
50
17.2_variable/myapache2/tasks/main.yml
Normal file
50
17.2_variable/myapache2/tasks/main.yml
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
---
|
||||||
|
# tasks file for myapache
|
||||||
|
- name: install apache
|
||||||
|
tags: httpd
|
||||||
|
yum:
|
||||||
|
name: httpd
|
||||||
|
state: latest
|
||||||
|
- name: conf httpd
|
||||||
|
tags: httpd
|
||||||
|
notify: reload httpd
|
||||||
|
template:
|
||||||
|
src: vhost.conf.jj
|
||||||
|
dest: /etc/httpd/conf.d/vhost_.conf
|
||||||
|
mode: 0640
|
||||||
|
owner: root
|
||||||
|
group: apache
|
||||||
|
|
||||||
|
- name: activate apache
|
||||||
|
tags: httpd
|
||||||
|
service:
|
||||||
|
name: httpd
|
||||||
|
enabled: yes
|
||||||
|
state: restarted
|
||||||
|
|
||||||
|
- name: open firewall port
|
||||||
|
tags: httpd
|
||||||
|
firewalld:
|
||||||
|
service: http
|
||||||
|
permanent: yes
|
||||||
|
immediate: yes
|
||||||
|
state: enabled
|
||||||
|
ignore_errors: yes
|
||||||
|
notify: reload firewalld
|
||||||
|
|
||||||
|
- name: create documentroot
|
||||||
|
tags: httpd
|
||||||
|
file:
|
||||||
|
name: "/var/www/html/{{ item.documentroot }}"
|
||||||
|
state: directory
|
||||||
|
with_items:
|
||||||
|
- "{{ apache_vhosts }}"
|
||||||
|
|
||||||
|
- name: create index file
|
||||||
|
tags: httpd
|
||||||
|
copy:
|
||||||
|
src: index.html
|
||||||
|
dest: "/var/www/html/{{ item.documentroot }}/index.html"
|
||||||
|
mode: 0644
|
||||||
|
with_items:
|
||||||
|
- "{{ apache_vhosts }}"
|
||||||
18
17.2_variable/myapache2/templates/vhost.conf.jj
Normal file
18
17.2_variable/myapache2/templates/vhost.conf.jj
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{% for vhost in apache_vhosts %}
|
||||||
|
<VirtualHost *:{{ http_port }}>
|
||||||
|
ServerName {{ vhost.servername }}
|
||||||
|
ServerAlias {{ vhost.serveralias }}
|
||||||
|
DocumentRoot {{ vhost.documentroot }}
|
||||||
|
CustomLog {{ vhost.accesslog }} combined
|
||||||
|
ErrorLog {{ vhost.errorlog }}
|
||||||
|
<Directory />
|
||||||
|
Options none
|
||||||
|
Allowoverride none
|
||||||
|
Require all denied
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
<Directory {{ vhost.documentroot }}>
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
|
</VirtualHost>
|
||||||
|
{% endfor %}
|
||||||
2
17.2_variable/myapache2/tests/inventory
Normal file
2
17.2_variable/myapache2/tests/inventory
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
localhost
|
||||||
|
|
||||||
5
17.2_variable/myapache2/tests/test.yml
Normal file
5
17.2_variable/myapache2/tests/test.yml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
remote_user: root
|
||||||
|
roles:
|
||||||
|
- myapache
|
||||||
14
17.2_variable/myapache2/vars/main.yml
Normal file
14
17.2_variable/myapache2/vars/main.yml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
# vars file for myapache
|
||||||
|
http_port: 80
|
||||||
|
apache_vhosts:
|
||||||
|
- servername: orsys.fr
|
||||||
|
serveralias: www.orsys.fr
|
||||||
|
documentroot: /var/www/html/orsys.fr
|
||||||
|
accesslog: /var/log/httpd/access_orsys.fr_log
|
||||||
|
errorlog: /var/log/httpd/error_orsys.fr_log
|
||||||
|
- servername: thomas.fr
|
||||||
|
serveralias: www.thomas.fr
|
||||||
|
documentroot: /var/www/html/thomas.fr
|
||||||
|
accesslog: /var/log/httpd/access_thomas.fr_log
|
||||||
|
errorlog: /var/log/httpd/error_thomas.fr_log
|
||||||
7
17.3_variable/apache.yml
Normal file
7
17.3_variable/apache.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
- name: install apache via ansible playbook
|
||||||
|
hosts: test
|
||||||
|
user: formation
|
||||||
|
become: true
|
||||||
|
roles:
|
||||||
|
- myapache3
|
||||||
45
17.3_variable/myapache3/README.md
Normal file
45
17.3_variable/myapache3/README.md
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
Role Name
|
||||||
|
=========
|
||||||
|
|
||||||
|
Rôle de deploiement apache sur une centos.
|
||||||
|
|
||||||
|
1 seul vhost
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
|
||||||
|
None
|
||||||
|
|
||||||
|
Role Variables
|
||||||
|
--------------
|
||||||
|
|
||||||
|
http_port: 80
|
||||||
|
servername: orsys.fr
|
||||||
|
serveralias: "www.{{ servername }}"
|
||||||
|
documentroot: /var/www/html/orsys.fr
|
||||||
|
accesslog: /var/log/httpd/access_orsys.fr_log
|
||||||
|
errorlog: /var/log/httpd/error_orsys.fr_log
|
||||||
|
|
||||||
|
Dependencies
|
||||||
|
------------
|
||||||
|
|
||||||
|
None
|
||||||
|
|
||||||
|
Example Playbook
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||||
|
|
||||||
|
- hosts: servers
|
||||||
|
roles:
|
||||||
|
- { myapache }
|
||||||
|
|
||||||
|
License
|
||||||
|
-------
|
||||||
|
|
||||||
|
BSD
|
||||||
|
|
||||||
|
Author Information
|
||||||
|
------------------
|
||||||
|
|
||||||
|
Thomas Constans <thomas@opendoor.fr>
|
||||||
2
17.3_variable/myapache3/defaults/main.yml
Normal file
2
17.3_variable/myapache3/defaults/main.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# defaults file for myapache
|
||||||
1
17.3_variable/myapache3/files/index.html
Normal file
1
17.3_variable/myapache3/files/index.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<h1>hello World</h1>
|
||||||
11
17.3_variable/myapache3/handlers/main.yml
Normal file
11
17.3_variable/myapache3/handlers/main.yml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
# handlers file for myapache
|
||||||
|
- name: reload httpd
|
||||||
|
service:
|
||||||
|
name: httpd
|
||||||
|
state: reloaded
|
||||||
|
|
||||||
|
- name: reload firewalld
|
||||||
|
service:
|
||||||
|
name: firewalld
|
||||||
|
state: reloaded
|
||||||
57
17.3_variable/myapache3/meta/main.yml
Normal file
57
17.3_variable/myapache3/meta/main.yml
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
galaxy_info:
|
||||||
|
author: your name
|
||||||
|
description: your description
|
||||||
|
company: your company (optional)
|
||||||
|
|
||||||
|
# If the issue tracker for your role is not on github, uncomment the
|
||||||
|
# next line and provide a value
|
||||||
|
# issue_tracker_url: http://example.com/issue/tracker
|
||||||
|
|
||||||
|
# Some suggested licenses:
|
||||||
|
# - BSD (default)
|
||||||
|
# - MIT
|
||||||
|
# - GPLv2
|
||||||
|
# - GPLv3
|
||||||
|
# - Apache
|
||||||
|
# - CC-BY
|
||||||
|
license: license (GPLv2, CC-BY, etc)
|
||||||
|
|
||||||
|
min_ansible_version: 1.2
|
||||||
|
|
||||||
|
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||||
|
# min_ansible_container_version:
|
||||||
|
|
||||||
|
# Optionally specify the branch Galaxy will use when accessing the GitHub
|
||||||
|
# repo for this role. During role install, if no tags are available,
|
||||||
|
# Galaxy will use this branch. During import Galaxy will access files on
|
||||||
|
# this branch. If Travis integration is configured, only notifications for this
|
||||||
|
# branch will be accepted. Otherwise, in all cases, the repo's default branch
|
||||||
|
# (usually master) will be used.
|
||||||
|
#github_branch:
|
||||||
|
|
||||||
|
#
|
||||||
|
# platforms is a list of platforms, and each platform has a name and a list of versions.
|
||||||
|
#
|
||||||
|
# platforms:
|
||||||
|
# - name: Fedora
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 25
|
||||||
|
# - name: SomePlatform
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 1.0
|
||||||
|
# - 7
|
||||||
|
# - 99.99
|
||||||
|
|
||||||
|
galaxy_tags: []
|
||||||
|
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||||
|
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||||
|
# remove the '[]' above, if you add tags to this list.
|
||||||
|
#
|
||||||
|
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||||
|
# Maximum 20 tags per role.
|
||||||
|
|
||||||
|
dependencies: []
|
||||||
|
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||||
|
# if you add dependencies to this list.
|
||||||
50
17.3_variable/myapache3/tasks/main.yml
Normal file
50
17.3_variable/myapache3/tasks/main.yml
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
---
|
||||||
|
# tasks file for myapache
|
||||||
|
- name: install apache
|
||||||
|
tags: httpd
|
||||||
|
yum:
|
||||||
|
name: httpd
|
||||||
|
state: latest
|
||||||
|
- name: conf httpd
|
||||||
|
tags: httpd
|
||||||
|
notify: reload httpd
|
||||||
|
template:
|
||||||
|
src: vhost.conf.jj
|
||||||
|
dest: /etc/httpd/conf.d/vhost.conf
|
||||||
|
mode: 0640
|
||||||
|
owner: root
|
||||||
|
group: apache
|
||||||
|
|
||||||
|
- name: activate apache
|
||||||
|
tags: httpd
|
||||||
|
service:
|
||||||
|
name: httpd
|
||||||
|
enabled: yes
|
||||||
|
state: restarted
|
||||||
|
|
||||||
|
- name: open firewall port
|
||||||
|
tags: httpd
|
||||||
|
firewalld:
|
||||||
|
service: http
|
||||||
|
permanent: yes
|
||||||
|
immediate: yes
|
||||||
|
state: enabled
|
||||||
|
ignore_errors: yes
|
||||||
|
notify: reload firewalld
|
||||||
|
|
||||||
|
- name: create documentroot
|
||||||
|
tags: httpd
|
||||||
|
file:
|
||||||
|
name: "/var/www/html/{{ item.documentroot }}"
|
||||||
|
state: directory
|
||||||
|
with_items:
|
||||||
|
- "{{ apache_vhosts }}"
|
||||||
|
|
||||||
|
- name: create index file
|
||||||
|
tags: httpd
|
||||||
|
copy:
|
||||||
|
src: index.html
|
||||||
|
dest: "/var/www/html/{{ item.documentroot }}/index.html"
|
||||||
|
mode: 0644
|
||||||
|
with_items:
|
||||||
|
- "{{ apache_vhosts }}"
|
||||||
BIN
17.3_variable/myapache3/templates/.vhost.conf.jj.swp
Normal file
BIN
17.3_variable/myapache3/templates/.vhost.conf.jj.swp
Normal file
Binary file not shown.
19
17.3_variable/myapache3/templates/vhost.conf.jj
Normal file
19
17.3_variable/myapache3/templates/vhost.conf.jj
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
{% for vhost in apache_vhosts %}
|
||||||
|
<VirtualHost *:{{ http_port }}>
|
||||||
|
ServerName {{ vhost.servername }}
|
||||||
|
ServerAlias {{ vhost.serveralias }}
|
||||||
|
DocumentRoot {{ vhost.documentroot }}
|
||||||
|
CustomLog {{ vhost.accesslog }} combined
|
||||||
|
ErrorLog {{ vhost.errorlog }}
|
||||||
|
<Directory />
|
||||||
|
Options none
|
||||||
|
Allowoverride none
|
||||||
|
Require all denied
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
<Directory {{ vhost.documentroot }}>
|
||||||
|
Options {{ vhost.documentrootoptions|default( "none" ) }}
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
|
</VirtualHost>
|
||||||
|
{% endfor %}
|
||||||
2
17.3_variable/myapache3/tests/inventory
Normal file
2
17.3_variable/myapache3/tests/inventory
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
localhost
|
||||||
|
|
||||||
5
17.3_variable/myapache3/tests/test.yml
Normal file
5
17.3_variable/myapache3/tests/test.yml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
remote_user: root
|
||||||
|
roles:
|
||||||
|
- myapache
|
||||||
BIN
17.3_variable/myapache3/vars/.main.yml.swp
Normal file
BIN
17.3_variable/myapache3/vars/.main.yml.swp
Normal file
Binary file not shown.
15
17.3_variable/myapache3/vars/main.yml
Normal file
15
17.3_variable/myapache3/vars/main.yml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
# vars file for myapache
|
||||||
|
http_port: 80
|
||||||
|
apache_vhosts:
|
||||||
|
- servername: orsys.fr
|
||||||
|
serveralias: www.orsys.fr
|
||||||
|
documentroot: /var/www/html/orsys.fr
|
||||||
|
accesslog: /var/log/httpd/access_orsys.fr_log
|
||||||
|
errorlog: /var/log/httpd/error_orsys.fr_log
|
||||||
|
- servername: thomas.fr
|
||||||
|
serveralias: www.thomas.fr
|
||||||
|
documentroot: /var/www/html/thomas.fr
|
||||||
|
accesslog: /var/log/httpd/access_thomas.fr_log
|
||||||
|
errorlog: /var/log/httpd/error_thomas.fr_log
|
||||||
|
documentrootoptions: indexes
|
||||||
7
20_conditions/apache.yml
Normal file
7
20_conditions/apache.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
- name: install apache via ansible playbook
|
||||||
|
hosts: test
|
||||||
|
user: formation
|
||||||
|
become: true
|
||||||
|
roles:
|
||||||
|
- myapache4
|
||||||
45
20_conditions/myapache4/README.md
Normal file
45
20_conditions/myapache4/README.md
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
Role Name
|
||||||
|
=========
|
||||||
|
|
||||||
|
Rôle de deploiement apache sur une centos.
|
||||||
|
|
||||||
|
1 seul vhost
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
|
||||||
|
None
|
||||||
|
|
||||||
|
Role Variables
|
||||||
|
--------------
|
||||||
|
|
||||||
|
http_port: 80
|
||||||
|
servername: orsys.fr
|
||||||
|
serveralias: "www.{{ servername }}"
|
||||||
|
documentroot: /var/www/html/orsys.fr
|
||||||
|
accesslog: /var/log/httpd/access_orsys.fr_log
|
||||||
|
errorlog: /var/log/httpd/error_orsys.fr_log
|
||||||
|
|
||||||
|
Dependencies
|
||||||
|
------------
|
||||||
|
|
||||||
|
None
|
||||||
|
|
||||||
|
Example Playbook
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||||
|
|
||||||
|
- hosts: servers
|
||||||
|
roles:
|
||||||
|
- { myapache }
|
||||||
|
|
||||||
|
License
|
||||||
|
-------
|
||||||
|
|
||||||
|
BSD
|
||||||
|
|
||||||
|
Author Information
|
||||||
|
------------------
|
||||||
|
|
||||||
|
Thomas Constans <thomas@opendoor.fr>
|
||||||
2
20_conditions/myapache4/defaults/main.yml
Normal file
2
20_conditions/myapache4/defaults/main.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# defaults file for myapache
|
||||||
1
20_conditions/myapache4/files/index.html
Normal file
1
20_conditions/myapache4/files/index.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<h1>hello World</h1>
|
||||||
11
20_conditions/myapache4/handlers/main.yml
Normal file
11
20_conditions/myapache4/handlers/main.yml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
# handlers file for myapache
|
||||||
|
- name: reload httpd
|
||||||
|
service:
|
||||||
|
name: httpd
|
||||||
|
state: reloaded
|
||||||
|
|
||||||
|
- name: reload firewalld
|
||||||
|
service:
|
||||||
|
name: firewalld
|
||||||
|
state: reloaded
|
||||||
57
20_conditions/myapache4/meta/main.yml
Normal file
57
20_conditions/myapache4/meta/main.yml
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
galaxy_info:
|
||||||
|
author: your name
|
||||||
|
description: your description
|
||||||
|
company: your company (optional)
|
||||||
|
|
||||||
|
# If the issue tracker for your role is not on github, uncomment the
|
||||||
|
# next line and provide a value
|
||||||
|
# issue_tracker_url: http://example.com/issue/tracker
|
||||||
|
|
||||||
|
# Some suggested licenses:
|
||||||
|
# - BSD (default)
|
||||||
|
# - MIT
|
||||||
|
# - GPLv2
|
||||||
|
# - GPLv3
|
||||||
|
# - Apache
|
||||||
|
# - CC-BY
|
||||||
|
license: license (GPLv2, CC-BY, etc)
|
||||||
|
|
||||||
|
min_ansible_version: 1.2
|
||||||
|
|
||||||
|
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||||
|
# min_ansible_container_version:
|
||||||
|
|
||||||
|
# Optionally specify the branch Galaxy will use when accessing the GitHub
|
||||||
|
# repo for this role. During role install, if no tags are available,
|
||||||
|
# Galaxy will use this branch. During import Galaxy will access files on
|
||||||
|
# this branch. If Travis integration is configured, only notifications for this
|
||||||
|
# branch will be accepted. Otherwise, in all cases, the repo's default branch
|
||||||
|
# (usually master) will be used.
|
||||||
|
#github_branch:
|
||||||
|
|
||||||
|
#
|
||||||
|
# platforms is a list of platforms, and each platform has a name and a list of versions.
|
||||||
|
#
|
||||||
|
# platforms:
|
||||||
|
# - name: Fedora
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 25
|
||||||
|
# - name: SomePlatform
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 1.0
|
||||||
|
# - 7
|
||||||
|
# - 99.99
|
||||||
|
|
||||||
|
galaxy_tags: []
|
||||||
|
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||||
|
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||||
|
# remove the '[]' above, if you add tags to this list.
|
||||||
|
#
|
||||||
|
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||||
|
# Maximum 20 tags per role.
|
||||||
|
|
||||||
|
dependencies: []
|
||||||
|
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||||
|
# if you add dependencies to this list.
|
||||||
55
20_conditions/myapache4/tasks/main.yml
Normal file
55
20_conditions/myapache4/tasks/main.yml
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
---
|
||||||
|
# tasks file for myapache
|
||||||
|
- name: import distribution specific variables
|
||||||
|
include_vars: "{{ ansible_distribution|lower }}.yml"
|
||||||
|
|
||||||
|
- name: install apache
|
||||||
|
tags: httpd
|
||||||
|
package:
|
||||||
|
name: "{{ package_name }}"
|
||||||
|
state: latest
|
||||||
|
|
||||||
|
- name: conf httpd
|
||||||
|
tags: httpd
|
||||||
|
notify: reload httpd
|
||||||
|
template:
|
||||||
|
src: vhost.conf.jj
|
||||||
|
dest: "{{ apache_conf_dir }}/vhost.conf"
|
||||||
|
mode: 0640
|
||||||
|
owner: root
|
||||||
|
group: "{{ apache_group }}"
|
||||||
|
|
||||||
|
- name: activate apache
|
||||||
|
tags: httpd
|
||||||
|
service:
|
||||||
|
name: "{{ service_name }}"
|
||||||
|
enabled: yes
|
||||||
|
state: restarted
|
||||||
|
|
||||||
|
- name: open firewall port
|
||||||
|
tags: httpd
|
||||||
|
firewalld:
|
||||||
|
service: http
|
||||||
|
permanent: yes
|
||||||
|
immediate: yes
|
||||||
|
state: enabled
|
||||||
|
ignore_errors: yes
|
||||||
|
notify: reload firewalld
|
||||||
|
when: ansible_distribution|lower != "debian"
|
||||||
|
|
||||||
|
- name: create documentroot
|
||||||
|
tags: httpd
|
||||||
|
file:
|
||||||
|
name: "{{ item.documentroot }}"
|
||||||
|
state: directory
|
||||||
|
with_items:
|
||||||
|
- "{{ apache_vhosts }}"
|
||||||
|
|
||||||
|
- name: create index file
|
||||||
|
tags: httpd
|
||||||
|
copy:
|
||||||
|
src: index.html
|
||||||
|
dest: "{{ item.documentroot }}/index.html"
|
||||||
|
mode: 0644
|
||||||
|
with_items:
|
||||||
|
- "{{ apache_vhosts }}"
|
||||||
19
20_conditions/myapache4/templates/vhost.conf.jj
Normal file
19
20_conditions/myapache4/templates/vhost.conf.jj
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
{% for vhost in apache_vhosts %}
|
||||||
|
<VirtualHost *:{{ http_port }}>
|
||||||
|
ServerName {{ vhost.servername|lower }}
|
||||||
|
ServerAlias {{ vhost.serveralias }}
|
||||||
|
DocumentRoot {{ vhost.documentroot }}
|
||||||
|
CustomLog {{ vhost.accesslog }} combined
|
||||||
|
ErrorLog {{ vhost.errorlog }}
|
||||||
|
<Directory />
|
||||||
|
Options none
|
||||||
|
Allowoverride none
|
||||||
|
Require all denied
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
<Directory {{ vhost.documentroot }}>
|
||||||
|
Options {{ vhost.documentrootoptions|default( "none" ) }}
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
|
</VirtualHost>
|
||||||
|
{% endfor %}
|
||||||
2
20_conditions/myapache4/tests/inventory
Normal file
2
20_conditions/myapache4/tests/inventory
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
localhost
|
||||||
|
|
||||||
5
20_conditions/myapache4/tests/test.yml
Normal file
5
20_conditions/myapache4/tests/test.yml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
remote_user: root
|
||||||
|
roles:
|
||||||
|
- myapache
|
||||||
1
20_conditions/myapache4/vars/centos.yml
Symbolic link
1
20_conditions/myapache4/vars/centos.yml
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
redhat.yml
|
||||||
7
20_conditions/myapache4/vars/debian.yml
Normal file
7
20_conditions/myapache4/vars/debian.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
apache_conf_dir: /etc/apache2/sites-enabled
|
||||||
|
apache_log_dir: /var/log/apache2
|
||||||
|
package_name: apache2
|
||||||
|
service_name: apache2
|
||||||
|
apache_user: www-data
|
||||||
|
apache_group: www-data
|
||||||
15
20_conditions/myapache4/vars/main.yml
Normal file
15
20_conditions/myapache4/vars/main.yml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
# vars file for myapache
|
||||||
|
http_port: 80
|
||||||
|
apache_vhosts:
|
||||||
|
- servername: ORSYS.Fr
|
||||||
|
serveralias: www.orsys.fr
|
||||||
|
documentroot: /var/www/html/orsys.fr
|
||||||
|
accesslog: "{{ apache_log_dir }}/access_orsys.fr_log"
|
||||||
|
errorlog: "{{ apache_log_dir }}/error_orsys.fr_log"
|
||||||
|
- servername: thomas.fr
|
||||||
|
serveralias: www.thomas.fr
|
||||||
|
documentroot: /var/www/html/thomas.fr
|
||||||
|
accesslog: "{{ apache_log_dir }}/access_thomas.fr_log"
|
||||||
|
errorlog: "{{ apache_log_dir }}/error_thomas.fr_log"
|
||||||
|
documentrootoptions: indexes
|
||||||
7
20_conditions/myapache4/vars/redhat.yml
Normal file
7
20_conditions/myapache4/vars/redhat.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
apache_conf_dir: /etc/httpd/conf.d/
|
||||||
|
apache_log_dir: /var/log/httpd
|
||||||
|
package_name: httpd
|
||||||
|
service_name: httpd
|
||||||
|
apache_user: apache
|
||||||
|
apache_group: apache
|
||||||
38
21_myphp/myphp/README.md
Normal file
38
21_myphp/myphp/README.md
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
Role Name
|
||||||
|
=========
|
||||||
|
|
||||||
|
A brief description of the role goes here.
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
|
||||||
|
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
|
||||||
|
|
||||||
|
Role Variables
|
||||||
|
--------------
|
||||||
|
|
||||||
|
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
|
||||||
|
|
||||||
|
Dependencies
|
||||||
|
------------
|
||||||
|
|
||||||
|
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
|
||||||
|
|
||||||
|
Example Playbook
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||||
|
|
||||||
|
- hosts: servers
|
||||||
|
roles:
|
||||||
|
- { role: username.rolename, x: 42 }
|
||||||
|
|
||||||
|
License
|
||||||
|
-------
|
||||||
|
|
||||||
|
BSD
|
||||||
|
|
||||||
|
Author Information
|
||||||
|
------------------
|
||||||
|
|
||||||
|
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
|
||||||
2
21_myphp/myphp/defaults/main.yml
Normal file
2
21_myphp/myphp/defaults/main.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# defaults file for myphp
|
||||||
2
21_myphp/myphp/handlers/main.yml
Normal file
2
21_myphp/myphp/handlers/main.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# handlers file for myphp
|
||||||
57
21_myphp/myphp/meta/main.yml
Normal file
57
21_myphp/myphp/meta/main.yml
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
galaxy_info:
|
||||||
|
author: your name
|
||||||
|
description: your description
|
||||||
|
company: your company (optional)
|
||||||
|
|
||||||
|
# If the issue tracker for your role is not on github, uncomment the
|
||||||
|
# next line and provide a value
|
||||||
|
# issue_tracker_url: http://example.com/issue/tracker
|
||||||
|
|
||||||
|
# Some suggested licenses:
|
||||||
|
# - BSD (default)
|
||||||
|
# - MIT
|
||||||
|
# - GPLv2
|
||||||
|
# - GPLv3
|
||||||
|
# - Apache
|
||||||
|
# - CC-BY
|
||||||
|
license: license (GPLv2, CC-BY, etc)
|
||||||
|
|
||||||
|
min_ansible_version: 1.2
|
||||||
|
|
||||||
|
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||||
|
# min_ansible_container_version:
|
||||||
|
|
||||||
|
# Optionally specify the branch Galaxy will use when accessing the GitHub
|
||||||
|
# repo for this role. During role install, if no tags are available,
|
||||||
|
# Galaxy will use this branch. During import Galaxy will access files on
|
||||||
|
# this branch. If Travis integration is configured, only notifications for this
|
||||||
|
# branch will be accepted. Otherwise, in all cases, the repo's default branch
|
||||||
|
# (usually master) will be used.
|
||||||
|
#github_branch:
|
||||||
|
|
||||||
|
#
|
||||||
|
# platforms is a list of platforms, and each platform has a name and a list of versions.
|
||||||
|
#
|
||||||
|
# platforms:
|
||||||
|
# - name: Fedora
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 25
|
||||||
|
# - name: SomePlatform
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 1.0
|
||||||
|
# - 7
|
||||||
|
# - 99.99
|
||||||
|
|
||||||
|
galaxy_tags: []
|
||||||
|
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||||
|
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||||
|
# remove the '[]' above, if you add tags to this list.
|
||||||
|
#
|
||||||
|
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||||
|
# Maximum 20 tags per role.
|
||||||
|
|
||||||
|
dependencies: []
|
||||||
|
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||||
|
# if you add dependencies to this list.
|
||||||
13
21_myphp/myphp/tasks/main.yml
Normal file
13
21_myphp/myphp/tasks/main.yml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
# tasks file for myphp
|
||||||
|
- name: import distribution specific variables
|
||||||
|
tags: php
|
||||||
|
include_vars: "{{ ansible_distribution|lower }}.yml"
|
||||||
|
|
||||||
|
- name: install php modules
|
||||||
|
tags: php
|
||||||
|
package:
|
||||||
|
name: "{{ item }}"
|
||||||
|
state: latest
|
||||||
|
with_items:
|
||||||
|
"{{ packages_list }}"
|
||||||
2
21_myphp/myphp/tests/inventory
Normal file
2
21_myphp/myphp/tests/inventory
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
localhost
|
||||||
|
|
||||||
5
21_myphp/myphp/tests/test.yml
Normal file
5
21_myphp/myphp/tests/test.yml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
remote_user: root
|
||||||
|
roles:
|
||||||
|
- myphp
|
||||||
6
21_myphp/myphp/vars/centos.yml
Normal file
6
21_myphp/myphp/vars/centos.yml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
---
|
||||||
|
# distribution dependent vars file for myphp
|
||||||
|
packages_list:
|
||||||
|
- php-gd
|
||||||
|
- php-pdo
|
||||||
6
21_myphp/myphp/vars/debian.yml
Normal file
6
21_myphp/myphp/vars/debian.yml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
---
|
||||||
|
# distribution dependent vars file for myphp
|
||||||
|
packages_list:
|
||||||
|
- php-gd
|
||||||
|
- php-mysql
|
||||||
2
21_myphp/myphp/vars/main.yml
Normal file
2
21_myphp/myphp/vars/main.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# vars file for myphp
|
||||||
6
21_myphp/myphp/vars/redhat.yml
Normal file
6
21_myphp/myphp/vars/redhat.yml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
---
|
||||||
|
# distribution dependent vars file for myphp
|
||||||
|
packages_list:
|
||||||
|
- php-gd
|
||||||
|
- php-pdo
|
||||||
9
21_myphp/php.yml
Normal file
9
21_myphp/php.yml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
- name: install apache via ansible playbook
|
||||||
|
hosts: test
|
||||||
|
user: formation
|
||||||
|
become: true
|
||||||
|
roles:
|
||||||
|
- myapache4
|
||||||
|
- myphp
|
||||||
|
|
||||||
11
23_prompts/apache.yml
Normal file
11
23_prompts/apache.yml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
- name: install apache via ansible playbook
|
||||||
|
hosts: test
|
||||||
|
user: formation
|
||||||
|
become: true
|
||||||
|
vars_prompt:
|
||||||
|
- name: httpasswd
|
||||||
|
prompt: htpasswd protected area password
|
||||||
|
private: yes
|
||||||
|
roles:
|
||||||
|
- myapache5
|
||||||
45
23_prompts/myapache5/README.md
Normal file
45
23_prompts/myapache5/README.md
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
Role Name
|
||||||
|
=========
|
||||||
|
|
||||||
|
Rôle de deploiement apache sur une centos.
|
||||||
|
|
||||||
|
1 seul vhost
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
|
||||||
|
None
|
||||||
|
|
||||||
|
Role Variables
|
||||||
|
--------------
|
||||||
|
|
||||||
|
http_port: 80
|
||||||
|
servername: orsys.fr
|
||||||
|
serveralias: "www.{{ servername }}"
|
||||||
|
documentroot: /var/www/html/orsys.fr
|
||||||
|
accesslog: /var/log/httpd/access_orsys.fr_log
|
||||||
|
errorlog: /var/log/httpd/error_orsys.fr_log
|
||||||
|
|
||||||
|
Dependencies
|
||||||
|
------------
|
||||||
|
|
||||||
|
None
|
||||||
|
|
||||||
|
Example Playbook
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||||
|
|
||||||
|
- hosts: servers
|
||||||
|
roles:
|
||||||
|
- { myapache }
|
||||||
|
|
||||||
|
License
|
||||||
|
-------
|
||||||
|
|
||||||
|
BSD
|
||||||
|
|
||||||
|
Author Information
|
||||||
|
------------------
|
||||||
|
|
||||||
|
Thomas Constans <thomas@opendoor.fr>
|
||||||
2
23_prompts/myapache5/defaults/main.yml
Normal file
2
23_prompts/myapache5/defaults/main.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# defaults file for myapache
|
||||||
1
23_prompts/myapache5/files/index.html
Normal file
1
23_prompts/myapache5/files/index.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<h1>hello World</h1>
|
||||||
11
23_prompts/myapache5/handlers/main.yml
Normal file
11
23_prompts/myapache5/handlers/main.yml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
# handlers file for myapache
|
||||||
|
- name: reload httpd
|
||||||
|
service:
|
||||||
|
name: "{{ service_name }}"
|
||||||
|
state: reloaded
|
||||||
|
|
||||||
|
- name: reload firewalld
|
||||||
|
service:
|
||||||
|
name: firewalld
|
||||||
|
state: reloaded
|
||||||
57
23_prompts/myapache5/meta/main.yml
Normal file
57
23_prompts/myapache5/meta/main.yml
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
galaxy_info:
|
||||||
|
author: your name
|
||||||
|
description: your description
|
||||||
|
company: your company (optional)
|
||||||
|
|
||||||
|
# If the issue tracker for your role is not on github, uncomment the
|
||||||
|
# next line and provide a value
|
||||||
|
# issue_tracker_url: http://example.com/issue/tracker
|
||||||
|
|
||||||
|
# Some suggested licenses:
|
||||||
|
# - BSD (default)
|
||||||
|
# - MIT
|
||||||
|
# - GPLv2
|
||||||
|
# - GPLv3
|
||||||
|
# - Apache
|
||||||
|
# - CC-BY
|
||||||
|
license: license (GPLv2, CC-BY, etc)
|
||||||
|
|
||||||
|
min_ansible_version: 1.2
|
||||||
|
|
||||||
|
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||||
|
# min_ansible_container_version:
|
||||||
|
|
||||||
|
# Optionally specify the branch Galaxy will use when accessing the GitHub
|
||||||
|
# repo for this role. During role install, if no tags are available,
|
||||||
|
# Galaxy will use this branch. During import Galaxy will access files on
|
||||||
|
# this branch. If Travis integration is configured, only notifications for this
|
||||||
|
# branch will be accepted. Otherwise, in all cases, the repo's default branch
|
||||||
|
# (usually master) will be used.
|
||||||
|
#github_branch:
|
||||||
|
|
||||||
|
#
|
||||||
|
# platforms is a list of platforms, and each platform has a name and a list of versions.
|
||||||
|
#
|
||||||
|
# platforms:
|
||||||
|
# - name: Fedora
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 25
|
||||||
|
# - name: SomePlatform
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 1.0
|
||||||
|
# - 7
|
||||||
|
# - 99.99
|
||||||
|
|
||||||
|
galaxy_tags: []
|
||||||
|
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||||
|
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||||
|
# remove the '[]' above, if you add tags to this list.
|
||||||
|
#
|
||||||
|
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||||
|
# Maximum 20 tags per role.
|
||||||
|
|
||||||
|
dependencies: []
|
||||||
|
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||||
|
# if you add dependencies to this list.
|
||||||
71
23_prompts/myapache5/tasks/main.yml
Normal file
71
23_prompts/myapache5/tasks/main.yml
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
---
|
||||||
|
# tasks file for myapache
|
||||||
|
- name: import distribution specific variables
|
||||||
|
tags: http
|
||||||
|
include_vars: "{{ ansible_distribution|lower }}.yml"
|
||||||
|
|
||||||
|
- name: install apache
|
||||||
|
tags: httpd
|
||||||
|
package:
|
||||||
|
name: "{{ package_name }}"
|
||||||
|
state: latest
|
||||||
|
|
||||||
|
- name: conf httpd
|
||||||
|
tags: httpd
|
||||||
|
notify: reload httpd
|
||||||
|
template:
|
||||||
|
src: vhost.conf.jj
|
||||||
|
dest: "{{ apache_conf_dir }}/vhost.conf"
|
||||||
|
mode: 0640
|
||||||
|
owner: root
|
||||||
|
group: "{{ apache_group }}"
|
||||||
|
|
||||||
|
- name: activate apache
|
||||||
|
tags: httpd
|
||||||
|
service:
|
||||||
|
name: "{{ service_name }}"
|
||||||
|
enabled: yes
|
||||||
|
state: restarted
|
||||||
|
|
||||||
|
- name: open firewall port
|
||||||
|
tags: httpd
|
||||||
|
firewalld:
|
||||||
|
service: http
|
||||||
|
permanent: yes
|
||||||
|
immediate: yes
|
||||||
|
state: enabled
|
||||||
|
ignore_errors: yes
|
||||||
|
notify: reload firewalld
|
||||||
|
when: ansible_distribution|lower != "debian"
|
||||||
|
|
||||||
|
- name: create documentroot
|
||||||
|
tags: httpd
|
||||||
|
file:
|
||||||
|
name: "{{ item.documentroot }}"
|
||||||
|
state: directory
|
||||||
|
with_items:
|
||||||
|
- "{{ apache_vhosts }}"
|
||||||
|
|
||||||
|
- name: install python passlib package
|
||||||
|
tags: req,httpd
|
||||||
|
package:
|
||||||
|
name: python-passlib
|
||||||
|
state: latest
|
||||||
|
|
||||||
|
- name: create index file
|
||||||
|
tags: httpd
|
||||||
|
copy:
|
||||||
|
src: index.html
|
||||||
|
dest: "{{ item.documentroot }}/index.html"
|
||||||
|
mode: 0644
|
||||||
|
with_items:
|
||||||
|
- "{{ apache_vhosts }}"
|
||||||
|
|
||||||
|
- name: passwd file
|
||||||
|
htpasswd:
|
||||||
|
path: "{{ apache_conf_dir }}/passwd"
|
||||||
|
name: tom
|
||||||
|
password: "{{ httpasswd }}"
|
||||||
|
mode: 0640
|
||||||
|
owner: root
|
||||||
|
group: "{{ apache_group }}"
|
||||||
28
23_prompts/myapache5/templates/vhost.conf.jj
Normal file
28
23_prompts/myapache5/templates/vhost.conf.jj
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
{% for vhost in apache_vhosts %}
|
||||||
|
<VirtualHost *:{{ http_port }}>
|
||||||
|
ServerName {{ vhost.servername|lower }}
|
||||||
|
ServerAlias {{ vhost.serveralias }}
|
||||||
|
DocumentRoot {{ vhost.documentroot }}
|
||||||
|
CustomLog {{ vhost.accesslog }} combined
|
||||||
|
ErrorLog {{ vhost.errorlog }}
|
||||||
|
<Directory />
|
||||||
|
Options none
|
||||||
|
Allowoverride none
|
||||||
|
Require all denied
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
<Directory {{ vhost.documentroot }}>
|
||||||
|
Options {{ vhost.documentrootoptions|default( "none" ) }}
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
Alias /private /usr/share/doc
|
||||||
|
<Directory /usr/share/doc>
|
||||||
|
Options indexes
|
||||||
|
AuthName "stop"
|
||||||
|
AuthType Basic
|
||||||
|
AuthUserFile {{ apache_conf_dir }}/passwd
|
||||||
|
require valid-user
|
||||||
|
</Directory>
|
||||||
|
</VirtualHost>
|
||||||
|
{% endfor %}
|
||||||
2
23_prompts/myapache5/tests/inventory
Normal file
2
23_prompts/myapache5/tests/inventory
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
localhost
|
||||||
|
|
||||||
5
23_prompts/myapache5/tests/test.yml
Normal file
5
23_prompts/myapache5/tests/test.yml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
remote_user: root
|
||||||
|
roles:
|
||||||
|
- myapache
|
||||||
1
23_prompts/myapache5/vars/centos.yml
Symbolic link
1
23_prompts/myapache5/vars/centos.yml
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
redhat.yml
|
||||||
7
23_prompts/myapache5/vars/debian.yml
Normal file
7
23_prompts/myapache5/vars/debian.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
apache_conf_dir: /etc/apache2/sites-enabled
|
||||||
|
apache_log_dir: /var/log/apache2
|
||||||
|
package_name: apache2
|
||||||
|
service_name: apache2
|
||||||
|
apache_user: www-data
|
||||||
|
apache_group: www-data
|
||||||
15
23_prompts/myapache5/vars/main.yml
Normal file
15
23_prompts/myapache5/vars/main.yml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
# vars file for myapache
|
||||||
|
http_port: 80
|
||||||
|
apache_vhosts:
|
||||||
|
- servername: ORSYS.Fr
|
||||||
|
serveralias: www.orsys.fr
|
||||||
|
documentroot: /var/www/html/orsys.fr
|
||||||
|
accesslog: "{{ apache_log_dir }}/access_orsys.fr_log"
|
||||||
|
errorlog: "{{ apache_log_dir }}/error_orsys.fr_log"
|
||||||
|
- servername: thomas.fr
|
||||||
|
serveralias: www.thomas.fr
|
||||||
|
documentroot: /var/www/html/thomas.fr
|
||||||
|
accesslog: "{{ apache_log_dir }}/access_thomas.fr_log"
|
||||||
|
errorlog: "{{ apache_log_dir }}/error_thomas.fr_log"
|
||||||
|
documentrootoptions: indexes
|
||||||
7
23_prompts/myapache5/vars/redhat.yml
Normal file
7
23_prompts/myapache5/vars/redhat.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
apache_conf_dir: /etc/httpd/conf.d/
|
||||||
|
apache_log_dir: /var/log/httpd
|
||||||
|
package_name: httpd
|
||||||
|
service_name: httpd
|
||||||
|
apache_user: apache
|
||||||
|
apache_group: apache
|
||||||
7
25_vaults/apache.yml
Normal file
7
25_vaults/apache.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
- name: install apache via ansible playbook
|
||||||
|
hosts: test
|
||||||
|
user: formation
|
||||||
|
become: true
|
||||||
|
roles:
|
||||||
|
- myapache
|
||||||
45
25_vaults/myapache/README.md
Normal file
45
25_vaults/myapache/README.md
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
Role Name
|
||||||
|
=========
|
||||||
|
|
||||||
|
Rôle de deploiement apache sur une centos.
|
||||||
|
|
||||||
|
1 seul vhost
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
|
||||||
|
None
|
||||||
|
|
||||||
|
Role Variables
|
||||||
|
--------------
|
||||||
|
|
||||||
|
http_port: 80
|
||||||
|
servername: orsys.fr
|
||||||
|
serveralias: "www.{{ servername }}"
|
||||||
|
documentroot: /var/www/html/orsys.fr
|
||||||
|
accesslog: /var/log/httpd/access_orsys.fr_log
|
||||||
|
errorlog: /var/log/httpd/error_orsys.fr_log
|
||||||
|
|
||||||
|
Dependencies
|
||||||
|
------------
|
||||||
|
|
||||||
|
None
|
||||||
|
|
||||||
|
Example Playbook
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||||
|
|
||||||
|
- hosts: servers
|
||||||
|
roles:
|
||||||
|
- { myapache }
|
||||||
|
|
||||||
|
License
|
||||||
|
-------
|
||||||
|
|
||||||
|
BSD
|
||||||
|
|
||||||
|
Author Information
|
||||||
|
------------------
|
||||||
|
|
||||||
|
Thomas Constans <thomas@opendoor.fr>
|
||||||
2
25_vaults/myapache/defaults/main.yml
Normal file
2
25_vaults/myapache/defaults/main.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# defaults file for myapache
|
||||||
1
25_vaults/myapache/files/index.html
Normal file
1
25_vaults/myapache/files/index.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<h1>hello World</h1>
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user