-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathvirtual-nodes.yml
82 lines (77 loc) · 2.33 KB
/
virtual-nodes.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
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
81
82
---
- name: precheck
hosts: localhost
connection: local
gather_facts: false
tasks:
- fail:
msg: The 'group' variable is required
when: group is not defined
- fail:
msg: '"group" value must be in ^[A-Z0-9]+$'
when: group is not regex("^[A-Z0-9]+$")
- name: preflight
hosts: localhost
connection: local
gather_facts: false
pre_tasks:
- setup:
gather_subset: min
roles:
- preflight
- name: VMs
hosts: localhost
connection: local
gather_facts: false
pre_tasks:
- setup:
gather_subset: min
roles:
- virtual_nodes
# Wait cloud-init completion
- name: "Wait for cloud-init completion"
hosts: created_nodes
gather_facts: false
become: true
tasks:
- name: "Wait using cloud-init status --wait"
command: "cloud-init status --wait"
failed_when: false
when:
- method == "create"
- ansible_distribution in ["debian", "ubuntu", "centos"]
# Python 3 not present on Ubuntu
- name: "Wait for Python 3 to be installed"
hosts: created_nodes
gather_facts: false
become: true
tasks:
# - raw: echo "nameserver {{ host_ip }}" > /etc/resolv.conf
- raw: test -e /usr/bin/python3 || (apt -y update && apt install -y python3-minimal)
when:
- method == "create"
- ansible_distribution in ["debian", "ubuntu"]
# - raw: echo "nameserver {{ host_ip }}" > /etc/resolv.conf
# - raw: test -e /usr/bin/python3 || (yum -y update && yum install -y python3)
# when: method == "create" and ansible_distribution|lower == "centos"
# retries: 2
# - name: Populate /etc/resolv.conf file
# hosts: created_nodes
# gather_facts: false
# become: True
# tasks:
# - name: Set {{ host_ip }} as nameserver in resolv.conf
# lineinfile:
# path: "/etc/resolv.conf"
# regexp: '^nameserver .*'
# line: 'nameserver {{ host_ip }}'
# when: method == "create"
# - name: Set search domain in resolv.conf
# lineinfile:
# path: "/etc/resolv.conf"
# regexp: '^search .*'
# #Fix using {{ dns_domain }} from virtual-nodes playbook
# line: 'search mydomain.org'
# when: method == "create" and not ansible_distribution|lower == "fedora"
# line: 'search mydomain.org'
# when: method == "create" and not ansible_distribution|lower == "fedora"