diff --git a/bootstrap.yml b/bootstrap.yml index dfa3417..c869ec6 100644 --- a/bootstrap.yml +++ b/bootstrap.yml @@ -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 diff --git a/filter_plugins/netbox_filters.py b/filter_plugins/netbox_filters.py index 3df0190..d40ec51 100644 --- a/filter_plugins/netbox_filters.py +++ b/filter_plugins/netbox_filters.py @@ -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'], diff --git a/pimgmt.yml b/pimgmt.yml index bf07fde..4aeeabd 100644 --- a/pimgmt.yml +++ b/pimgmt.yml @@ -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 diff --git a/site.yml b/site.yml index 18849c1..0542bbe 100644 --- a/site.yml +++ b/site.yml @@ -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