-
Notifications
You must be signed in to change notification settings - Fork 66
[Feature] - Add localhost install support #191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # | ||
| # Copyright 2020 - 2021, Dave Slotter (W3DJS). All rights reserved. | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
| 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. | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ooh, I like this! |
||
|
|
||
| - name: Change hostname to hampi (permanently) | ||
| become: yes | ||
|
|
@@ -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 | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And this! |
||
|
|
||
| - name: Change hostname to hampi (for hosts file) | ||
| become: yes | ||
|
|
@@ -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 | ||
|
|
@@ -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 | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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: | ||
|
|
||
There was a problem hiding this comment.
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?