-
Notifications
You must be signed in to change notification settings - Fork 3
/
playbook.yml
48 lines (44 loc) · 1.09 KB
/
playbook.yml
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
---
- hosts: all
become: true
vars:
- pri_domain_name: 'test.vagrant.local'
roles:
tasks:
- name: pre-reqs
dnf:
name: "{{ item }}"
state: present
with_items:
- libselinux-python
when: >
(ansible_os_family == "RedHat" and
ansible_distribution == "Fedora")
- name: pre-reqs
yum:
name: "{{ item }}"
state: present
with_items:
- libselinux-python
when: >
(ansible_os_family == "RedHat" and
ansible_distribution != "Fedora")
- name: updating /etc/hosts
lineinfile:
dest: /etc/hosts
regexp: "^{{ hostvars[item].ansible_ssh_host }} {{ item }} {{ item }}.{{ pri_domain_name }}"
line: "{{ hostvars[item].ansible_ssh_host }} {{ item }} {{ item }}.{{ pri_domain_name }}"
state: present
with_items: groups['all']
- hosts: test-nodes
become: true
vars:
- pri_domain_name: 'test.vagrant.local'
roles:
tasks:
- hosts: prod-nodes
become: true
vars:
- pri_domain_name: 'prod.vagrant.local'
roles:
tasks: