joelbirchler
2020-03-03 b2bd217aa0ba3af47e2a29d014c84587793e94a5
WIP private workloads works and properly cleans up
4 files deleted
1 files added
2 files modified
306 ■■■■■ changed files
ansible/configs/ansible-skylight/env_vars.yml 4 ●●● patch | view | raw | blame | history
ansible/configs/ansible-skylight/workloads.yml 20 ●●●● patch | view | raw | blame | history
ansible/configs/ansible-skylight/workloads_cleanup.yml 12 ●●●●● patch | view | raw | blame | history
ansible/roles/agnosticd-workload/tasks/tower.yml 240 ●●●●● patch | view | raw | blame | history
ansible/roles/agnosticd-workload/templates/devops-creds.json.j2 10 ●●●●● patch | view | raw | blame | history
ansible/roles/agnosticd-workload/templates/gitlab-creds.json.j2 10 ●●●●● patch | view | raw | blame | history
ansible/roles/agnosticd-workload/templates/tower-creds.json.j2 10 ●●●●● patch | view | raw | blame | history
ansible/configs/ansible-skylight/env_vars.yml
@@ -4,7 +4,9 @@
## Indicate the list of private workloads to deploy with
# this config. Takes a list of remote workloads as parameter
# private_workloads:
# private_workloads.
# Name will be used as part of a path name, so avoid spaces and
# other non-alphanumeric characters.
# - name: workload-name
#   url: ssh://github.com:foo/bar.git
#   path: /classroom/infrastructure/agnosticd-workload
ansible/configs/ansible-skylight/workloads.yml
@@ -4,6 +4,8 @@
  gather_facts: false
  run_once: true
  become: false
  pre_tasks:
    - include: workloads_cleanup.yml
  tasks:
    - name: Create and pull repo
      shell: |
@@ -17,12 +19,11 @@
        git config core.sparseCheckout true
        echo "{{ item.path }}" >> .git/info/sparse-checkout
        git config core.sshCommand "ssh -i {{ item.ssh_key }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
        git pull --depth=1 origin master
        ln -s $source_path/{{ item.path }} $workload_path 
        exit 0
      loop: "{{ private_workloads }}"
- name: Install workloads
@@ -35,6 +36,15 @@
      include_role:
        name: "{{ item.name }}-private-workload"
      vars:
        ACTION:                  "provision"
        workload_name:           "{{ item.name }}"
      loop: "{{ private_workloads }}"
        ACTION:         "provision"
        workload_name:  "{{ item.name }}"
        github_ssh_key: "{{ item.ssh_key }}"
      loop: "{{ private_workloads }}"
- name: Cleanup private workloads
  hosts: localhost
  gather_facts: false
  run_once: true
  become: false
  tasks:
    - include: workloads_cleanup.yml
ansible/configs/ansible-skylight/workloads_cleanup.yml
New file
@@ -0,0 +1,12 @@
---
- name: Remove source repository
  file:
    path: "/tmp/{{ item.name }}-private-workload"
    state: absent
  loop: "{{ private_workloads }}"
- name: Remove workload symlink
  file:
    path: "../../roles/{{ item.name }}-private-workload"
    state: absent
  loop: "{{ private_workloads }}"
ansible/roles/agnosticd-workload/tasks/tower.yml
File was deleted
ansible/roles/agnosticd-workload/templates/devops-creds.json.j2
File was deleted
ansible/roles/agnosticd-workload/templates/gitlab-creds.json.j2
File was deleted
ansible/roles/agnosticd-workload/templates/tower-creds.json.j2
File was deleted