|
9 | 9 | # The atomic-openshift-node service will set this parameter on
|
10 | 10 | # startup, but if the network service is restarted this setting is
|
11 | 11 | # lost. Reference: https://bugzilla.redhat.com/show_bug.cgi?id=1372388
|
12 |
| -- sysctl: |
| 12 | +- name: Enable IP Forwarding |
| 13 | + sysctl: |
13 | 14 | name: net.ipv4.ip_forward
|
14 | 15 | value: 1
|
15 | 16 | sysctl_file: "/etc/sysctl.d/99-openshift.conf"
|
|
21 | 22 | state: yes
|
22 | 23 | persistent: yes
|
23 | 24 |
|
24 |
| -- name: create temp directory |
| 25 | +- name: Create temp directory |
25 | 26 | tempfile:
|
26 | 27 | state: directory
|
27 |
| - register: tempfile |
| 28 | + register: temp_dir |
28 | 29 |
|
29 | 30 | - name: Wait for bootstrap endpoint to show up
|
30 | 31 | uri:
|
|
40 | 41 | - name: Fetch bootstrap ignition file locally
|
41 | 42 | uri:
|
42 | 43 | url: "{{ openshift_node_bootstrap_endpoint }}"
|
43 |
| - dest: "{{ tempfile.path }}/bootstrap.ign" |
| 44 | + dest: "{{ temp_dir.path }}/bootstrap.ign" |
44 | 45 | validate_certs: false
|
45 | 46 |
|
46 |
| -- name: Copy pull secret in the directory |
| 47 | +- name: Get cluster pull-secret |
| 48 | + command: > |
| 49 | + oc get secret pull-secret |
| 50 | + --config={{ openshift_node_kubeconfig_path }} |
| 51 | + --namespace=openshift-config |
| 52 | + --output=jsonpath='{.data.\.dockerconfigjson}' |
| 53 | + delegate_to: localhost |
| 54 | + register: oc_get |
| 55 | + until: |
| 56 | + - oc_get.stdout != '' |
| 57 | + retries: 36 |
| 58 | + delay: 5 |
| 59 | + |
| 60 | +- name: Write pull-secret to file |
47 | 61 | copy:
|
48 |
| - src: "{{ openshift_pull_secret_path }}" |
49 |
| - dest: "{{ tempfile.path }}/pull-secret.json" |
| 62 | + content: "{{ oc_get.stdout | b64decode }}" |
| 63 | + dest: "{{ temp_dir.path }}/pull-secret.json" |
50 | 64 |
|
51 |
| -- name: Get release image |
| 65 | +- name: Get cluster release image |
52 | 66 | command: >
|
53 | 67 | oc get clusterversion
|
54 | 68 | --config={{ openshift_node_kubeconfig_path }}
|
|
60 | 74 | retries: 36
|
61 | 75 | delay: 5
|
62 | 76 |
|
63 |
| -- name: Set openshift_release_image fact |
| 77 | +- name: Set l_release_image fact |
64 | 78 | set_fact:
|
65 |
| - openshift_release_image: "{{ oc_get.stdout }}" |
| 79 | + l_release_image: "{{ oc_get.stdout }}" |
66 | 80 |
|
67 | 81 | - name: Pull release image
|
68 |
| - command: "podman pull --tls-verify={{ openshift_node_tls_verify }} --authfile {{ tempfile.path }}/pull-secret.json {{ openshift_release_image }}" |
| 82 | + command: "podman pull --tls-verify={{ openshift_node_tls_verify }} --authfile {{ temp_dir.path }}/pull-secret.json {{ l_release_image }}" |
69 | 83 |
|
70 | 84 | - name: Get machine controller daemon image from release image
|
71 |
| - command: "podman run --rm {{ openshift_release_image }} image machine-config-daemon" |
| 85 | + command: "podman run --rm {{ l_release_image }} image machine-config-daemon" |
72 | 86 | register: release_image_mcd
|
73 | 87 |
|
74 | 88 | - block:
|
75 | 89 | - name: Pull MCD image
|
76 |
| - command: "podman pull --tls-verify={{ openshift_node_tls_verify }} --authfile {{ tempfile.path }}/pull-secret.json {{ release_image_mcd.stdout }}" |
| 90 | + command: "podman pull --tls-verify={{ openshift_node_tls_verify }} --authfile {{ temp_dir.path }}/pull-secret.json {{ release_image_mcd.stdout }}" |
77 | 91 |
|
78 | 92 | - name: Apply ignition manifest
|
79 | 93 | command: "podman run {{ podman_mounts }} {{ podman_flags }} {{ mcd_command }}"
|
80 | 94 | vars:
|
81 | 95 | podman_flags: "--privileged --rm -ti {{ release_image_mcd.stdout }}"
|
82 | 96 | podman_mounts: "-v /:/rootfs -v /var/run/dbus:/var/run/dbus -v /run/systemd:/run/systemd"
|
83 |
| - mcd_command: "start --node-name {{ ansible_hostname }} --once-from {{ tempfile.path }}/bootstrap.ign --skip-reboot" |
| 97 | + mcd_command: "start --node-name {{ ansible_hostname }} --once-from {{ temp_dir.path }}/bootstrap.ign --skip-reboot" |
| 98 | + |
| 99 | + - name: Remove temp directory |
| 100 | + file: |
| 101 | + path: "{{ temp_dir.path }}" |
| 102 | + state: absent |
84 | 103 |
|
85 | 104 | - name: Reboot the host and wait for it to come back
|
86 | 105 | reboot:
|
|
0 commit comments