Skip to content
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

Updates #36

Merged
merged 1 commit into from
Dec 10, 2023
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
12 changes: 3 additions & 9 deletions ansible/roles/wsl/tasks/apt.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
---
- name: Add PPA repositories
become: yes
apt_repository:
repo: "{{ item }}"
with_items: "{{ apt_repositories }}"

- name: Update and upgrade apt packages
become: yes
apt:
ansible.builtin.apt:
upgrade: yes
update_cache: yes
cache_valid_time: 86400 #One day

- name: Install packages
become: yes
apt:
ansible.builtin.apt:
name: "{{ apt_packages }}"
state: latest

- name: Remove dependencies that are no longer required
become: yes
apt:
ansible.builtin.apt:
autoremove: yes
10 changes: 5 additions & 5 deletions ansible/roles/wsl/tasks/aws.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@

- name: Install AWS CLI
become: yes
command: /tmp/aws/install
ansible.builtin.command: /tmp/aws/install
args:
creates: /usr/local/aws-cli/v2/current

- name: Update AWS CLI
become: yes
command: /tmp/aws/install --update
ansible.builtin.command: /tmp/aws/install --update
args:
removes: /usr/local/aws-cli/v2/current

- name: Install Session Manager plugin for the AWS CLI
become: yes
apt:
ansible.builtin.apt:
deb: https://s3.amazonaws.com/session-manager-downloads/plugin/latest/ubuntu_64bit/session-manager-plugin.deb

- name: Create directory for AWS SAM CLI installer
Expand All @@ -36,12 +36,12 @@

- name: Install AWS SAM CLI
become: yes
command: /tmp/sam-installation/install
ansible.builtin.command: /tmp/sam-installation/install
args:
creates: /usr/local/aws-sam-cli/current

- name: Update AWS SAM CLI
become: yes
command: /tmp/sam-installation/install --update
ansible.builtin.command: /tmp/sam-installation/install --update
args:
removes: /usr/local/aws-sam-cli/current
2 changes: 1 addition & 1 deletion ansible/roles/wsl/tasks/azure.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
- name: Install the Azure CLI
shell: curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
ansible.builtin.shell: curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
2 changes: 1 addition & 1 deletion ansible/roles/wsl/tasks/bash.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
- name: Add git branch in to bash prompt
blockinfile:
ansible.builtin.blockinfile:
dest: $HOME/.bashrc
block: |
parse_git_branch() {
Expand Down
4 changes: 2 additions & 2 deletions ansible/roles/wsl/tasks/cows.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
- name: Randomise those cow in bashrc!
lineinfile:
ansible.builtin.lineinfile:
path: "$HOME/.bashrc"
line: 'export ANSIBLE_COW_SELECTION=random'
state: present

- name: Randomise those cows in zshrc!
lineinfile:
ansible.builtin.lineinfile:
path: "$HOME/.zshrc"
line: 'export ANSIBLE_COW_SELECTION=random'
state: present
19 changes: 10 additions & 9 deletions ansible/roles/wsl/tasks/gh.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
---
- name: Add GitHub CLI apt key
- name: Add GitHub CLI repository using key from URL
become: yes
apt_key:
keyserver: keyserver.ubuntu.com
id: 23F3D4EA75716059

- name: Add GitHub CLI apt repository
become: yes
command: apt-add-repository https://cli.github.com/packages
ansible.builtin.deb822_repository:
name: github-cli
types: deb
uris: https://cli.github.com/packages
suites: '{{ ansible_distribution_release }}'
components: stable
architectures: amd64
signed_by: https://cli.github.com/packages/githubcli-archive-keyring.gpg

- name: Install GitHub CLI package
become: yes
apt:
ansible.builtin.apt:
name: gh
state: latest
28 changes: 5 additions & 23 deletions ansible/roles/wsl/tasks/go.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,6 @@
---
- name: Add GOPATH in bashrc
lineinfile:
path: "$HOME/.bashrc"
line: 'export GOPATH=$HOME/go'
state: present

- name: Update PATH with GOPATH in bashrc
lineinfile:
path: "$HOME/.bashrc"
line: 'export PATH="${GOPATH}/bin:${PATH}"'
state: present

- name: Add GOPATH in zshrc
lineinfile:
path: "$HOME/.zshrc"
line: 'export GOPATH=$HOME/go'
state: present

- name: Update PATH with GOPATH in zshrc
lineinfile:
path: "$HOME/.zshrc"
line: 'export PATH="${GOPATH}/bin:${PATH}"'
state: present
- name: Install Go
become: yes
community.general.snap:
name: go
classic: true
4 changes: 2 additions & 2 deletions ansible/roles/wsl/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
- import_tasks: apt.yml
- import_tasks: snap.yml
- import_tasks: bash.yml
- import_tasks: zsh.yml
- import_tasks: git.yml
- import_tasks: node.yml
- import_tasks: gh.yml
#- import_tasks: gh.yml
- import_tasks: go.yml
- import_tasks: npm.yml
- import_tasks: ngrok.yml
- import_tasks: aws.yml
- import_tasks: azure.yml
- import_tasks: liquibase.yml
Expand Down
24 changes: 0 additions & 24 deletions ansible/roles/wsl/tasks/ngrok.yml

This file was deleted.

18 changes: 13 additions & 5 deletions ansible/roles/wsl/tasks/node.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
---
- name: Add a source file for the official Node.js {{ node_version }}.x repo
shell: curl -sL https://deb.nodesource.com/setup_{{ node_version }}.x | sudo -E bash -
- name: Download nodesource setup script
ansible.builtin.get_url:
url: https://deb.nodesource.com/nsolid_setup_deb.sh
dest: /tmp/nsolid_setup_deb.sh
mode: '0500'

- name: Install Node.js {{ node_version }}.x
- name: Run nodesource setup script
become: yes
apt:
ansible.builtin.shell: /tmp/nsolid_setup_deb.sh {{ node_version }}
args:
creates: /usr/share/keyrings/nodesource.gpg

- name: Install Node.js {{ node_version }}
become: yes
ansible.builtin.apt:
name: nodejs
state: latest
4 changes: 4 additions & 0 deletions ansible/roles/wsl/tasks/snap.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- name: Install snap packages
become: yes
community.general.snap:
name: "{{ snap_packages }}"
8 changes: 7 additions & 1 deletion ansible/roles/wsl/tasks/tmpreaper.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
---
- name: Run tmpreaper in bashrc to clean the tmp directory
ansible.builtin.lineinfile:
path: "$HOME/.bashrc"
line: 'tmpreaper 7d /tmp'
state: present

- name: Run tmpreaper in zshrc to clean the tmp directory
lineinfile:
ansible.builtin.lineinfile:
path: "$HOME/.zshrc"
line: 'tmpreaper 7d /tmp'
state: present
13 changes: 6 additions & 7 deletions ansible/roles/wsl/vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
apt_repositories:
- ppa:rmescandon/yq
- ppa:longsleep/golang-backports

apt_packages:
- curl
- zip
- jq
- yq
- cowsay
- golang-go
- python3-debian
- python3-pip
- python3-venv
- zsh
- default-jre
- tmpreaper
- qdirstat

snap_packages:
- ngrok
- yq

node_packages:
- aws-cdk

node_version: 18
node_version: 20

liquibase_version: 4.25.0
3 changes: 2 additions & 1 deletion setup.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
sudo apt update
sudo apt upgrade
sudo apt install make
sudo apt install software-properties-common
sudo add-apt-repository --yes --update ppa:ansible/ansible
sudo apt install ansible
ansible-galaxy collection install community.general
Loading