ansible-ops-management/role-rocky-netbox.yml
2024-03-22 23:24:10 -07:00

55 lines
1.4 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"
#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
...