---
# tasklist for setting up the mirrormanager package components

- name: set sebooleans so mirrormanager can read its homedir
  action: seboolean name=httpd_enable_homedirs
                    state=true
                    persistent=true

- name: add mirrormanager group - gid {{ mirrormanager_gid }}
  group: name=mirrormanager gid={{ mirrormanager_gid }}

- name: add mirrors group - gid {{ mirrors_gid }}
  group: name=mirrors gid={{ mirrors_gid }}

- name: add mirrors2 group - gid {{ mirrors2_gid }}
  group: name=mirrors2 gid={{ mirrors2_gid }}

- name: add mirrormanager user - uid {{ mirrormanager_uid }}
  user: >
    name=mirrormanager 
    uid={{ mirrormanager_uid }}
    group=mirrormanager 
    groups=mirrors,mirrors2,apache 
    state=present 
    home=/home/mirrormanager 
    createhome=yes 
    shell=/bin/bash

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

- name: install /etc/mirrormanager/prod.cfg
  template: >
    src="mirrormanager-prod.cfg.j2"
    dest="/etc/mirrormanager/prod.cfg"
    owner=mirrormanager
    group=mirrormanager
    mode=0600
  notify:
  - restart httpd
  tags:
  - config

- name: setup mirrormanager directories
  file: path="{{ item }}" owner=mirrormanager group=mirrormanager mode=0755 state=directory
  with_items:
  - /var/lock/mirrormanager
  - /var/lib/mirrormanager
  - /var/run/mirrormanager
  - /var/log/mirrormanager
  - /var/log/mirrormanager/crawler
  - /home/mirrormanager
  tags:
  - config

- name: setup /home/mirrormanager/.ssh directory
  copy: >
    src="{{ puppet_private }}/mirrormanager/"
    dest="/home/mirrormanager/.ssh"
    directory_mode=yes
    owner=mirrormanager
    group=mirrormanager
    mode=0700
  tags:
  - config
