add ansible playbook setup
This commit is contained in:
parent
78bfbc3ed6
commit
dbd29507bb
9 changed files with 179 additions and 14 deletions
61
bootstrap/bootstrap.yaml
Normal file
61
bootstrap/bootstrap.yaml
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
- name: Bootstrap system installation
|
||||
hosts: localhost
|
||||
vars_files:
|
||||
- ./variables.yaml
|
||||
tasks:
|
||||
- name: Fedora setup
|
||||
when: ansible_facts['distribution'] == "Fedora"
|
||||
block:
|
||||
- name: Enable copr repos
|
||||
become: true
|
||||
loop: "{{ distros.fedora.copr }}"
|
||||
community.general.copr:
|
||||
state: enabled
|
||||
name: "{{ item }}"
|
||||
|
||||
- name: Install packages
|
||||
become: true
|
||||
ansible.builtin.package:
|
||||
state: present
|
||||
name: "{{ distros.Global.packages }}"
|
||||
|
||||
- name: 'Ensure rustup is setup'
|
||||
ansible.builtin.command: "{{ (ansible_facts['pkg_mgr'] in ['dnf5']) | ternary('rustup-init -y --no-modify-path', 'rustup --no-modify-path -y') }}"
|
||||
args:
|
||||
creates: ~/.cargo/env
|
||||
|
||||
- name: "Installing Cargo Binstall"
|
||||
ansible.builtin.unarchive:
|
||||
remote_src: true
|
||||
src: https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-musl.tgz
|
||||
dest: "{{ ansible_env.HOME }}/.cargo/bin/"
|
||||
keep_newer: true
|
||||
extra_opts:
|
||||
- "--no-anchored"
|
||||
- "cargo-binstall"
|
||||
|
||||
|
||||
- name: 'Install cargo packages'
|
||||
loop: "{{ distros[ansible_facts['distribution']].cargo }}"
|
||||
ansible.builtin.command:
|
||||
cmd: "cargo binstall --no-confirm --locked {{ item.pkg }}"
|
||||
creates: "{{ ansible_env.HOME }}/.cargo/bin/{{ item.bin }}"
|
||||
|
||||
- name: Generate an OpenSSH keypair
|
||||
community.crypto.openssh_keypair:
|
||||
path: ~/.ssh/id_ed25519
|
||||
type: ed25519
|
||||
|
||||
- name: Clone dotfiles
|
||||
ignore_errors: true
|
||||
notify: Deploy dots
|
||||
ansible.builtin.git:
|
||||
accept_newhostkey: true
|
||||
repo: ssh://git@git.alecodes.page:24062/alecodes/dots.git
|
||||
dest: ~/.config/dotfiles
|
||||
update: true
|
||||
version: main
|
||||
|
||||
handlers:
|
||||
- name: Deploy dots
|
||||
ansible.builtin.command: tuckr add *
|
||||
Loading…
Add table
Add a link
Reference in a new issue