This commit is contained in:
Roberto Alsina 2024-06-26 11:59:54 -03:00
parent 0f9663397b
commit 1c30ded1c3

View File

@ -3,64 +3,65 @@
hosts: servers hosts: servers
become_method: ansible.builtin.sudo become_method: ansible.builtin.sudo
tasks: tasks:
- name: Install some packages - name: Install some packages
become: true become: true
ansible.builtin.package: ansible.builtin.package:
name: name:
- git - git
- vim - vim
- htop - htop
- fish - fish
- rsync - rsync
- restic - restic
- vim - vim
state: present state: present
- name: Install Debian-specific packages - name: Install Debian-specific packages
become: true become: true
when: ansible_os_family == 'Debian' when: ansible_os_family == 'Debian'
ansible.builtin.apt: ansible.builtin.apt:
name: name:
- ncurses-term - ncurses-term
state: present state: present
- name: Add the user ralsina - name: Add the user ralsina
become: true become: true
ansible.builtin.user: ansible.builtin.user:
name: ralsina name: ralsina
create_home: true create_home: true
password_lock: true password_lock: true
shell: /usr/bin/fish shell: /usr/bin/fish
- name: Authorize ssh - name: Authorize ssh
become: true become: true
ansible.posix.authorized_key: ansible.posix.authorized_key:
user: ralsina user: ralsina
state: present state: present
key: "{{ lookup('file', '/home/ralsina/.ssh/id_rsa.pub') }}" key: "{{ lookup('file', '/home/ralsina/.ssh/id_rsa.pub') }}"
- name: Make ralsina a sudoer - name: Make ralsina a sudoer
become: true become: true
community.general.sudoers: community.general.sudoers:
name: ralsina name: ralsina
user: ralsina user: ralsina
state: present state: present
commands: ALL commands: ALL
nopassword: true nopassword: true
- name: Create fish config directory - name: Create fish config directory
ansible.builtin.file: ansible.builtin.file:
path: /home/ralsina/.config/fish/conf.d path: /home/ralsina/.config/fish/conf.d
recurse: true recurse: true
state: directory state: directory
mode: '0755' mode: '0755'
- name: Get starship installer - name: Get starship installer
ansible.builtin.get_url: ansible.builtin.get_url:
url: https://starship.rs/install.sh url: https://starship.rs/install.sh
dest: /tmp/starship.sh dest: /tmp/starship.sh
mode: '0755' mode: '0755'
- name: Install starship - name: Install starship
become: true become: true
ansible.builtin.command: ansible.builtin.command:
cmd: sh /tmp/starship.sh -y cmd: sh /tmp/starship.sh -y
- name: Enable starship creates: /usr/local/bin/starship
ansible.builtin.copy: - name: Enable starship
dest: /home/ralsina/.config/fish/conf.d/starship.fish ansible.builtin.copy:
mode: '0644' dest: /home/ralsina/.config/fish/conf.d/starship.fish
content: | mode: '0644'
starship init fish | source content: |
starship init fish | source