-
Notifications
You must be signed in to change notification settings - Fork 4
/
test_get_facts.yml
66 lines (58 loc) · 1.96 KB
/
test_get_facts.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
---
- hosts: localhost
gather_facts: False
tasks:
- name: Generate var file to landing extra vars
copy:
content: "{{ ocpconfig | to_nice_yaml }}"
dest: "current_ocpconfig.yml"
- name: Loading current ocpconfig var file
include_vars: current_ocpconfig.yml
- name: Prepare helper vars-static var file
template:
src: vars-static.j2
dest: "{{ playbook_dir }}/vars-static.yml"
mode: 0644
force: yes
#- name: Create VM for bastion host
# import_role:
# name: bastion
# tasks_from: create_vm_bastion
- name: Add host to group [bastion]
add_host:
name: "{{ helper_vm.public_ip }}"
groups: bastion
ansible_ssh_user: "root"
ansible_ssh_pass: "{{ helper_vm.rootpassword }}"
host_key_checking: False
ansible_ssh_common_args: '-o StrictHostKeyChecking=no'
- name: Add host to group [webservers]
add_host:
name: "{{ helper_vm.public_ip }}"
groups: webservers
ansible_ssh_user: "root"
ansible_ssh_pass: "{{ helper_vm.rootpassword }}"
host_key_checking: False
ansible_ssh_common_args: '-o StrictHostKeyChecking=no'
- hosts: bastion
gather_facts: True
vars_files:
- roles/helper/vars/main.yml
environment:
PATH: "{{ ocpconfig.helper_vm.workdir }}/bin:{{ ansible_env.PATH }}"
GOVC_USERNAME: "{{ ocpconfig.vcenter.admin_username }}"
GOVC_PASSWORD: "{{ ocpconfig.vcenter.admin_password }}"
GOVC_URL: "https://{{ ocpconfig.vcenter.ip }}"
GOVC_INSECURE: 1
tasks:
- name: Loading current ocpconfig var file to bastion node
include_vars: current_ocpconfig.yml
- name: include vars-static
include_vars: vars-static.yml
- name: debug facts
debug: var=ansible_default_ipv4.interface
- name: debug facts
debug: var=helper.networkifacename
- name: Set the cache of all the download links
include_role:
name: cache