summaryrefslogtreecommitdiff
path: root/salt/openbook/ansible/files/ansible.yaml
blob: 875a7eb42c7bd4acdd32f4fdc9fb2fe962bb29b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
---
- name: "Install ansible"
  hosts: target
  tasks:
    - name: "Update apt"
      apt:
        update_cache: yes
      when: ansible_distribution == "Ubuntu"

    - name: "Install ansible package"
      apt:
        pkg: "{{ item }}"
        state: present
      with_items:
        - ansible
      when: ansible_distribution == "Ubuntu"

    - name: "Update yum cache"
      yum:
        update_cache: yes
      when: ansible_distribution == "RedHat" or ansible_distribution == "CentOS"

    - name: "Install ansible package"
      yum:
        name: "{{ item }}"
        state: present
      with_items:
        - ansible
      when: ansible_distribution == "RedHat" or ansible_distribution == "CentOS"

    - name: "Install ansible package"
      portage:
        name: "{{ item }}"
        state: present
      with_items:
        - app-admin/ansible
      when: ansible_distribution == "Gentoo"

    - name: "Configure ansible"
      copy:
        src: "../files/{{ item.src }}"
        dest: "{{ item.dest }}"
        mode: "{{ item.mode }}"
        owner: root
        group: root
      with_items:
        - { src: ansible.cfg, dest: /root/ansible/ansible.cfg, mode: "0644" }