---
# tasklist for setting up the mirrorlist app components
# create mirrormanager user
- name: add mirrormanager user - uid {{ mirrormanager_uid }}
  user: name=mirrormanager uid={{ mirrormanager_uid }} state=present home=/home/mirrormanager createhome=yes

- name: install supervisor and mirrormanager
  yum: pkg={{ item }} state=present
  with_items:
  - supervisor
  - mirrormanager
  tags:
  - packages

# mirrormanager user ssh key(s)
- name: add authorized_keys for mirrormanager
  authorized_key: key="{{ item }}" user=mirrormanager state=present
  with_file:
  - mm-authorized_key

# install mirrorlist-server.conf apache config
- name: mirrorlist-server apache conf
  template: src=mirrorlist-server.conf dest=/etc/httpd/conf.d/mirrorlist-server.conf
  notify:
  - restart apache
  tags:
  - config

# nuke mirrormanager.conf so that it doesn't start up
- name: kill /etc/httpd/conf.d/mirrrormanager.conf
  copy: 'content="#blanked on purpose" dest=/etc/httpd/conf.d/mirrormanager.conf'
  notify:
  - restart apache
  tags:
  - config

# selinux policy - mirrormanager - put in place - for the sockfile
# 

# setup and configure supervisord
- name: /etc/supervisord.conf
  copy: src=supervisord.conf dest=/etc/supervisord.conf mode=0644
  notify:
  - restart supervisord

- name: enable supervisord
  service: name=supervisord state=started enabled=yes

