---
# Based on http://docs.ceph.com/docs/master/start/quick-start-preflight/

- hosts:
  - storage1
  - storage2
  - storage3
  remote_user: root 
  vars:
    ceph_release: hammer
    distro: el7  
  tasks: 

  - name: Ceph Dependencies and ceph-deploy
    yum: name={{ item }} state=latest
         update_cache=yes
    with_items: 
    - ntp 
    - ntpdate
    - ntp-doc

  - name: Make wheel group passwordless sudoers
    lineinfile: "dest=/etc/sudoers state=present regexp='^%wheel' line='%wheel ALL=(ALL) NOPASSWD: ALL' validate='visudo -cf %s'"
  - name: Fix requiretty issue in sudoers
    lineinfile: "dest=/etc/sudoers state=present regexp='^Defaults.*requiretty' line='Defaults:ceph !requiretty' validate='visudo -cf %s'"

  - name: Add ceph user
    user: name=ceph groups=wheel append=yes

  - name: Add authorized key
    authorized_key: 
      user=ceph 
      key="{{ lookup('file', '/tmp/controller_id_rsa.pub') }}"

  - name: Disable SELinux
    selinux: state=disabled



