Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

Desktop Launcher for NOAA-APT
Add support for Xubuntu 22 for HamPC
- Support to install from ansible playbook on the localhost with an existing user `hampc`

### Changed

Expand Down
2 changes: 2 additions & 0 deletions ansible.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ inventory = hosts
#remote_port = 22
#module_lang = C

is_local_install = False
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wsciaroni Is there any way to parameterize this from a higher level?


# plays will gather facts by default, which contain information about
# the remote system.
#
Expand Down
12 changes: 12 additions & 0 deletions hosts_ubuntu_local
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
# Copyright 2020 - 2021, Dave Slotter (W3DJS). All rights reserved.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change 2021 to 2022.

#

[all]
127.0.0.1 ansible_user=hampi

[all:vars]
ansible_user=hampi
ansible_password=hampi
ansible_port=9022
is_local_install=True
23 changes: 23 additions & 0 deletions run_HamPi_playbook_ubuntu_local
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash
#
# Copyright 2020 - 2021, Dave Slotter (W3DJS). All rights reserved.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wsciaroni Please change 2021 to 2022. And you can add your own credits to mine if you'd like for the enhancement.

#

echo -n "Ansible Playbook Run started at: "
start_time=`date`
echo $start_time
# Compute the seconds since epoch for start date
t1=`date --date="$start_time" +%s`

curdate=`date +%Y-%m-%d`

echo "ansible-playbook -i hosts tasks/main.yml"
ansible-playbook -u hampc -i hosts_ubuntu_local --connection=local ./tasks/main.yml | tee --append ansible-output_${curdate}.txt
notify_via_email.py "Ansible has finished (HamPi)."

# Compute the seconds since epoch for end date
end_time=`date`
t2=`date --date="$end_time" +%s`

let diff_time=$t2-$t1
printf "Total time for running Ansible Playbook: %02d:%02d:%02d\n" $((diff_time/3600)) $((diff_time%3600/60)) $((diff_time%60)) | tee --append ansible-output_${curdate}.txt
8 changes: 4 additions & 4 deletions tasks/configuration_tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
- name: Change hostname to hampc (for current session)
become: yes
command: hostname -b hampc
when: is_pc|bool
when: is_pc|bool and not is_local_install|bool
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooh, I like this!


- name: Change hostname to hampi (permanently)
become: yes
Expand All @@ -44,7 +44,7 @@
copy:
src: "{{ playbook_dir }}/../files/etc/hostname_hampc"
dest: "/etc/hostname"
when: is_pc|bool
when: is_pc|bool and not is_local_install|bool
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this!


- name: Change hostname to hampi (for hosts file)
become: yes
Expand All @@ -58,7 +58,7 @@
copy:
src: "{{ playbook_dir }}/../files/etc/hosts_hampc"
dest: "/etc/hosts"
when: is_pc|bool
when: is_pc|bool and not is_local_install|bool

- name: Store a basic version file in public location
become: yes
Expand Down Expand Up @@ -207,7 +207,7 @@
copy:
src: "{{ playbook_dir }}/../files/etc/xdg/xdg-xubuntu/xfce4/xfconf/xfce-perchannel-xml/xfce4-desktop.xml"
dest: "/etc/xdg/xdg-xubuntu/xfce4/xfconf/xfce-perchannel-xml/xfce4-desktop.xml"
when: ansible_distribution == "Ubuntu" and ansible_os_family == "Debian" and (ansible_architecture == "x86_64" or ansible_architecture == "amd64")
when: ansible_distribution == "Ubuntu" and ansible_os_family == "Debian" and (ansible_architecture == "x86_64" or ansible_architecture == "amd64") and not is_local_install|bool
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, since I created the vars "is_pc" and "is_rpi", I haven't simplified the rest of the Ansible playbooks... This is one of literally dozens if not hundreds of examples which could be simplified... Consider this for an optimization down the road...


- name: Create /home/{{ ham_user }}/.config/pcmanfm/LXDE-pi directory
file:
Expand Down