12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- ---
- - name: Install the systemd units
- import_tasks: systemd_units.yml
- - name: Install Node system container
- import_tasks: node_system_container.yml
- when:
- - l_is_node_system_container | bool
- - file:
- dest: "{{ l2_openshift_node_kubelet_args['config'] }}"
- state: directory
- when: ('config' in l2_openshift_node_kubelet_args) | bool
- # TODO: add the validate parameter when there is a validation command to run
- - name: Create the Node config
- template:
- dest: "{{ openshift.common.config_base }}/node/node-config.yaml"
- src: node.yaml.v1.j2
- backup: true
- owner: root
- group: root
- mode: 0600
- notify:
- - restart node
- - name: Configure Node Environment Variables
- lineinfile:
- dest: /etc/sysconfig/{{ openshift_service_type }}-node
- regexp: "^{{ item.key }}="
- line: "{{ item.key }}={{ item.value }}"
- create: true
- with_dict: "{{ openshift_node_env_vars }}"
- notify:
- - restart node
- - name: Ensure the node static pod directory exists
- file:
- path: "{{ openshift.common.config_base }}/node/pods"
- state: directory
- mode: 0755
- - name: include aws provider credentials
- import_tasks: aws.yml
- when: not (openshift_node_use_instance_profiles | default(False))
- # Necessary because when you're on a node that's also a master the master will be
- # restarted after the node restarts docker and it will take up to 60 seconds for
- # systemd to start the master again
- - when:
- - openshift_is_containerized | bool
- - not openshift_node_bootstrap
- block:
- - name: Wait for master API to become available before proceeding
- # Using curl here since the uri module requires python-httplib2 and
- # wait_for port doesn't provide health information.
- command: >
- curl --silent --tlsv1.2 --cacert {{ openshift.common.config_base }}/node/ca.crt
- {{ openshift_node_master_api_url }}/healthz/ready
- args:
- # Disables the following warning:
- # Consider using get_url or uri module rather than running curl
- warn: no
- register: api_available_output
- until: api_available_output.stdout == 'ok'
- retries: 120
- delay: 1
- changed_when: false
- - when: not openshift_node_bootstrap
- block:
- - name: Start and enable node
- systemd:
- name: "{{ openshift_service_type }}-node"
- enabled: yes
- state: started
- daemon_reload: yes
- register: node_start_result
- until: not node_start_result is failed
- retries: 1
- delay: 30
- ignore_errors: true
- - name: Dump logs from node service if it failed
- command: journalctl --no-pager -n 100 -u {{ openshift_service_type }}-node
- when: node_start_result is failed
- - name: Abort if node failed to start
- fail:
- msg: Node failed to start please inspect the logs and try again
- when: node_start_result is failed
- - set_fact:
- node_service_status_changed: "{{ node_start_result is changed }}"
|