Created
November 15, 2022 22:34
-
-
Save chrisisbeef/72e5cba0f1fd8950ffb337cd8a399bf1 to your computer and use it in GitHub Desktop.
Using Ansible JumpCloud Role with Proxmox Hosts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
all: | |
hosts: | |
host1: | |
host2: | |
host3: | |
pve1: | |
pve2: | |
pve3: | |
children: | |
ubuntu: | |
hosts: | |
host1: | |
host2: | |
windows: | |
hosts: | |
host3: | |
proxmox: | |
pve1: | |
pve2: | |
pve3: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# Setup Jumpcloud Agent on all ansible managed hosts | |
- hosts: all | |
roles: | |
- jumpcloud |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: Restore /etc/issue to it's original content | |
copy: | |
content: "{{ pvebanner }}" | |
dest: /etc/issue | |
become: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# 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