Host management improvements

This commit is contained in:
2020-07-07 16:19:36 -04:00
parent 67cc6ad8a5
commit 6f0e9788d3
4 changed files with 19 additions and 22 deletions

View File

@@ -1,23 +1,29 @@
# Note: need to specify extra_vars, providing ansible_ssh_user, and ansible_ssh_pass
- name: Set up IPA Client
hosts: tag_ipa_client
become: yes
collections:
- freeipa.ansible_freeipa
pre_tasks:
- name: Set hostname
hostname:
name: "{{inventory_hostname}}"
- name: Attach subscriptions
command: '/usr/bin/subscription-manager attach'
register: result
changed_when:
- '"All installed products are covered by valid entitlements. No need to update subscriptions at this time." not in result.stdout'
when: ansible_distribution == "RedHat"
roles:
- role: debian-freeipa-client
when: ansible_facts['os_family'] == "Debian"
when: ansible_os_family == "Debian"
- role: ipaclient
state: present
when: ansible_facts['os_family'] == "RedHat"
when: ansible_os_family == "RedHat"
- name: Set up Basic Lab Packages
hosts: all

View File

@@ -1,7 +1,7 @@
# I started this to create a filter that would translate netbox to linux-system-roles/network.
from ansible.utils.display import Display
from ansible.parsing.yaml import dumper
display = Display()
def get_type(intf_type):
@@ -16,7 +16,6 @@ def get_type(intf_type):
def translate_interface(interface):
display.vv(interface)
lsrint = {
'name': interface['name'],

View File

@@ -1,23 +1,6 @@
---
# Configure a Raspberry Pi running Fedora 32+ for Management functions.
- name: Configure interfaces
hosts: pimgmt
gather_facts: false
connection: local
vars:
network_provider: nm
tasks:
- set_fact:
network_connections: >-
{{ network_connections|default([]) + [{
'name': item.name,
'state': item.enabled |ternary('up','down')
}] }}
loop: "{{ interfaces }}"
- debug:
msg: "Connections = {{ network_connections }}"
# - name: Set Up DHCP System
# hosts: dhcp-server

View File

@@ -1,6 +1,15 @@
# Toal Lab Site Playbook
- name: Set up Network interfaces
hosts: all
gather_facts: true
become: true
roles:
- name: linux-system-roles.network
when: network_connections is defined
- name: Common Lab Machine Setup
hosts: platform_linux
hosts: platform_linux,platform_fedora_linux
become: true
roles:
- toal-common