Host management improvements
This commit is contained in:
@@ -1,23 +1,29 @@
|
|||||||
# Note: need to specify extra_vars, providing ansible_ssh_user, and ansible_ssh_pass
|
# Note: need to specify extra_vars, providing ansible_ssh_user, and ansible_ssh_pass
|
||||||
|
|
||||||
- name: Set up IPA Client
|
- name: Set up IPA Client
|
||||||
hosts: tag_ipa_client
|
hosts: tag_ipa_client
|
||||||
become: yes
|
become: yes
|
||||||
collections:
|
collections:
|
||||||
- freeipa.ansible_freeipa
|
- freeipa.ansible_freeipa
|
||||||
pre_tasks:
|
pre_tasks:
|
||||||
|
- name: Set hostname
|
||||||
|
hostname:
|
||||||
|
name: "{{inventory_hostname}}"
|
||||||
|
|
||||||
- name: Attach subscriptions
|
- name: Attach subscriptions
|
||||||
command: '/usr/bin/subscription-manager attach'
|
command: '/usr/bin/subscription-manager attach'
|
||||||
register: result
|
register: result
|
||||||
changed_when:
|
changed_when:
|
||||||
- '"All installed products are covered by valid entitlements. No need to update subscriptions at this time." not in result.stdout'
|
- '"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:
|
roles:
|
||||||
- role: debian-freeipa-client
|
- role: debian-freeipa-client
|
||||||
when: ansible_facts['os_family'] == "Debian"
|
when: ansible_os_family == "Debian"
|
||||||
- role: ipaclient
|
- role: ipaclient
|
||||||
state: present
|
state: present
|
||||||
when: ansible_facts['os_family'] == "RedHat"
|
when: ansible_os_family == "RedHat"
|
||||||
|
|
||||||
- name: Set up Basic Lab Packages
|
- name: Set up Basic Lab Packages
|
||||||
hosts: all
|
hosts: all
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# I started this to create a filter that would translate netbox to linux-system-roles/network.
|
# I started this to create a filter that would translate netbox to linux-system-roles/network.
|
||||||
|
|
||||||
from ansible.utils.display import Display
|
from ansible.utils.display import Display
|
||||||
|
from ansible.parsing.yaml import dumper
|
||||||
display = Display()
|
display = Display()
|
||||||
|
|
||||||
def get_type(intf_type):
|
def get_type(intf_type):
|
||||||
@@ -16,7 +16,6 @@ def get_type(intf_type):
|
|||||||
|
|
||||||
|
|
||||||
def translate_interface(interface):
|
def translate_interface(interface):
|
||||||
display.vv(interface)
|
|
||||||
|
|
||||||
lsrint = {
|
lsrint = {
|
||||||
'name': interface['name'],
|
'name': interface['name'],
|
||||||
|
|||||||
17
pimgmt.yml
17
pimgmt.yml
@@ -1,23 +1,6 @@
|
|||||||
---
|
---
|
||||||
# Configure a Raspberry Pi running Fedora 32+ for Management functions.
|
# 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
|
# - name: Set Up DHCP System
|
||||||
# hosts: dhcp-server
|
# hosts: dhcp-server
|
||||||
|
|||||||
11
site.yml
11
site.yml
@@ -1,6 +1,15 @@
|
|||||||
# Toal Lab Site Playbook
|
# 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
|
- name: Common Lab Machine Setup
|
||||||
hosts: platform_linux
|
hosts: platform_linux,platform_fedora_linux
|
||||||
become: true
|
become: true
|
||||||
roles:
|
roles:
|
||||||
- toal-common
|
- toal-common
|
||||||
|
|||||||
Reference in New Issue
Block a user