Skip to content
Snippets Groups Projects
main.yml 1.71 KiB
Newer Older
  • Learn to ignore specific revisions
  • - include: gitinfos.yml
    
      when: run_gitinfos
    
    Smaine Kahlouch's avatar
    Smaine Kahlouch committed
    - name: gather os specific variables
      include_vars: "{{ item }}"
      with_first_found:
        - files:
          - "{{ ansible_distribution|lower }}-{{ ansible_distribution_version|lower|replace('/', '_') }}.yml"
          - "{{ ansible_distribution|lower }}-{{ ansible_distribution_release }}.yml"
          - "{{ ansible_distribution|lower }}-{{ ansible_distribution_major_version|lower|replace('/', '_') }}.yml"
          - "{{ ansible_distribution|lower }}.yml"
          - "{{ ansible_os_family|lower }}.yml"
          - defaults.yml
          paths:
          - ../vars
    
    
    - name: "Identify init system"
      shell: >
    
    ant31's avatar
    ant31 committed
        $(pgrep systemd > /dev/null && systemctl status > /dev/null);
        if [ $? -eq 0 ] ; then
    
        else
          echo sysvinit;
    
        fi
      always_run: True
      register: init_system_output
    
      changed_when: False
    
    - set_fact:
        init_system: "{{ init_system_output.stdout }}"
    
    
    Smaine Kahlouch's avatar
    Smaine Kahlouch committed
    - name: Install python-apt for Debian distribs
      shell: apt-get install -y python-apt
    
      when: ansible_os_family == "Debian"
    
    Smaine Kahlouch's avatar
    Smaine Kahlouch committed
      changed_when: False
    
    - name: Install python-dnf for latest RedHat versions
      shell: dnf install -y python-dnf yum
      when: ansible_distribution == "Fedora" and
            ansible_distribution_major_version > 21
      changed_when: False
    
    Smaine Kahlouch's avatar
    Smaine Kahlouch committed
    - name: Install packages requirements
    
      action:
        module: "{{ ansible_pkg_mgr }}"
        name: "{{ item }}"
        state: latest
    
    Smaine Kahlouch's avatar
    Smaine Kahlouch committed
      with_items: "{{required_pkgs | union(common_required_pkgs)}}"
    
    # Todo : selinux configuration
    - name: Set selinux policy to permissive
      selinux: policy=targeted state=permissive
    
      when: ansible_os_family == "RedHat"
    
    Smaine Kahlouch's avatar
    Smaine Kahlouch committed
      changed_when: False
    
    - include: python-bootstrap.yml
      when: ansible_os_family not in [ "Debian", "RedHat" ]