Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
apache
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ansible
Roles
apache
Commits
b20d183e
Commit
b20d183e
authored
5 years ago
by
jurgenhaas
Browse files
Options
Downloads
Patches
Plain Diff
ansible-playbooks/general#85 Linting [skip-ci]
parent
2919ab6a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
defaults/main.yml
+5
-3
5 additions, 3 deletions
defaults/main.yml
handlers/main.yml
+27
-25
27 additions, 25 deletions
handlers/main.yml
tasks/apache.yml
+119
-108
119 additions, 108 deletions
tasks/apache.yml
tasks/main.yml
+6
-6
6 additions, 6 deletions
tasks/main.yml
with
157 additions
and
142 deletions
defaults/main.yml
+
5
−
3
View file @
b20d183e
---
apache_repositories
:
[]
apache_packages
:
-
apache2
...
...
@@ -26,12 +28,12 @@ apache_server_default_aliases: []
apache_server_default_aliases_redirect
:
[]
apache_server_defs
:
[]
apache_server_default_root
:
/html
apache_server_default_svn_source
:
false
apache_server_default_svn_source
:
no
apache_server_default_svn_target
:
live
apache_certificates
:
[]
apache_auth
:
false
apache_auth
:
no
apache_cache
:
active
:
true
active
:
no
default
:
A14400
bytype
:
-
type
:
text/html
...
...
This diff is collapsed.
Click to expand it.
handlers/main.yml
+
27
−
25
View file @
b20d183e
---
# file: roles/apache/handlers/main.yml
-
name
:
Apache |
Restart Apache
-
name
:
Restart Apache
service
:
name
=
apache2
state
=
restarted
name
:
apache2
state
:
restarted
-
name
:
Apache |
Checkout htdocs for default
-
name
:
Checkout htdocs for default
subversion
:
repo
=
{{ apache_server_default_svn_source }}
dest
=
/var/www/{{ apache_server_default_svn_target }}
repo
:
'
{{
apache_server_default_svn_source
}}
'
dest
:
/var/www/{{ apache_server_default_svn_target }}
become
:
no
notify
:
Apache | Change ownership for web server files
notify
:
-
Change ownership for web server files
async
:
3000
poll
:
0
when
:
apache_server_default_svn_source !=
false
-
name
:
Apache |
Checkout htdocs for our site(s)
-
name
:
Checkout htdocs for our site(s)
subversion
:
repo
=
{{ item.svn_source }}
dest
=
/var/www/{{ item.svn_target }}
repo
:
'
{{
item.svn_source
}}
'
dest
:
/var/www/{{ item.svn_target }}
become
:
no
with_items
:
'
{{
apache_server_defs
}}'
notify
:
Apache | Change ownership for web server files
notify
:
-
Change ownership for web server files
async
:
3000
poll
:
0
-
name
:
Apache |
Change ownership for web server files
-
name
:
Change ownership for web server files
file
:
path
="
/var/www
"
owner
="
www-data
"
group
="
www-data
"
recurse
=
yes
follow
=
no
path
:
/var/www
owner
:
www-data
group
:
www-data
recurse
:
yes
follow
:
no
-
name
:
Apache |
Change mode for web server files
-
name
:
Change mode for web server files
file
:
path
=
/var/www
mode
=
g+w
recurse
=
yes
follow
=
no
path
:
/var/www
mode
:
g+w
recurse
:
yes
follow
:
no
-
name
:
Apache |
Change mode for web server root dir
-
name
:
Change mode for web server root dir
file
:
path
=
/var/www
mode
='
755
'
path
:
/var/www
mode
:
0
755
This diff is collapsed.
Click to expand it.
tasks/apache.yml
+
119
−
108
View file @
b20d183e
---
# file: roles/apache/tasks/apache.yml
-
name
:
Apache |
Apt Repository
-
name
:
Apt Repository
apt_repository
:
repo
=
'{{ item }}'
state
='
present
'
mode
='
644
'
repo
:
'
{{
item
}}'
state
:
present
mode
:
0
644
with_items
:
'
{{
apache_repositories
}}'
-
name
:
Apache |
Install required packages.
-
name
:
Install required packages.
apt
:
pkg='{{ apache_packages }}'
state=present
force=yes
notify
:
"
Apache
|
Restart
Apache"
pkg
:
'
{{
apache_packages
}}'
state
:
present
force
:
yes
notify
:
-
Restart Apache
-
name
:
Apache |
Enable some required modules
-
name
:
Enable some required modules
apache2_module
:
name
=
'{{ item }}'
state
=
present
name
:
'
{{
item
}}'
state
:
present
with_items
:
'
{{
apache_modules
}}'
notify
:
"
Apache
|
Restart
Apache"
notify
:
-
Restart Apache
-
name
:
Apache |
Turn on Extended Status
-
name
:
Turn on Extended Status
lineinfile
:
dest=/etc/apache2/apache2.conf
regexp='^ExtendedStatus '
line='ExtendedStatus On'
notify
:
"
Apache
|
Restart
Apache"
dest
:
/etc/apache2/apache2.conf
regexp
:
'
^ExtendedStatus
'
line
:
ExtendedStatus On
notify
:
-
Restart Apache
-
name
:
Apache |
Turn on SendFile
-
name
:
Turn on SendFile
lineinfile
:
dest=/etc/apache2/apache2.conf
regexp='^EnableSendfile '
line='EnableSendfile On'
notify
:
"
Apache
|
Restart
Apache"
dest
:
/etc/apache2/apache2.conf
regexp
:
'
^EnableSendfile
'
line
:
EnableSendfile On
notify
:
-
Restart Apache
-
name
:
Apache |
Configure Security, Global Redirect, Global Deny, Logging
-
name
:
Configure Security, Global Redirect, Global Deny, Logging
template
:
src
='
etc-apache2-conf-available-{{item }}
'
dest
='
/etc/apache2/{{ apache_conf_dir }}/{{ item }}.conf
'
owner
='
root
'
group
='
root
'
mode
='
644
'
src
:
etc-apache2-conf-available-{{item }}
dest
:
/etc/apache2/{{ apache_conf_dir }}/{{ item }}.conf
owner
:
root
group
:
root
mode
:
0
644
with_items
:
-
security
-
global-redirect
...
...
@@ -51,11 +55,11 @@
-
redirect-ssl
-
other-vhosts-access-log
notify
:
-
"
Apache
|
Restart
Apache"
-
"
Restart
Apache"
tags
:
-
ApacheConfig
-
name
:
Apache |
Write SSL Apache Options
-
name
:
Write SSL Apache Options
template
:
src
:
options-ssl-apache.conf
dest
:
/etc/apache2/{{ apache_conf_dir }}/options-ssl-apache.conf
...
...
@@ -63,128 +67,135 @@
group
:
root
mode
:
0644
-
name
:
Apache |
Install SSL certificates
-
name
:
Install SSL certificates
copy
:
src
=
{{inventory_dir}}/files/ssl/{{item.1.file}}
dest
=
/etc/ssl/private
src
:
'
{{inventory_dir}}/files/ssl/{{item.1.file}}
'
dest
:
/etc/ssl/private
with_subelements
:
-
{{
apache_certificates
}}
-
certs
notify
:
"
Apache
|
Restart
Apache"
notify
:
-
Restart Apache
-
name
:
Apache |
Create htdocs directory for default
-
name
:
Create htdocs directory for default
file
:
dest
=
/var/www{{ apache_server_default_root }}
state
=
directory
owner
=
www-data
group
=
www-data
dest
:
/var/www{{ apache_server_default_root }}
state
:
directory
owner
:
www-data
group
:
www-data
-
name
:
Apache |
Create htdocs directory for SVN default
-
name
:
Create htdocs directory for SVN default
file
:
dest
=
/var/www/{{ apache_server_default_svn_target }}
state
=
directory
owner
=
www-data
group
=
www-data
dest
:
/var/www/{{ apache_server_default_svn_target }}
state
:
directory
owner
:
www-data
group
:
www-data
-
name
:
Apache |
Create htdocs directory for our site(s)
-
name
:
Create htdocs directory for our site(s)
file
:
dest
=
/var/www/{{ item.svn_target }}
state
=
directory
owner
=
www-data
group
=
www-data
dest
:
/var/www/{{ item.svn_target }}
state
:
directory
owner
:
www-data
group
:
www-data
with_items
:
'
{{
apache_server_defs
}}'
-
name
:
Apache |
Configuration file for default site
-
name
:
Configuration file for default site
template
:
src
=
etc-apache2-sites-available-default
dest
=
/etc/apache2/sites-available/{{ apache_conf_default_prefix }}default{{ apache_conf_ext }}
owner
=
root
group
=
root
mode
='
644
'
src
:
etc-apache2-sites-available-default
dest
:
/etc/apache2/sites-available/{{ apache_conf_default_prefix }}default{{ apache_conf_ext }}
owner
:
root
group
:
root
mode
:
0
644
when
:
apache_server_default == "yes"
notify
:
-
"
Apache
|
Restart
Apache"
-
"
Apache
|
Checkout
htdocs
for
default"
-
"
Restart
Apache"
-
"
Checkout
htdocs
for
default"
-
name
:
Apache |
Configuration file for default ssl site
-
name
:
Configuration file for default ssl site
template
:
src
=
etc-apache2-sites-available-default-ssl
dest
=
/etc/apache2/sites-available/{{ apache_conf_default_prefix }}default-ssl{{ apache_conf_ext }}
owner
=
root
group
=
root
mode
='
644
'
src
:
etc-apache2-sites-available-default-ssl
dest
:
/etc/apache2/sites-available/{{ apache_conf_default_prefix }}default-ssl{{ apache_conf_ext }}
owner
:
root
group
:
root
mode
:
0
644
when
:
apache_server_default_ssl == "yes"
notify
:
-
"
Apache
|
Restart
Apache"
-
"
Apache
|
Checkout
htdocs
for
default"
-
"
Restart
Apache"
-
"
Checkout
htdocs
for
default"
-
name
:
Apache |
Configuration file for our site(s)
-
name
:
Configuration file for our site(s)
template
:
src
=
etc-apache2-sites-available-vhost
dest
=
/etc/apache2/sites-available/{{ item.vhost }}{{ apache_conf_ext }}
owner
=
root
group
=
root
mode
='
644
'
src
:
etc-apache2-sites-available-vhost
dest
:
/etc/apache2/sites-available/{{ item.vhost }}{{ apache_conf_ext }}
owner
:
root
group
:
root
mode
:
0
644
with_items
:
'
{{
apache_server_defs
}}'
notify
:
-
"
Apache
|
Restart
Apache"
-
"
Apache
|
Checkout
htdocs
for
our
site(s)"
-
"
Restart
Apache"
-
"
Checkout
htdocs
for
our
site(s)"
-
name
:
Apache |
Disable the default site
-
name
:
Disable the default site
command
:
a2dissite {{ item }}
with_items
:
-
default
-
{{
apache_conf_default_prefix
}}
default
ignore_errors
:
true
-
'
{{
apache_conf_default_prefix
}}default
'
ignore_errors
:
yes
when
:
apache_server_default == "no"
-
name
:
Apache |
Disable the default ssl site
-
name
:
Disable the default ssl site
command
:
a2dissite {{ item }}
with_items
:
-
default-ssl
-
{{
apache_conf_default_prefix
}}
default-ssl
ignore_errors
:
true
-
'
{{
apache_conf_default_prefix
}}default-ssl
'
ignore_errors
:
yes
when
:
apache_server_default_ssl == "no"
-
name
:
Apache | Enable the default site
command
:
a2ensite {{ apache_conf_default_prefix }}default creates=/etc/apache2/sites-enabled/{{ apache_conf_default_prefix }}default{{ apache_conf_ext }}
-
name
:
Enable the default site
command
:
a2ensite {{ apache_conf_default_prefix }}default
args
:
creates
:
/etc/apache2/sites-enabled/{{ apache_conf_default_prefix }}default{{ apache_conf_ext }}
when
:
apache_server_default == "yes"
-
name
:
Apache | Enable the default ssl site
command
:
a2ensite {{ apache_conf_default_prefix }}default-ssl creates=/etc/apache2/sites-enabled/{{ apache_conf_default_prefix }}default-ssl{{ apache_conf_ext }}
-
name
:
Enable the default ssl site
command
:
a2ensite {{ apache_conf_default_prefix }}default-ssl
args
:
creates
:
/etc/apache2/sites-enabled/{{ apache_conf_default_prefix }}default-ssl{{ apache_conf_ext }}
when
:
apache_server_default_ssl == "yes"
-
name
:
Apache | Enable our new site(s)
command
:
a2ensite {{ item.vhost }} creates=/etc/apache2/sites-enabled/{{ item.vhost }}{{ apache_conf_ext }}
-
name
:
Enable our new site(s)
command
:
a2ensite {{ item.vhost }}
args
:
creates
:
/etc/apache2/sites-enabled/{{ item.vhost }}{{ apache_conf_ext }}
with_items
:
'
{{
apache_server_defs
}}'
-
name
:
Apache |
Create passwords directory for AuthType Basic
-
name
:
Create passwords directory for AuthType Basic
file
:
dest
=
/var/www/passwords
state
=
directory
owner
=
www-data
group
=
www-data
dest
:
/var/www/passwords
state
:
directory
owner
:
www-data
group
:
www-data
-
name
:
Apache |
Setup AuthType Basic
-
name
:
Setup AuthType Basic
htpasswd
:
path
="
/var/www/passwords/{{ apache_auth.user }}
"
name
="
{{ apache_auth.user }}
"
password
="
{{ apache_auth.password }}
"
owner
=
www-data
group
=
www-data
mode
='
640
'
path
:
/var/www/passwords/{{ apache_auth.user }}
name
:
'
{{
apache_auth.user
}}
'
password
:
'
{{
apache_auth.password
}}
'
owner
:
www-data
group
:
www-data
mode
:
0
640
when
:
apache_auth
-
name
:
Apache |
Create default content directory
-
name
:
Create default content directory
file
:
dest
=
/var/www/html
state
=
directory
owner
=
www-data
group
=
www-data
dest
:
/var/www/html
state
:
directory
owner
:
www-data
group
:
www-data
-
name
:
Apache |
Copy default HTML site
-
name
:
Copy default HTML site
template
:
src
=
index.html
dest
=
/var/www/html/index.html
owner
=
www-data
group
=
www-data
src
:
index.html
dest
:
/var/www/html/index.html
owner
:
www-data
group
:
www-data
This diff is collapsed.
Click to expand it.
tasks/main.yml
+
6
−
6
View file @
b20d183e
...
...
@@ -13,12 +13,12 @@
-
block
:
-
import_tasks
:
apache.yml
-
import_tasks
:
apache.yml
-
name
:
Remember that this role had been run
set_fact
:
role_apache_completed
:
yes
tags
:
-
always
-
name
:
Remember that this role had been run
set_fact
:
role_apache_completed
:
yes
tags
:
-
always
when
:
not excluded_roles or "apache" not in excluded_roles and role_apache_completed is not defined
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment