---
- name: Start mysql
  service: name=mysql state=started
- name: Create mysql.sock for cpanel
  file:
    src: /var/lib/mysql/mysql.sock
    dest: /tmp/mysql.sock
    state: link
- name: Set hostname
  shell: "/usr/local/cpanel/bin/set_hostname {{ hostname }}"
- name: Create accesshash
  environment:
    REMOTE_USER: root
  command: /usr/local/cpanel/bin/mkaccesshash
- name: Prepare hash to be sent to keyserv
  shell: cat /root/.accesshash
  register: hash
- name: Validate cpanel license
  command: /usr/local/cpanel/cpkeyclt
- name: Set correct wwwacct.conf
  template:
    src: templates/wwwacct.j2
    dest: /etc/wwwacct.conf
- name: configure /etc/hosts
  template:
    src: templates/hosts.j2
    dest: /etc/hosts
- name: configure getaddrinfo
  template:
    src: templates/gai.conf.j2
    dest: /etc/gai.conf
- name: install brand repo
  yum: name=UL_{{ brand }}_repo state=latest
- name: install cpanel_addon_WPC
  shell: 'yum clean all; yum --disablerepo=ul --disableexcludes=all -y install cpanel_addon_WPC'
- name: install brand extras
  yum: name=cpanel_{{ brand }}_extras disablerepo=ul state=latest
- name: install brand theme
  yum: name=cpanel_{{ brand }}_theme
- name: whitelist hal
  command: /scripts/cphulkdwhitelist {{ item }}
  with_items:
    - 10.2.0.0/24
    - 10.102.120.0/24
    - 69.195.127.5
