Skip to content

Instantly share code, notes, and snippets.

@jclaret
Created February 7, 2019 19:20
Show Gist options
  • Save jclaret/9b338197fe5f0721605ab27928b700b7 to your computer and use it in GitHub Desktop.
Save jclaret/9b338197fe5f0721605ab27928b700b7 to your computer and use it in GitHub Desktop.
---
# The following variables will be set by the runner of this playbook:
# src: /tmp/some/path/private_data_dir
# dest: /tmp/some/path/
# proot_temp_dir: /tmp/some/path
- name: Prepare data, dispatch job in isolated environment.
hosts: all
gather_facts: false
vars:
secret: "{{ lookup('pipe', 'cat ' + src + '/env') }}"
pre_tasks:
- name: Load variables
include_vars: vars/vars.yaml
when: inventory_hostname == "34.253.237.27"
tasks:
- name: create a proot/bwrap temp dir (if necessary)
synchronize:
src: "{{proot_temp_dir}}"
dest: "{{dest}}"
when: proot_temp_dir is defined
- name: synchronize job environment with isolated host
synchronize:
copy_links: true
src: "{{src}}"
dest: "{{dest}}"
- name: create a named pipe for secret environment data
command: "mkfifo {{src}}/env"
- name: spawn the playbook
command: "awx-expect start {{src}}"
- name: write the secret environment data
mkfifo:
content: "{{secret}}"
path: "{{src}}/env"
no_log: True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment