Skip to content

Commit ecbeeaa

Browse files
author
Mike Edwards
committed
Getting the inventory playbook up and running.
1 parent e878a5a commit ecbeeaa

File tree

16 files changed

+128
-27
lines changed

16 files changed

+128
-27
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
---
22
ansible_user: administrator
3-
sudo_password: "{{ ansible_password }}"
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
$ANSIBLE_VAULT;1.1;AES256
2-
62393866393737613264343737623437363936646263636238383131633961303230343636323763
3-
3630353531396232343266613637643866643665316138630a303963363832313136373365613434
4-
64353565383938323737643464623437336139393639303936653039393732363436386433663762
5-
6331623934643035380a666637643131383137336631643165633038646562306539383362346464
6-
66656334323735373130303965653431313434656237643835323561613132333539
2+
36346133663364313965303737353334643936343666643462306565373730636362343132383963
3+
6538343465623661373132316664666230373562653861630a613631623465346230356261643363
4+
30393661383766396161613538353965626263383730306663333561366364646531303665376566
5+
6331366631343038330a626136643137663763646262346136393230363366343035616632326438
6+
37646239306365366464646134613064653538373665336263636531303836373763626436363737
7+
3832656235366162633039616465393439326536326362366364
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
---
22
ansible_user: administrator
3-
sudo_password: "{{ ansible_password }}"
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
$ANSIBLE_VAULT;1.1;AES256
2-
65323063333636663564343831396334346366653363386637323639623636336565623864363038
3-
3164303265323063306135656239643238316462643164370a373266326239363937336631666435
4-
32366334393134633065633964393237326437336435643233663462303131366264653336356363
5-
6664653231666533320a643465613961396431373039623365393362373932333163623963353663
6-
64353635313038393038303262623265623565386533613962303862623862636163
2+
34353535383031623938633031303836343461373862633430663934663161343938356632323061
3+
3965626131663133613064636161396466623236303633350a373266316261303561363565643765
4+
31383132303534383965396537366530633364326262626261393465363634663536323637353564
5+
6432303535336436330a663562633365393039303337636566333934356137393464343536386566
6+
31303233653765323435383831663732306466323537373464616339636661373566343139383430
7+
3464366236396537333330616438363236353934633065623431
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
---
22
ansible_user: administrator
3-
sudo_password: "{{ ansible_password }}"
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
$ANSIBLE_VAULT;1.1;AES256
2-
62383038643665666164633837373732666334386633646364616662636137353464363965373565
3-
3732323630343036313764646238646562393131666432370a653461343332333632643739626464
4-
63316265393464316635313666396139643136633262663834633839383234373732376564626135
5-
3561323433666130320a653938653337373832373762623831386532323232343834313036303465
6-
31666564323037303565653765393535643632373763313039383466383663613738
2+
39323133333464663966616239623833353335316338306139663735323264653630633533323637
3+
6333336565666438303033643363633339633232363963310a643338323035303461646464343239
4+
61366636643733333138306233373231613132383266653133386434383433366663353761613934
5+
3930333335646333350a333261323762356532316339623339306335646336613936636635656430
6+
62643238653830353564623963616264396230626362633464333864616663326236313832313561
7+
3864636636333933653439623132383430343131633666663131

configs/libcxx-ansible/playbooks/playbook_libcxx_inventory.yaml

-9
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,3 @@
33
gather_facts: yes
44
roles:
55
- role: roles/hardware_facts
6-
tasks:
7-
- name: Facts
8-
setup:
9-
- name: "Simple Remote Inventory"
10-
debug:
11-
msg: "{{ansible_facts['nodename']}}: {{ ansible_local.macos.machine_model }} ({{ ansible_local.macos.hw_codename }}) {{ ansible_local.macos.sw_vers }}"
12-
- name: Generate Ansible-cmdb Info
13-
ansible.builtin.template: src=files/inventory dest="out/{{inventory_hostname}}"
14-
delegate_to: localhost
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
Hardware_Facts
2+
=========
3+
4+
This role is used to install a custom fact script which helps generate
5+
hardware information about a node. The information comes from the
6+
system_profiler binary which is part of macOS. This role focuses on
7+
the SPHardwareDataType within system_profiler.
8+
9+
Dependencies
10+
------------
11+
12+
This role depends on the included file/hardware.fact which will be installed on the target machine.
13+
14+
Example Playbook
15+
----------------
16+
17+
---
18+
- hosts: all
19+
roles:
20+
- role: roles/hardware_facts
21+
22+
23+
Example Output
24+
--------------
25+
26+
TASK [roles/hardware_facts : Print Node Hardware Facts] ***********
27+
ok: [smoosh-229] =>
28+
ansible_local.hardware.SPHardwareDataType[0]:
29+
Lightshow_version: 1.4a6
30+
SMC_version_system: 2.20e0
31+
_name: hardware_overview
32+
boot_rom_version: 426.0.0.0.0
33+
cpu_type: 6-Core Intel Xeon E5
34+
current_processor_speed: 3.5 GHz
35+
l2_cache_core: 256 KB
36+
l3_cache: 12 MB
37+
machine_model: MacPro6,1
38+
machine_name: Mac Pro
39+
number_processors: 6
40+
packages: 1
41+
physical_memory: 32 GB
42+
platform_UUID: 3C12ED30-F131-5579-A485-C32B0A027221
43+
platform_cpu_htt: htt_enabled
44+
provisioning_UDID: 3C12ED30-F131-5579-A485-C32B0A027221
45+
serial_number: F5KLQ04CF694
46+
47+
48+
DRI
49+
------------------
50+
51+
[Mike Edwards](<adir://employees/973604498>) - [email protected]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
# defaults file for hardware_facts
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
/usr/sbin/system_profiler -json SPHardwareDataType
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
/usr/sbin/system_profiler -json SPStorageDataType
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
# handlers file for hardware_facts
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
# tasks file for hardware_facts
3+
- name: "Create custom fact directory"
4+
file:
5+
path: "/etc/ansible/facts.d"
6+
state: "directory"
7+
become: yes
8+
9+
- name: "Insert hardware fact file"
10+
become: yes
11+
copy:
12+
src: files/hardware.fact
13+
dest: /etc/ansible/facts.d/hardware.fact
14+
mode: 0755
15+
16+
- name: "Insert storage fact file"
17+
become: yes
18+
copy:
19+
src: files/storage.fact
20+
dest: /etc/ansible/facts.d/storage.fact
21+
mode: 0755
22+
register: copy_status
23+
24+
- name: "Re-run setup to use custom facts"
25+
setup: ~
26+
when: copy_status.changed
27+
28+
- name: Print Node Hardware Facts
29+
ansible.builtin.debug:
30+
var: ansible_local.hardware.SPHardwareDataType[0]
31+
32+
- name: Print Node Storage Facts
33+
ansible.builtin.debug:
34+
var: ansible_local.storage.SPStorageDataType[0]
35+
36+
- name: Print Node Serial Number
37+
ansible.builtin.debug:
38+
msg: "The machine serial number is {{ ansible_local.hardware.SPHardwareDataType[0].serial_number }}"
39+
40+
- name: Print Node Disk Type
41+
ansible.builtin.debug:
42+
msg: "The machine drive type is {{ ansible_local.storage.SPStorageDataType[0].physical_drive.device_name }}"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
localhost
2+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
- hosts: localhost
3+
remote_user: root
4+
roles:
5+
- ./roles/hardware_facts
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
# vars file for hardware_facts

0 commit comments

Comments
 (0)