Skip to content

Commit 0f99570

Browse files
committed
working
1 parent 6465869 commit 0f99570

File tree

9 files changed

+117
-78
lines changed

9 files changed

+117
-78
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.

.gitconfig renamed to ansible/files/gitconfig

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
[user]
22
33
name = Cian Johnston
4-
4+
signingkey = /home/cian/.ssh/id_ed25519.pub
55
66
insteadOf = https://github.com/
77

88
[aliases]
99
add = "add -p" #ALWAYS
10-
as = "! git rebase -i --autosquash main"
10+
as = "! git rebase -i --autosquash master"
1111
diff-file-last-commit = "!f() { \
1212
project_root_dir=$(git rev-parse --show-toplevel); \
1313
echo finding full file path of $1 in $project_root_dir; \
@@ -23,9 +23,11 @@
2323
pu = "pull --all --rebase"
2424
releasenotes = "! set -u; f() { git log --no-merges --pretty=format:\"- %h %s\" $1; }; f"
2525
subup = "submodule update --recursive"
26+
sup = "submodule update --recursive"
2627

2728
[rerere]
2829
enabled = true
2930
[pull]
3031
ff = only
31-
32+
[gpg]
33+
format = ssh
File renamed without changes.

ansible/playbook.yaml

Lines changed: 57 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,81 @@
1010

1111
tasks:
1212
- name: Ensure required packages are available for {{ hostname }}
13+
become: true
1314
ansible.builtin.package:
1415
name: "{{ item }}"
1516
state: present
1617
with_items:
1718
- git
19+
1820
- name: Load vars for {{ hostname }}
1921
ansible.builtin.include_vars: "{{ hostname }}.yaml"
22+
23+
- name: Copy files for {{ hostname }}
24+
ansible.builtin.copy:
25+
src: "{{ item.src }}"
26+
dest: "{{ item.dest }}"
27+
with_items: "{{ dotfiles_files }}"
28+
2029
- name: Ensure src dir is present on {{ hostname }}
2130
ansible.builtin.file:
2231
path: "{{ dotfiles_src_dir }}"
2332
state: directory
24-
mode: '0755'
33+
mode: "0755"
34+
2535
- name: Clone git repos for {{ hostname }}
36+
async: 600
37+
poll: 0
2638
ansible.builtin.git:
2739
repo: "{{ item.src }}"
2840
dest: "{{ item.dest }}"
2941
version: "{{ item.version }}"
3042
force: false
3143
with_items: "{{ dotfiles_git_repos }}"
44+
register: "async_git_status"
45+
46+
- name: Fetch binaries for {{ hostname }}
47+
async: 600
48+
poll: 0
49+
ansible.builtin.get_url:
50+
url: "{{ item.url }}"
51+
dest: "{{ item.dest }}"
52+
mode: "0755"
53+
with_items: "{{ dotfiles_binaries }}"
54+
register: "async_binaries_status"
55+
3256
- name: Install required packages for {{ hostname }}
57+
async: 600
58+
poll: 0
59+
become: true
3360
ansible.builtin.package:
34-
name: "{{ item }}"
61+
name: "{{ dotfiles_packages }}"
3562
state: present
36-
with_items: "{{ dotfiles_packages }}"
63+
register: "async_package_status"
64+
65+
- name: Wait for package installation to finish
66+
become: true
67+
async_status:
68+
jid: "{{ async_package_status.ansible_job_id }}"
69+
register: "package_result"
70+
until: "package_result.finished"
71+
retries: 30
72+
delay: 1
73+
74+
- name: Wait for git to finish
75+
async_status:
76+
jid: "{{ item.ansible_job_id }}"
77+
with_items: "{{ async_git_status.results }}"
78+
register: "git_result"
79+
until: "git_result.finished"
80+
retries: 30
81+
delay: 1
82+
83+
- name: Wait for binaries to finish
84+
async_status:
85+
jid: "{{ item.ansible_job_id }}"
86+
with_items: "{{ async_binaries_status.results }}"
87+
register: "binaries_result"
88+
until: "binaries_result.finished"
89+
retries: 30
90+
delay: 1

ansible/vars/bigred.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
dotfiles_src_dir: ~/src
2+
dotfiles_git_repos:
3+
- src: [email protected]:johnstcn/flux
4+
dest: ~/src/flux
5+
version: main
6+
- src: [email protected]:johnstcn/cianjohnston.ie
7+
dest: ~/src/cianjohnston.ie
8+
version: main
9+
- src: [email protected]:johnstcn/cv.git
10+
dest: ~/src/cv
11+
version: master
12+
dotfiles_packages:
13+
- bat
14+
- byobu
15+
- fd-find
16+
- fzf
17+
- jq
18+
- less
19+
- neovim
20+
- shellcheck
21+
- tree
22+
- vim
23+
dotfiles_binaries:
24+
- url: https://github.com/ahmetb/kubectx/releases/download/v0.9.5/kubectx_v0.9.5_linux_x86_64.tar.gz
25+
dest: "~/bin/kubectx"
26+
- url: https://github.com/ahmetb/kubectx/releases/download/v0.9.5/kubens_v0.9.5_linux_x86_64.tar.gz
27+
dest: "~/bin/kubens"
28+
dotfiles_files:
29+
- src: bashrc
30+
dest: ~/.bashrc
31+
- src: bash_profile
32+
dest: ~/.bash_profile
33+
- src: bash_aliases
34+
dest: ~/.bash_aliases
35+
- src: gitconfig
36+
dest: ~/.gitconfig
37+
- src: vimrc
38+
dest: ~/.vimrc

install.sh

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,30 @@ set -euo pipefail
66

77
REPO_ROOT=$(git rev-parse --show-toplevel)
88

9+
10+
install_package() {
11+
if [[ -f "/etc/debian-release" ]]; then
12+
DEBIAN_FRONTEND=noninteractive sudo apt-get install --no-install-recommends -y "$@"
13+
elif [[ -f "/etc/fedora-release" ]]; then
14+
sudo dnf install -y "$@"
15+
elif [[ -f "/etc/redhat-release" ]]; then
16+
sudo yum install -y "$@"
17+
else
18+
echo "ERROR: Unsupported OS"
19+
exit 1
20+
fi
21+
}
22+
923
# Ensure python3 is available
1024
if ! command -v python3; then
1125
echo "INFO: installing python3"
12-
DEBIAN_FRONTEND=noninteractive sudo apt-get install --no-install-recommends -y python3 python3-virtualenv python3-apt
26+
install_package python3 python3-virtualenv python3-apt
1327
fi
1428

1529
# Ensure virtualenv is available
1630
if ! command -v virtualenv; then
1731
echo "INFO: installing virtualenv"
18-
DEBIAN_FRONTEND=noninteractive sudo apt-get install --no-install-recommends -y python3-virtualenv
32+
install_package python3-virtualenv
1933
fi
2034

2135
# Create a virtualenv
@@ -46,4 +60,4 @@ fi
4660

4761
# Run the playbook
4862
cd "${REPO_ROOT}/ansible"
49-
ansible-playbook playbook.yaml ${ANSIBLE_VERBOSE}
63+
ansible-playbook playbook.yaml --forks $(nproc) ${ANSIBLE_VERBOSE}

install.sh.old

Lines changed: 0 additions & 69 deletions
This file was deleted.

0 commit comments

Comments
 (0)