diff --git a/collections/ansible_collections/demo/patching/roles/build_report_network/example_results/Ansible Network Automation Report.png b/collections/ansible_collections/demo/patching/roles/build_report_network/example_results/Ansible Network Automation Report.png index d766491..2cfac3a 100644 Binary files a/collections/ansible_collections/demo/patching/roles/build_report_network/example_results/Ansible Network Automation Report.png and b/collections/ansible_collections/demo/patching/roles/build_report_network/example_results/Ansible Network Automation Report.png differ diff --git a/collections/ansible_collections/demo/patching/roles/build_report_network/files/css/main.css b/collections/ansible_collections/demo/patching/roles/build_report_network/files/css/main.css new file mode 100644 index 0000000..d978eb3 --- /dev/null +++ b/collections/ansible_collections/demo/patching/roles/build_report_network/files/css/main.css @@ -0,0 +1,207 @@ +p.hostname { + color: #000000; + font-weight: bolder; + font-size: large; + margin: auto; + width: 50%; +} + +#subtable { + background: #ebebeb; + margin: 0px; + width: 100%; +} + +#subtable tbody tr td { + padding: 5px 5px 5px 5px; +} + +#subtable thead th { + padding: 5px; +} + +* { + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; + font-family: "Open Sans", "Helvetica"; + +} + +a { + color: #ffffff; +} + +p { + color: #ffffff; +} +h1 { + text-align: center; + color: #ffffff; +} + +body { + background:#353a40; + padding: 0px; + margin: 0px; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; +} + +table { + border-collapse: separate; + background:#fff; + @include border-radius(5px); + @include box-shadow(0px 0px 5px rgba(0,0,0,0.3)); +} + +.main_net_table { + margin:50px auto; +} + +.main_net_table { + margin:50px auto; +} + +thead { + @include border-radius(5px); +} + +thead th { + font-size:16px; + font-weight:400; + color:#fff; + @include text-shadow(1px 1px 0px rgba(0,0,0,0.5)); + text-align:left; + padding:20px; + border-top:1px solid #858d99; + background: #353a40; + + &:first-child { + @include border-top-left-radius(5px); + } + + &:last-child { + @include border-top-right-radius(5px); + } +} + +tbody tr td { + font-weight:400; + color:#5f6062; + font-size:13px; + padding:20px 20px 20px 20px; + border-bottom:1px solid #e0e0e0; + +} + +tbody tr:nth-child(2n) { + background:#f0f3f5; +} + +tbody tr:last-child td { + border-bottom:none; + &:first-child { + @include border-bottom-left-radius(5px); + } + &:last-child { + @include border-bottom-right-radius(5px); + } +} + +td { + vertical-align: top; +} + +span.highlight { + background-color: yellow; +} + +.expandclass { + color: #5f6062; +} + +.content{ + display:none; + margin: 10px; +} + +header { + width: 100%; + position: initial; + float: initial; + padding: 0; + margin: 0; + border-radius: 0; + height: 88px; + background-color: #171717; +} + +.header-container { + margin: 0 auto; + width: 100%; + height: 100%; + max-width: 1170px; + padding: 0; + float: initial; + display: flex; + align-items: center; +} + +.header-logo { + width: 137px; + border: 0; + margin: 0; + margin-left: 15px; +} + +.header-link { + margin-left: 40px; + text-decoration: none; + cursor: pointer; + text-transform: uppercase; + font-size: 15px; + font-family: 'Red Hat Text'; + font-weight: 500; +} + +.header-link:hover { + text-shadow: 0 0 0.02px white; + text-decoration: none; +} + +table.net_info td { + padding: 5px; +} + +p.expandclass:hover { + text-decoration: underline; + color: #EE0000; + cursor: pointer; +} + +.summary_info { +} + +.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active, a.ui-button:active, .ui-button:active, .ui-button.ui-state-active:hover { + border: 1px solid #5F0000; + background: #EE0000; +} + +div#net_content { + padding: 0px; + height: auto !important; +} + +img.router_image { + vertical-align: middle; + padding: 0px 10px 10px 10px; + width: 50px; +} + +table.net_info { + width: 100%; +} + +p.internal_label { + color: #000000; +} diff --git a/collections/ansible_collections/demo/patching/roles/build_report_network/files/css/new.css b/collections/ansible_collections/demo/patching/roles/build_report_network/files/css/new.css deleted file mode 100644 index f58d18f..0000000 --- a/collections/ansible_collections/demo/patching/roles/build_report_network/files/css/new.css +++ /dev/null @@ -1,202 +0,0 @@ -p.hostname { - color: #000000; - font-weight: bolder; - font-size: large; - margin: auto; - width: 50%; - } - - #subtable { - background: #ebebeb; - margin: 0px; - width: 100%; - } - - #subtable tbody tr td { - padding: 5px 5px 5px 5px; - } - - #subtable thead th { - padding: 5px; - } - - * { - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-sizing: border-box; - font-family: "Open Sans", "Helvetica"; - - } - - a { - color: #ffffff; - } - - p { - color: #ffffff; - } - h1 { - text-align: center; - color: #ffffff; - } - - body { - background:#353a40; - padding: 0px; - margin: 0px; - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - } - - table { - border-collapse: separate; - background:#fff; - @include border-radius(5px); - @include box-shadow(0px 0px 5px rgba(0,0,0,0.3)); - } - - .main_net_table { - margin:50px auto; - } - - thead { - @include border-radius(5px); - } - - thead th { - font-size:16px; - font-weight:400; - color:#fff; - @include text-shadow(1px 1px 0px rgba(0,0,0,0.5)); - text-align:left; - padding:20px; - border-top:1px solid #858d99; - background: #353a40; - - &:first-child { - @include border-top-left-radius(5px); - } - - &:last-child { - @include border-top-right-radius(5px); - } - } - - tbody tr td { - font-weight:400; - color:#5f6062; - font-size:13px; - padding:20px 20px 20px 20px; - border-bottom:1px solid #e0e0e0; - } - - tbody tr:nth-child(2n) { - background:#f0f3f5; - } - - tbody tr:last-child td { - border-bottom:none; - &:first-child { - @include border-bottom-left-radius(5px); - } - &:last-child { - @include border-bottom-right-radius(5px); - } - } - - td { - vertical-align: top; - } - - span.highlight { - background-color: yellow; - } - - .expandclass { - color: #5f6062; - } - - .content{ - display:none; - margin: 10px; - } - - header { - width: 100%; - position: initial; - float: initial; - padding: 0; - margin: 0; - border-radius: 0; - height: 88px; - background-color: #171717; - } - - .header-container { - margin: 0 auto; - width: 100%; - height: 100%; - max-width: 1170px; - padding: 0; - float: initial; - display: flex; - align-items: center; - } - - .header-logo { - width: 137px; - border: 0; - margin: 0; - margin-left: 15px; - } - - .header-link { - margin-left: 40px; - text-decoration: none; - cursor: pointer; - text-transform: uppercase; - font-size: 15px; - font-family: 'Red Hat Text'; - font-weight: 500; - } - - .header-link:hover { - text-shadow: 0 0 0.02px white; - text-decoration: none; - } - - table.net_info td { - padding: 5px; -} - -p.expandclass:hover { - text-decoration: underline; - color: #EE0000; - cursor: pointer; -} - -.summary_info { -} - -.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active, a.ui-button:active, .ui-button:active, .ui-button.ui-state-active:hover { - border: 1px solid #5F0000; - background: #EE0000; -} - -div#net_content { - padding: 0px; - height: auto !important; -} - -img.router_image { - vertical-align: middle; - padding: 0px 10px 10px 10px; - width: 50px; -} - -table.net_info { - width: 100%; -} - -p.internal_label { - color: #000000; -} \ No newline at end of file diff --git a/collections/ansible_collections/demo/patching/roles/build_report_network/tasks/main.yml b/collections/ansible_collections/demo/patching/roles/build_report_network/tasks/main.yml index accaeba..f00e455 100644 --- a/collections/ansible_collections/demo/patching/roles/build_report_network/tasks/main.yml +++ b/collections/ansible_collections/demo/patching/roles/build_report_network/tasks/main.yml @@ -1,13 +1,21 @@ +- name: Create web directory if it does not exist + ansible.builtin.file: + path: "{{ file_path }}" + state: directory + mode: '0755' + - name: create HTML report ansible.builtin.template: src: report.j2 dest: "{{ file_path }}/network.html" + check_mode: no - name: copy CSS over ansible.builtin.copy: src: "css" dest: "{{ file_path }}" directory_mode: true + check_mode: no - name: copy logos over ansible.builtin.copy: @@ -18,7 +26,8 @@ - "webpage_logo.png" - "redhat-ansible-logo.svg" - "router.png" + check_mode: no -- name: display link to inventory report - ansible.builtin.debug: - msg: "Please go to http://{{ ansible_host }}/network.html" \ No newline at end of file +# - name: Display link to Linux patch report +# ansible.builtin.debug: +# msg: "Please go to http://{{ hostvars[report_server]['ansible_host'] }}/reports/network.html" diff --git a/collections/ansible_collections/demo/patching/roles/build_report_network/templates/ansible.j2 b/collections/ansible_collections/demo/patching/roles/build_report_network/templates/ansible.j2 new file mode 100644 index 0000000..01386bf --- /dev/null +++ b/collections/ansible_collections/demo/patching/roles/build_report_network/templates/ansible.j2 @@ -0,0 +1,41 @@ + +
| Ansible user | +{{ hostvars[network_switch]['ansible_user'] }} | +
| Transport | +{% set ansible_connection = hostvars[network_switch]['ansible_net_api'] %}{{ transport[ansible_connection] }} | +
| Ansible Mgmt IP | +{{ hostvars[network_switch]['ansible_host'] | default('N/A') }} | +
| Ansible groups | +{% for group in hostvars[network_switch]['group_names'] %}{{ group }} {% endfor %} | +
| Ansible core version | +{% for group in hostvars[network_switch]['ansible_version']['string']|default("Unknown") %}{{ group }} {% endfor %} | +
| Ansible Python | +{{ hostvars[network_switch]['ansible_playbook_python']|default("Unknown") }} | +
| Python version | +{{ hostvars[network_switch]['ansible_net_python_version']|default("Unknown") }} | +