Skip to content
Merged
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,6 @@ Session.vim

## Temporary
*~

artifacts/
*.installed
35 changes: 26 additions & 9 deletions src/firewheel_repo_linux/linux/INSTALL/tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,38 @@
state: directory
loop: "{{ files }}"

- name: Create parent directories for SSH
ansible.builtin.file:
path: "{{ ssh_profile.path }}"
state: directory
mode: "0700"

- name: Check if combined_profiles.tgz exists
ansible.builtin.stat:
path: "{{ download_dir }}/combined_profiles.tgz"
register: combined_profiles_stat

- name: Download and verify files
ansible.builtin.get_url:
url: "{{ item.url }}"
dest: "{{ download_dir }}/{{ item.parent }}/{{ item.dest }}"
checksum: "sha256:{{ item.sha256 }}"
loop: "{{ files }}"

- name: Generate SSH key pair (if applicable)
ansible.builtin.openssh_keypair:
- name: Check if SSH private key already exists
ansible.builtin.stat:
path: "{{ ssh_profile.path }}/id_rsa"
type: rsa
size: 2048
when: ssh_profile.ssh_keypair | default(false)
register: ssh_key_status

- name: Generate SSH key pair using Bash (if not already present)
ansible.builtin.command: >
ssh-keygen -t rsa -b 2048 -f "{{ ssh_profile.path }}/id_rsa" -N ""
when: not ssh_key_status.stat.exists

- name: Add public key to authorized_keys
ansible.builtin.copy:
content: "{{ lookup('file', ssh_profile.path + '/id_rsa.pub') }}"
dest: "{{ ssh_profile.path }}/authorized_keys"
when: ssh_profile.ssh_keypair | default(false)

- name: Create SSH config file
ansible.builtin.copy:
Expand All @@ -38,22 +51,26 @@
UserKnownHostsFile /dev/null
ForwardX11Trusted yes
dest: "{{ ssh_profile.path }}/config"
when: ssh_profile.ssh_keypair | default(false)

- name: Set permissions for SSH files
ansible.builtin.file:
path: "{{ ssh_profile.path }}/{{ item.file }}"
mode: "{{ item.mode }}"
loop: "{{ ssh_profile.permissions }}"
when: ssh_profile.ssh_keypair | default(false)

- name: Compress profiles into tarball
ansible.builtin.archive:
path:
- "{{ download_dir }}/profiles"
- "{{ ssh_profile.path }}"
dest: "{{ download_dir }}/combined_profiles.tgz"
format: gz
when: not combined_profiles_stat.stat.exists

- name: Set permissions for combined_profiles.tgz
ansible.builtin.file:
path: "{{ download_dir }}/combined_profiles.tgz"
mode: "0666"
when: combined_profiles_stat.stat.exists

- name: Clean up temporary files
ansible.builtin.file:
Expand Down
10 changes: 2 additions & 8 deletions src/firewheel_repo_linux/linux/INSTALL/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@ files:
dest: ".bashrc"
url: "https://github.com/sudonitesh/beautiful-bash/raw/4ad53ee9d1b0e2104e9dd77ae4f74e71262395d5/.bashrc"
sha256: "19fca5072753f1bf8da1d4770d7dfe409c84e29ad21bbe92abbe37b7232df249"
- parent: "profiles"
- parent: "."
dest: "tmux-cssh"
url: "https://gitlab.com/peikk0/tmux-cssh/-/raw/a35957f7d9a0dbfd296b73dbb6f56ee4c193dc56/tmux-cssh"
sha256: "cd44ed3321abc190a0a128b944b004857770e8ea18c03952e63a234cb3056098"

ssh_profile:
path: "{{ download_dir }}/.ssh"
ssh_keypair: true
path: "{{ download_dir }}/profiles/.ssh"
permissions:
- file: "authorized_keys"
mode: "0600"
Expand All @@ -26,8 +25,3 @@ ssh_profile:
required_files:
- destination: "{{ download_dir }}/combined_profiles.tgz"
- destination: "{{ download_dir }}/tmux-cssh"
- destination: "{{ mc_dir }}/vm_resources/chpasswd.sh"
- destination: "{{ mc_dir }}/vm_resources/configure_ips.sh"
- destination: "{{ mc_dir }}/vm_resources/set_hostname.sh"
- destination: "{{ mc_dir }}/vm_resources/set_netplan_interfaces.sh"
- destination: "{{ mc_dir }}/vm_resources/set_ulimit.sh"