-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathos_refernce.yml
More file actions
80 lines (69 loc) · 2.47 KB
/
os_refernce.yml
File metadata and controls
80 lines (69 loc) · 2.47 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
---
- hosts: slave
become: yes
vars_files:
- ./reference.yml
tasks:
- name: Install in remote ubuntu machine
apt:
name: "{{ item }}"
state: present
update_cache: yes
loop: "{{ package }}"
when: ansible_os_family == "Debian"
- name: create a directory in ubuntu machine
file:
path: "{{debian_dest}}"
state: directory
when: ansible_os_family == "Debian"
- name: create a file in ubuntu machine
file:
path: "{{debian_dest}}/{{new_file}}"
state: touch
when: ansible_os_family == "Debian"
- name: copy file from source to destination in ubuntu machine
copy:
src: "{{src_path}}/{{file_to_copy}}"
dest: "{{debian_dest}}"
when: ansible_os_family == "Debian"
- name: remove package from ubuntu machine
apt:
name: "{{ item }}"
state: absent
loop: "{{ package }}"
when: ansible_os_family == "Debian"
- name: Install in remote centos machine
yum:
name: "{{ item }}"
state: present
loop: "{{ package }}"
when: ansible_os_family == "RedHat"
- name: create a directory in centos machine
file:
path: "{{centos_dest}}"
state: directory
when: ansible_os_family == "RedHat"
- name: create a file in centos machine
file:
path: "{{centos_dest}}/{{new_file}}"
state: touch
when: ansible_os_family == "RedHat"
- name: copy file from source to destination in centos machine
copy:
src: "{{src_path}}/{{file_to_copy}}"
dest: "{{centos_dest}}"
when: ansible_os_family == "RedHat"
- name: remove package in centos machine
yum:
name: "{{ item }}"
state: absent
loop: "{{ package }}"
when: ansible_os_family == "RedHat"
- name: printing the values
debug:
msg: "{{ item }}"
with_items:
- "{{ ansible_distribution }}"
- "{{ ansible_distribution_version }}"
- "{{ ansible_distribution_major_version }}"
- "{{ ansible_os_family }}"