Linode stackscript fix

This commit is contained in:
Jack Ivanov 2020-08-08 12:30:08 +01:00
parent 96179b8915
commit c184ad2e01

View file

@ -5,6 +5,13 @@
- name: Include prompts - name: Include prompts
import_tasks: prompts.yml import_tasks: prompts.yml
- name: Set facts
set_fact:
stackscript: |
{{ lookup('template', 'files/cloud-init/base.sh') }}
mkdir -p /var/lib/cloud/data/ || true
touch /var/lib/cloud/data/result.json
- name: Create a stackscript - name: Create a stackscript
linode_stackscript_v4: linode_stackscript_v4:
access_token: "{{ algo_linode_token }}" access_token: "{{ algo_linode_token }}"
@ -14,7 +21,7 @@
images: images:
- "{{ cloud_providers.linode.image }}" - "{{ cloud_providers.linode.image }}"
script: | script: |
{{ lookup('template', 'files/cloud-init/base.sh') }} {{ stackscript }}
register: _linode_stackscript register: _linode_stackscript
- name: Update the stackscript - name: Update the stackscript
@ -24,11 +31,11 @@
body_format: json body_format: json
body: body:
script: | script: |
{{ lookup('template', 'files/cloud-init/base.sh') }} {{ stackscript }}
headers: headers:
Content-Type: application/json Content-Type: application/json
Authorization: "Bearer {{ algo_linode_token }}" Authorization: "Bearer {{ algo_linode_token }}"
when: (_linode_stackscript.stackscript.script | hash('md5')) != (lookup('template', 'files/cloud-init/base.sh') | hash('md5')) when: (_linode_stackscript.stackscript.script | hash('md5')) != (stackscript | hash('md5'))
- name: "Creating an instance..." - name: "Creating an instance..."
linode_v4: linode_v4: