- name: setup for centos
  hosts: all
  gather_facts: true
  become: true

  tasks:
    - name: httpd install
      yum:
        name: httpd
        state: present
      when: ansible_distribution == 'CentOS'
      register: result
    
    - debug:
        var: result
      when: ansible_distribution == 'CentOS'

    - name: httpd restart
      service:
        name: httpd
        state: started
        enabled: true
      when: ansible_distribution == 'CentOS'
      register: result
      
    - debug:
        var: result
      when: ansible_distribution == 'CentOS'