|
@@ -40,7 +40,12 @@
|
|
|
public_nic | length < 1 or
|
|
|
iso_file_path | length < 1 or
|
|
|
dhcp_start_ip_range | length < 1 or
|
|
|
- dhcp_end_ip_range | length < 1
|
|
|
+ dhcp_end_ip_range | length < 1 or
|
|
|
+ dhcp_gateway | length < 1 or
|
|
|
+ dhcp_dns1 | length < 1 or
|
|
|
+ dhcp_dns2 | length < 1 or
|
|
|
+ timezone | length < 1 or
|
|
|
+ ansible_config_file_path | length < 1
|
|
|
|
|
|
- name: Save input variables from file
|
|
|
set_fact:
|
|
@@ -49,12 +54,39 @@
|
|
|
nic: "{{ hpc_nic }}"
|
|
|
internet_nic: "{{ public_nic }}"
|
|
|
path_for_iso_file: "{{ iso_file_path }}"
|
|
|
+ dhcp_gateway: "{{ dhcp_gateway | ipv4 }}"
|
|
|
+ dhcp_dns1: "{{ dhcp_dns1 | ipv4 }}"
|
|
|
+ dhcp_dns2: "{{ dhcp_dns2 | ipv4 }}"
|
|
|
dhcp_start_ip: "{{ dhcp_start_ip_range | ipv4 }}"
|
|
|
dhcp_end_ip: "{{ dhcp_end_ip_range | ipv4 }}"
|
|
|
mapping_file: false
|
|
|
path_for_mapping_file: "{{ mapping_file_path }}"
|
|
|
+ ks_timezone: "{{ timezone }}"
|
|
|
+ ansible_conf_file_path: "{{ ansible_config_file_path }}"
|
|
|
no_log: true
|
|
|
|
|
|
+- name: Check whether ansible config file exists
|
|
|
+ stat:
|
|
|
+ path: "{{ ansible_conf_file_path }}/ansible.cfg"
|
|
|
+ register: ansible_conf_exists
|
|
|
+
|
|
|
+- name: Create the directory if it does not exist
|
|
|
+ file:
|
|
|
+ path: "{{ ansible_conf_file_path }}"
|
|
|
+ state: directory
|
|
|
+ mode: "{{ file_perm }}"
|
|
|
+ when: not ansible_conf_exists.stat.exists
|
|
|
+ changed_when: false
|
|
|
+
|
|
|
+- name: Create ansible config file if it does not exist
|
|
|
+ copy:
|
|
|
+ dest: '{{ ansible_conf_file_path }}/ansible.cfg'
|
|
|
+ mode: "{{ file_perm }}"
|
|
|
+ content: |
|
|
|
+ [defaults]
|
|
|
+ log_path = /var/log/omnia.log
|
|
|
+ when: not ansible_conf_exists.stat.exists
|
|
|
+
|
|
|
- name: Get the system hpc ip
|
|
|
shell: "ifconfig {{ hpc_nic }} | grep 'inet' |cut -d: -f2 | awk '{ print $2}'"
|
|
|
register: ip
|
|
@@ -243,6 +275,18 @@
|
|
|
fail_msg: "{{ fail_dhcp_range }}"
|
|
|
register: dhcp_end_ip_check
|
|
|
|
|
|
+- name: Check timezone file
|
|
|
+ command: grep -Fx "{{ ks_timezone }}" {{ role_path }}/files/timezone.txt
|
|
|
+ ignore_errors: yes
|
|
|
+ register: timezone_out
|
|
|
+
|
|
|
+- name: Assert timezone
|
|
|
+ assert:
|
|
|
+ that: ks_timezone in timezone_out.stdout
|
|
|
+ success_msg: "{{ success_timezone }}"
|
|
|
+ fail_msg: "{{ fail_timezone }}"
|
|
|
+ register: timezone_check
|
|
|
+
|
|
|
- name: Create ansible vault key
|
|
|
set_fact:
|
|
|
vault_key: "{{ lookup('password', '/dev/null chars=ascii_letters') }}"
|
|
@@ -334,4 +378,4 @@
|
|
|
command: >-
|
|
|
ansible-vault encrypt {{ role_path }}/../../../{{ config_filename }}
|
|
|
--vault-password-file {{ role_path }}/../../../{{ config_vaultname }}
|
|
|
- changed_when: false
|
|
|
+ changed_when: false
|