---
# tasklist for setting up bodhi/masher (requires bodhi/base)
# This is the base set of files needed for bodhi/masher

- name: install needed packages
  yum: pkg={{ item }} state=present
  with_items:
  - python-fedora-turbogears
  tags:
  - packages

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

- name: install bodhi-masher /etc/httpd/conf.d/bodhi.conf file
  copy: >
    src="bodhi-masher.conf"
    dest="/etc/httpd/conf.d/bodhi.conf"
    owner=root
    group=root
    mode=0644
  notify:
  - restart httpd
  tags:
  - config

- name: change owner and group attributes of bodhi.pem file
  file: >
    path="/etc/pki/bodhi/bodhi.pem"
    owner=masher
    group=masher
  tags:
  - config

- name: change owner and group attributes of /var/log/bodhi directory
  file: path=/var/log/bodhi owner=masher group=masher
  tags:
  - config
  
- name: setup /etc/bodhi/mash.conf file...
  template: >
    src=mash.conf
    dest=/etc/bodhi/mash.conf
    owner=masher
    group=masher
    mode=0640
  tags:
  - config

- name: change type part of SELinux file context
  file: path="/home/masher/.cvspass" setype=httpd_sys_script_rw_t state=file
  tags:
  - config

- name: change type part of SELinux file context
  file: path="/var/tmp/bodhi/comps/" setype=httpd_sys_script_rw_t state=directory recurse=yes
  tags:
  - config

- name: change owner attribute of /var/tmp/bodhi-bz.cookie file
  file: >
    path=/var/tmp/bodhi-bz.cookie 
    owner=masher 
  tags:
  - config

- name: install /etc/bodhi/*.mash files
  copy: >
    src="{{ item }}"
    dest="/etc/bodhi/{{ item }}"
    owner=masher
    mode=0640
  with_items:
  - f13-updates.mash
  - f14-updates.mash
  - f14-updates-testing.mash
  - f15-updates.mash
  - f15-updates-testing.mash
  - f16-updates.mash
  - f16-updates-testing.mash
  - f17-updates.mash
  - f17-updates-testing.mash
  - f18-updates.mash
  - f18-updates-testing.mash
  - f19-updates.mash
  - f19-updates-testing.mash
  - f20-updates.mash
  - f20-updates-testing.mash
  - el6-epel.mash
  - el6-epel-testing.mash
  tags:
  - config

# tasks for setting up epelmasher

- name: install needed packages
  yum: pkg={{ item }} state=present
  with_items:
  - repoview
  when: epelmasher
  tags:
  - packages

- name: install bodhi-epel-masher /etc/bodhi/bodhi.cfg file
  template: >
    src="bodhi-epel-masher.cfg.j2" 
    dest="/etc/bodhi/bodhi.cfg" 
    owner=masher 
    group=masher 
    mode=0600
  when: epelmasher
  notify:
  - restart httpd
  tags:
  - config

# tasklist for setting up jobrunner

- name: install bodhi-masher-jobrunner /etc/bodhi/bodhi.cfg file
  template: >
    src="bodhi-masher-jobrunner.cfg.j2" 
    dest="/etc/bodhi/bodhi.cfg" 
    owner=masher 
    group=masher 
    mode=0600
  when: jobrunner
  notify:
  - restart httpd
  tags:
  - config
