Skip to content

Instantly share code, notes, and snippets.

@chrisisbeef
Created November 15, 2022 22:34
Show Gist options
  • Save chrisisbeef/72e5cba0f1fd8950ffb337cd8a399bf1 to your computer and use it in GitHub Desktop.
Save chrisisbeef/72e5cba0f1fd8950ffb337cd8a399bf1 to your computer and use it in GitHub Desktop.
Using Ansible JumpCloud Role with Proxmox Hosts
---
all:
hosts:
host1:
host2:
host3:
pve1:
pve2:
pve3:
children:
ubuntu:
hosts:
host1:
host2:
windows:
hosts:
host3:
proxmox:
pve1:
pve2:
pve3:
---
- name: Prepare proxmox hosts for Jumpcloud Agent Installation
when: inventory_hostname in groups['proxmox'] and jumpcloud_agent_present is undefined
import_tasks: proxmox-prepare.yml
- name: Install Ansible Agent
ansible.builtin.include_role:
name: "inviqa.jumpcloud"
- name: Set a fact to indicate that Jumpcloud Agent is Installed
ansible.builtin.set_fact:
jumpcloud_agent_present: true
- name: Cleanup proxmox hosts after Jumpcloud Agent Installation
when: inventory_hostname in groups['proxmox'] and jumpcloud_agent_present is undefined
import_tasks: proxmox-cleanup.yml
---
# Setup Jumpcloud Agent on all ansible managed hosts
- hosts: all
roles:
- jumpcloud
---
- name: Restore /etc/issue to it's original content
copy:
content: "{{ pvebanner }}"
dest: /etc/issue
become: true
---
- name: Set a new fact with content of /etc/issue
ansible.builtin.set_fact:
pvebanner: "{{ lookup('file', '/etc/issue') }}"
- name: Write the Debian Banner to /etc/issue
copy:
content: "Debian GNU/Linux 9 \\n \\l"
dest: /etc/issue
become: true
---
# Include the Ansible Jumpcloud Role
- src: inviqa.jumpcloud
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment