- name: Ensure /usr/local/etc/rc.d/ exists file: path: /usr/local/etc/rc.d/ state: directory owner: root group: wheel mode: "0755" - name: Add zpool_gpt_labels rc.d service template: src: usr_local_etc_rc.d_zpool_gpt_labels.j2 dest: /usr/local/etc/rc.d/zpool_gpt_labels owner: root group: wheel mode: "0755" register: rc_zpool_gpt_labels - name: Run zpool_gpt_labels service: name: zpool_gpt_labels state: started when: rc_zpool_gpt_labels.changed - name: Install smartd package: name: smartmontools state: present - name: Configure smartd.conf template: src: usr_local_etc_smartd.conf.j2 dest: /usr/local/etc/smartd.conf owner: root group: wheel mode: "0644" register: smartd_conf - name: Start smartd service: name: smartd state: started register: started_smartd - name: Restart smartd service: name: smartd state: restarted when: not started_smartd.changed and smartd_conf.changed