Skip to content
Snippets Groups Projects
Verified Commit 36212039 authored by Giancarlo Razzolini's avatar Giancarlo Razzolini
Browse files

roles/memcached: Initial work on the memcached role.

roles/archweb: Make archweb install and use it's own memcached service, running as the archweb user and using a socket.
parent 51481387
No related branches found
No related tags found
No related merge requests found
[Unit]
Description=Archweb Memcached Daemon
After=network.target
[Service]
User=archweb
Group=memcached
# Remove '-l 127.0.0.1' to listen on all addresses
ExecStart=/usr/bin/memcached -s /run/memcached/archweb.sock -o modern
Restart=always
PrivateTmp=yes
PrivateDevices=yes
ProtectSystem=full
MemoryDenyWriteExecute=yes
[Install]
WantedBy=multi-user.target
---
- name: install git
pacman: name=git,memcached,python2,python2-virtualenv,uwsgi-plugin-python2 state=present
pacman: name=git,python2,python2-virtualenv,uwsgi-plugin-python2 state=present
- name: make archweb user
user: name=archweb shell=/bin/false home="{{ archweb_dir }}" createhome=no groups=uwsgi
......@@ -48,11 +48,22 @@
- daemon reload
when: services
- name: copy archweb memcached service
copy: src="archweb-memcached.service" dest="/etc/systemd/system/archweb-memcached.service" owner=root group=root mode=0644
notify:
- daemon reload
when: not services
- name: configure archweb
template: src=local_settings.py.j2 dest=/srv/http/archweb/local_settings.py owner=archweb group=archweb mode=0660
- name: deploy archweb
template: src=archweb.ini.j2 dest=/etc/uwsgi/vassals/archweb.ini owner=archweb group=http mode=0644
when: not services
- name: start and enable archweb memcached service
service: name="archweb-memcached.service" enabled=yes state=started
when: not services
- name: start and enable archweb services
service: name="{{ item }}" enabled=yes state=started
......
......@@ -26,7 +26,7 @@ DATABASES = {
CACHES = {
'default': {
'BACKEND' : 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': '127.0.0.1:11211',
'LOCATION': 'unix:/run/memcached/archweb.sock',
}
}
......
---
- name: install memcached
pacman: name=memcached state=present
- name: put memcached.conf into tmpfiles
template: src=memcached-tmpfiles.d.j2 dest=/etc/tmpfiles.d/memcached.conf owner=root group=root mode=0644
register: memcachedtmpfiles
- name: use tmpfiles.d/memcached.conf
command: systemd-tmpfiles --create
when: memcachedtmpfiles.changed
d /run/memcached 0775 memcached memcached - -
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment