diff --git a/roles/0-init/tasks/main.yml b/roles/0-init/tasks/main.yml index cf5482144..c1084ff52 100644 --- a/roles/0-init/tasks/main.yml +++ b/roles/0-init/tasks/main.yml @@ -32,11 +32,14 @@ # Copies the latest/known version of iiab-diagnostics into /usr/bin (so it can # be run even if local source tree /opt/iiab/iiab is deleted to conserve disk). -- name: Copy /opt/iiab/iiab/scripts/iiab-diagnostics to /usr/bin/ +- name: Copy iiab-summary & iiab-diagnostics from /opt/iiab/iiab/scripts/ to /usr/bin/ copy: - src: "{{ iiab_dir }}/scripts/iiab-diagnostics" + src: "{{ iiab_dir }}/scripts/{{ item }}" dest: /usr/bin/ mode: '0755' + with_items: + - iiab-summary + - iiab-diagnostics - name: Create globally-writable directory /etc/iiab/diag (0777) so non-root users can run 'iiab-diagnostics' file: diff --git a/roles/1-prep/tasks/main.yml b/roles/1-prep/tasks/main.yml index 0dfd32ee0..d7af981bd 100644 --- a/roles/1-prep/tasks/main.yml +++ b/roles/1-prep/tasks/main.yml @@ -23,14 +23,11 @@ name: iiab-admin #when: iiab_admin_install # Flag might be created in future? -- name: Copy iiab-summary & iiab-apps-to-be-installed from /opt/iiab/iiab/scripts/ to /usr/bin/ +- name: Copy iiab-apps-to-be-installed from {{ iiab_dir }} to /usr/bin/ copy: - src: "{{ iiab_dir }}/scripts/{{ item }}" + src: "{{ iiab_dir }}/scripts/iiab-apps-to-be-installed" # /opt/iiab/iiab/scripts dest: /usr/bin/ mode: '0755' - with_items: - - iiab-summary - - iiab-apps-to-be-installed - name: Install dnsmasq -- configure LATER in 'network', after Stage 9 include_tasks: roles/network/tasks/dnsmasq.yml diff --git a/scripts/iiab-diagnostics b/scripts/iiab-diagnostics index f447fb3d1..2de2e1c76 100755 --- a/scripts/iiab-diagnostics +++ b/scripts/iiab-diagnostics @@ -130,7 +130,7 @@ echo -e "\nCompiling diagnostics..." echo -e "\n 0. HW + SW Quick Summary" echo "This is: $outfile" >> $outfile echo >> $outfile -echo -e "\n\n\n\n0. HW + SW Quick Summary" >> $outfile +echo -e "\n\n\n0. HW + SW Quick Summary" >> $outfile echo >> $outfile /opt/iiab/iiab/scripts/iiab-summary >> $outfile if [ -f /etc/rpi-issue ]; then @@ -147,7 +147,7 @@ if [ -s /tmp/iiab-apps-to-be-installed ]; then fi echo -e '\n 1. Files Specially Requested: (from "iiab-diagnostics PATH/FILE1 PATH/FILE2")\n' -echo -e '\n\n\n\n1. FILES SPECIALLY REQUESTED (FROM "iiab-diagnostics PATH/FILE1 PATH/FILE2")\n' >> $outfile +echo -e '\n\n\n1. FILES SPECIALLY REQUESTED (FROM "iiab-diagnostics PATH/FILE1 PATH/FILE2")\n' >> $outfile for f in "$@"; do cat_file $f done @@ -157,7 +157,7 @@ if [ $# -eq 0 ]; then else echo -e "\n 2. Regular Files:\n" fi -echo -e "\n\n\n\n2. REGULAR FILES\n" >> $outfile +echo -e "\n\n\n2. REGULAR FILES\n" >> $outfile #cat_file /dev/sda # Device "file" test #cat_file /nonsense # Non-existence test #cat_file /opt/iiab/iiab # Directory test @@ -181,7 +181,7 @@ cat_file /library/www/html/home/menu.json #cat_file /tmp/all-ansible-vars echo -e "\n 3. Content of Directories: (1-level deep)\n" -echo -e "\n\n\n\n3. CONTENT OF DIRECTORIES (1-LEVEL DEEP)\n" >> $outfile +echo -e "\n\n\n3. CONTENT OF DIRECTORIES (1-LEVEL DEEP)\n" >> $outfile cat_dir /etc/network/interfaces.d cat_dir /etc/systemd/network cat_dir /etc/NetworkManager/system-connections # Redacts most passwords above @@ -190,7 +190,7 @@ cat_dir /etc/netplan # Redacts most passwords above #cat_dir /etc/network # Above file /etc/network/interfaces suffices echo -e "\n 4. Output of Commands:\n" -echo -e "\n\n\n\n\n4. OUTPUT OF COMMANDS\n" >> $outfile +echo -e "\n\n\n\n4. OUTPUT OF COMMANDS\n" >> $outfile cat_cmd 'uname -a' 'Linux kernel' cat_cmd 'free' 'RAM memory' cat_cmd 'lscpu' 'CPU details' @@ -226,12 +226,12 @@ cat_cmd 'journalctl -t IIAB-CMDSRV' 'Admin Console CMDSRV log' #cat_cmd 'ansible localhost -m setup 2>/dev/null' 'All Ansible facts' # For cleaner scraping of Ansible vars, consider "./runrole all-vars /tmp/all-ansible-vars" 27-31 lines above? echo -e "\n 5. Firewall Rules:\n" -echo -e "\n\n\n\n5. FIREWALL RULES\n" >> $outfile +echo -e "\n\n\n5. FIREWALL RULES\n" >> $outfile #cat_file /usr/bin/iiab-gen-iptables cat_cmd 'sudo iptables-save' 'Firewall rules' echo -e "\n 6. Log Files: (e.g. last 100 lines of each)\n" -echo -e "\n\n\n\n6. LOG FILES (e.g. LAST 100 LINES OF EACH)\n" >> $outfile +echo -e "\n\n\n6. LOG FILES (e.g. LAST 100 LINES OF EACH)\n" >> $outfile cat_cmd 'grep -B2 "SEE ERROR ABOVE" /opt/iiab/iiab/*.log' 'for skip_role_on_error' cat_tail /opt/iiab/iiab/iiab-install.log 100 cat_tail /opt/iiab/iiab/iiab-configure.log 100 diff --git a/scripts/iiab-summary b/scripts/iiab-summary index ffd9ac45c..2e1da90a7 100755 --- a/scripts/iiab-summary +++ b/scripts/iiab-summary @@ -41,7 +41,7 @@ tmp=$(git config branch.$BRANCH2.remote) && { echo "$(grep install_date /etc/iiab/iiab.ini) Current TZ: $(date +%Z)" echo echo -e "iiab: $SHORT_HASH1, $PR_COUNT1 PR's / $COMMITS1 commits since tag $TAG1" -echo -e " \e[1m\"$COMMIT_MSG1\"\e[0m" +echo -e " \"$COMMIT_MSG1\"" echo " $REMOTE_URL1 branch: $BRANCH1" if [ -f /etc/iiab/pr-list-pulled ]; then echo @@ -51,7 +51,7 @@ fi echo if [ -d /opt/iiab/iiab-admin-console ]; then echo -e "iiab-admin-console: $SHORT_HASH2, $PR_COUNT2 PR's / $COMMITS2 commits since tag $TAG2" - echo -e " \e[1m\"$COMMIT_MSG2\"\e[0m" + echo -e " \"$COMMIT_MSG2\"" echo " $REMOTE_URL2 branch: $BRANCH2" else echo " WARNING: Directory /opt/iiab/iiab-admin-console does not exist!"