|
@@ -55,7 +55,8 @@
|
|
|
when:
|
|
|
- mariadb_password | length < 1 or
|
|
|
k8s_cni | length < 1 or
|
|
|
- k8s_pod_network_cidr | length < 1
|
|
|
+ k8s_pod_network_cidr | length < 1 or
|
|
|
+ ansible_config_file_path | length < 1
|
|
|
|
|
|
- name: Assert mariadb_password
|
|
|
assert:
|
|
@@ -88,8 +89,37 @@
|
|
|
db_password: "{{ mariadb_password }}"
|
|
|
k8s_cni: "{{ k8s_cni }}"
|
|
|
k8s_pod_network_cidr: "{{ k8s_pod_network_cidr }}"
|
|
|
+ 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: ansible_conf_exists.stat.exists == 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: ansible_conf_exists.stat.exists == false
|
|
|
+
|
|
|
+- name: Set omnia.log file
|
|
|
+ replace:
|
|
|
+ path: "{{ ansible_conf_file_path }}/ansible.cfg"
|
|
|
+ regexp: '#log_path = /var/log/ansible.log'
|
|
|
+ replace: 'log_path = /var/log/omnia.log'
|
|
|
+ when: ansible_conf_exists.stat.exists == true
|
|
|
+
|
|
|
- name: Encrypt input config file
|
|
|
command: >-
|
|
|
ansible-vault encrypt {{ role_path }}/../../{{ config_filename }}
|