66 lines
1.7 KiB
YAML
66 lines
1.7 KiB
YAML
---
|
|
# MirrorManager2
|
|
- name: Install and configure netbox
|
|
hosts: netbox
|
|
become: false
|
|
vars_files:
|
|
# This playbook requires vaults!
|
|
# vars/vaults/hostman.yml
|
|
# vars/mounts/netbox.yml # we don't know if we'll have uploads
|
|
- vars/vaults/netbox.yml
|
|
- vars/netbox.yml
|
|
|
|
# This is to try to avoid the handler issue in pre/post tasks
|
|
handlers:
|
|
- import_tasks: handlers/main.yml
|
|
|
|
pre_tasks:
|
|
- name: Check if ansible cannot be run here
|
|
stat:
|
|
path: /etc/no-ansible
|
|
register: no_ansible
|
|
|
|
- name: Verify if we can run ansible
|
|
ansible.builtin.assert:
|
|
that:
|
|
- "not no_ansible.stat.exists"
|
|
success_msg: "We are able to run on this node"
|
|
fail_msg: "/etc/no-ansible exists - skipping run on this node"
|
|
|
|
- name: Verify applicable vars are set
|
|
ansible.builtin.assert:
|
|
that:
|
|
- netbox_server_name
|
|
- netbox_db_host
|
|
- netbox_db_user
|
|
- netbox_db_password
|
|
- netbox_secret_key
|
|
success_msg: "Required vars set"
|
|
fail_msg: "We are missing required vars. Please ensure you have them set."
|
|
|
|
# tasks:
|
|
# - include_tasks: tasks/efs_mount.yml
|
|
# loop: "{{ mounts }}"
|
|
# tags: ["mounts"]
|
|
|
|
roles:
|
|
- role: rockylinux.ipagetcert
|
|
become: true
|
|
state: present
|
|
tags: ['certs']
|
|
|
|
tasks:
|
|
- name: Perform netbox installation
|
|
ansible.builtin.import_tasks: tasks/netbox/netbox.yml
|
|
|
|
post_tasks:
|
|
- name: Touching run file that ansible has ran here
|
|
become: true
|
|
ansible.builtin.file:
|
|
path: /var/log/ansible.run
|
|
state: touch
|
|
mode: '0644'
|
|
owner: root
|
|
group: root
|
|
...
|